Add error handling for FTS3 tokenizer
This commit is contained in:
parent
5e8dcd668c
commit
97eadbd441
@ -270,11 +270,13 @@ QSqlDatabase Database::Connect() {
|
|||||||
// In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER (generally a good idea
|
// In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER (generally a good idea
|
||||||
// due to security reasons) the fts3 support should be enabled explicitly.
|
// due to security reasons) the fts3 support should be enabled explicitly.
|
||||||
// see https://github.com/clementine-player/Clementine/issues/5297
|
// see https://github.com/clementine-player/Clementine/issues/5297
|
||||||
|
//
|
||||||
|
// See https://www.sqlite.org/fts3.html#custom_application_defined_tokenizers
|
||||||
QVariant v = db.driver()->handle();
|
QVariant v = db.driver()->handle();
|
||||||
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
|
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
|
||||||
sqlite3* handle = *static_cast<sqlite3**>(v.data());
|
sqlite3* handle = *static_cast<sqlite3**>(v.data());
|
||||||
if (handle) {
|
if (!handle || sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, nullptr) != SQLITE_OK) {
|
||||||
sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL);
|
qLog(Fatal) << "Failed to enable FTS3 tokenizer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user