core/database: configure fts3 tokenizer support
Original patch by Arfrever This fixes https://github.com/clementine-player/Clementine/issues/5297
This commit is contained in:
parent
f7eea6c505
commit
77b6d72a3e
|
@ -265,6 +265,20 @@ QSqlDatabase Database::Connect() {
|
|||
StaticInit();
|
||||
|
||||
{
|
||||
|
||||
#ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
|
||||
// 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.
|
||||
// see https://github.com/clementine-player/Clementine/issues/5297
|
||||
QVariant v = db.driver()->handle();
|
||||
if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
|
||||
sqlite3* handle = *static_cast<sqlite3**>(v.data());
|
||||
if (handle) {
|
||||
sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QSqlQuery set_fts_tokenizer("SELECT fts3_tokenizer(:name, :pointer)", db);
|
||||
set_fts_tokenizer.bindValue(":name", "unicode");
|
||||
set_fts_tokenizer.bindValue(
|
||||
|
|
Loading…
Reference in New Issue