1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

re-enable perl tokenizer by calling sqlite3_db_config if SQLite >= 3.12

This commit is contained in:
Kenichi Ishigaki 2016-11-26 10:07:24 +09:00
parent 8878009ede
commit e17149317a
4 changed files with 9 additions and 11 deletions

View file

@ -288,11 +288,7 @@ register_fts3_perl_tokenizer(dbh)
ALIAS: ALIAS:
DBD::SQLite::db::sqlite_register_fts3_perl_tokenizer = 1 DBD::SQLite::db::sqlite_register_fts3_perl_tokenizer = 1
CODE: CODE:
#if SQLITE_ENABLE_FTS3_TOKENIZER
RETVAL = sqlite_db_register_fts3_perl_tokenizer(aTHX_ dbh); RETVAL = sqlite_db_register_fts3_perl_tokenizer(aTHX_ dbh);
#else
RETVAL = 0;
#endif
OUTPUT: OUTPUT:
RETVAL RETVAL

View file

@ -2632,12 +2632,7 @@ sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename)
#endif #endif
} }
#if SQLITE_VERSION_NUMBER < 3011000 #include "dbdimp_tokenizer.inc"
#include "dbdimp_tokenizer.inc"
#elif SQLITE_ENABLE_FTS3_TOKENIZER
#include "dbdimp_tokenizer.inc"
#endif
#include "dbdimp_virtual_table.inc" #include "dbdimp_virtual_table.inc"
/* end */ /* end */

View file

@ -276,6 +276,13 @@ int sqlite_db_register_fts3_perl_tokenizer(pTHX_ SV *dbh)
return FALSE; return FALSE;
} }
#if SQLITE_VERSION_NUMBER >= 3012000
rc = sqlite3_db_config(imp_dbh->db, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, 0);
if( rc!=SQLITE_OK ){
return rc;
}
#endif
rc = sqlite3_prepare_v2(imp_dbh->db, zSql, -1, &pStmt, 0); rc = sqlite3_prepare_v2(imp_dbh->db, zSql, -1, &pStmt, 0);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
return rc; return rc;

View file

@ -33,7 +33,7 @@ BEGIN {
if (!grep /ENABLE_FTS3/, DBD::SQLite::compile_options()) { if (!grep /ENABLE_FTS3/, DBD::SQLite::compile_options()) {
plan skip_all => 'FTS3 is disabled for this DBD::SQLite'; plan skip_all => 'FTS3 is disabled for this DBD::SQLite';
} }
if ($DBD::SQLite::sqlite_version_number >= 3011000 and !grep /ENABLE_FTS3_TOKENIZER/, DBD::SQLite::compile_options()) { if ($DBD::SQLite::sqlite_version_number >= 3011000 and $DBD::SQLite::sqlite_version_number < 3012000 and !grep /ENABLE_FTS3_TOKENIZER/, DBD::SQLite::compile_options()) {
plan skip_all => 'FTS3 tokenizer is disabled for this DBD::SQLite'; plan skip_all => 'FTS3 tokenizer is disabled for this DBD::SQLite';
} }
} }