Skip to content

Commit

Permalink
Set SQLite pragma to make LIKE matching case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Trabant committed May 3, 2017
1 parent eb2a01b commit ed5abe9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
2917.071: 2.3
2017.123: 2.4
- Update libmseed to 2.19.4.
- Update SQLite to 3.18.0.
- Add 'PRAGMA case_sensitive_like = ON' for SQLite synchronization.
This means that the LIKE queries are performed case sensitive as
the should be for the programs usage with the filename column.
Importantly, this allows the LIKE matching to use the column index.

2017.071: 2.3
- Add -noup (no updates) option to refrain from searching for and
deleting existing rows in the database.
- Remove double quotes from keys and values of timeindex field
Expand Down
16 changes: 14 additions & 2 deletions src/mseedindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
*
* Written by Chad Trabant, IRIS Data Management Center.
*
* modified 2017.071
* modified 2017.123
***************************************************************************/

#define _GNU_SOURCE
Expand All @@ -106,7 +106,7 @@

#include "md5.h"

#define VERSION "2.3"
#define VERSION "2.4"
#define PACKAGE "mseedindex"

static flag verbose = 0;
Expand Down Expand Up @@ -1087,6 +1087,18 @@ SyncSQLite (void)
}
}

/* Set LIKE operator to be case-sensitive as it should be with file names.
* More importantly, this allows the index on the filename column to be used with our LIKEs. */
rv = SQLiteExec (dbconn, NULL, NULL, &errmsg,
"PRAGMA case_sensitive_like = ON",
table, table);
if (rv != SQLITE_OK)
{
ms_log (2, "SQLite PRAGMA case_sensitive_like = ON failed: %s\n", (errmsg) ? errmsg : "");
sqlite3_free (errmsg);
return -1;
}

/* Create table if it does not exist */
rv = SQLiteExec (dbconn, NULL, NULL, &errmsg,
"CREATE TABLE IF NOT EXISTS %s "
Expand Down

0 comments on commit ed5abe9

Please sign in to comment.