diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2017-08-06 18:38:00 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2017-08-06 23:13:34 +0200 |
commit | 4aadfc9e424d969b9b69663ff7c6ec07c7c029dc (patch) | |
tree | 06759e967756f2e7de8b7d70deb2411fdc2af549 /src/libtracker-fts | |
parent | f5286e39d69591b6bf832ce7921fb74e9c01202c (diff) | |
download | tracker-4aadfc9e424d969b9b69663ff7c6ec07c7c029dc.tar.gz |
libtracker-fts: Adapt to incompatible change in sqlite 3.20
From that version on, we must use the brand new sqlite3_bind_pointer()
interface to access the fts5 interface pointer. Adapt to it without
giving up older versions.
https://bugzilla.gnome.org/show_bug.cgi?id=785883
Diffstat (limited to 'src/libtracker-fts')
-rw-r--r-- | src/libtracker-fts/tracker-fts-tokenizer.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/libtracker-fts/tracker-fts-tokenizer.c b/src/libtracker-fts/tracker-fts-tokenizer.c index e233fd92d..809e94e2f 100644 --- a/src/libtracker-fts/tracker-fts-tokenizer.c +++ b/src/libtracker-fts/tracker-fts-tokenizer.c @@ -389,14 +389,28 @@ get_fts5_api (sqlite3 *db) { sqlite3_stmt *stmt; fts5_api *api = NULL; - rc = sqlite3_prepare_v2(db, "SELECT fts5()", - -1, &stmt, 0); +#if SQLITE_VERSION_NUMBER >= 3020000 + /* Sqlite >= 3.20.0 mandates sqlite3_bind_pointer() to fetch fts5 */ + if (sqlite3_libversion_number () >= 3020000) { + rc = sqlite3_prepare_v2(db, "SELECT fts5(?1)", + -1, &stmt, 0); + if (rc != SQLITE_OK) + return NULL; + + sqlite3_bind_pointer (stmt, 1, (void*) &api, "fts5_api_ptr", NULL); + sqlite3_step (stmt); + } else +#endif + { + rc = sqlite3_prepare_v2(db, "SELECT fts5()", + -1, &stmt, 0); - if (rc != SQLITE_OK) - return NULL; + if (rc != SQLITE_OK) + return NULL; - if (sqlite3_step (stmt) == SQLITE_ROW) - memcpy (&api, sqlite3_column_blob (stmt, 0), sizeof (api)); + if (sqlite3_step (stmt) == SQLITE_ROW) + memcpy (&api, sqlite3_column_blob (stmt, 0), sizeof (api)); + } sqlite3_finalize (stmt); |