Ensure an up to date copy of the fts5 configuration has been loaded into memory before attempting to modify the same configuration.

FossilOrigin-Name: f30afd209aa4ce42766b1493750c4f5b5f1e9502
This commit is contained in:
dan 2015-01-17 20:01:52 +00:00
parent 2656167f6e
commit d8736bc3b8
6 changed files with 47 additions and 17 deletions

View File

@ -1085,7 +1085,10 @@ static int fts5SpecialInsert(
}else if( 0==sqlite3_stricmp("integrity-check", z) ){
rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);
}else{
rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, z, pVal, &bError);
rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
if( rc==SQLITE_OK ){
rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, z, pVal, &bError);
}
if( rc==SQLITE_OK ){
if( bError ){
rc = SQLITE_ERROR;

View File

@ -343,6 +343,8 @@ int sqlite3Fts5IndexReads(Fts5Index *p);
int sqlite3Fts5IndexReinit(Fts5Index *p);
int sqlite3Fts5IndexOptimize(Fts5Index *p);
int sqlite3Fts5IndexLoadConfig(Fts5Index *p);
/*
** End of interface to code in fts5_index.c.
**************************************************************************/

View File

@ -4368,6 +4368,13 @@ int sqlite3Fts5IndexSetCookie(Fts5Index *p, int iNew){
return rc;
}
int sqlite3Fts5IndexLoadConfig(Fts5Index *p){
Fts5Structure *pStruct;
pStruct = fts5StructureRead(p, 0);
fts5StructureRelease(pStruct);
return fts5IndexReturn(p);
}
/*************************************************************************
**************************************************************************
** Below this point is the implementation of the fts5_decode() scalar

View File

@ -24,16 +24,22 @@ proc usage {} {
puts stderr "Usage: $::argv0 ?SWITCHES? DATABASE PATH"
puts stderr ""
puts stderr "Switches are:"
puts stderr " -fts4 (use fts4 instead of fts5)"
puts stderr " -fts4 (use fts4 instead of fts5)"
puts stderr " -fts5 (use fts5)"
puts stderr " -porter (use porter tokenizer)"
puts stderr " -limit N (load no more than N documents)"
puts stderr " -automerge N (set the automerge parameter to N)"
exit 1
}
set O(vtab) fts5
set O(tok) ""
set O(limit) 0
set O(vtab) fts5
set O(tok) ""
set O(limit) 0
set O(automerge) -1
if {[llength $argv]<2} usage
for {set i 0} {$i < [llength $argv]-2} {incr i} {
set nOpt [expr {[llength $argv]-2}]
for {set i 0} {$i < $nOpt} {incr i} {
set arg [lindex $argv $i]
switch -- [lindex $argv $i] {
-fts4 {
@ -49,9 +55,14 @@ for {set i 0} {$i < [llength $argv]-2} {incr i} {
}
-limit {
incr i
if { [incr i]>=$nOpt } usage
set O(limit) [lindex $argv $i]
}
-automerge {
if { [incr i]>=$nOpt } usage
set O(automerge) [lindex $argv $i]
}
default {
usage
@ -64,6 +75,13 @@ db func loadfile loadfile
db transaction {
db eval "CREATE VIRTUAL TABLE t1 USING $O(vtab) (path, content$O(tok))"
if {$O(automerge)>=0} {
if {$O(vtab) == "fts5"} {
db eval { INSERT INTO t1(t1, rank) VALUES('automerge', $O(automerge)) }
} else {
db eval { INSERT INTO t1(t1) VALUES('automerge=' || $O(automerge)) }
}
}
load_hierachy [lindex $argv end]
}

View File

@ -1,5 +1,5 @@
C Improve\sthe\sperformance\sof\sthe\sfts5\sporter\stokenizer\simplementation.
D 2015-01-17T17:48:10.103
C Ensure\san\sup\sto\sdate\scopy\sof\sthe\sfts5\sconfiguration\shas\sbeen\sloaded\sinto\smemory\sbefore\sattempting\sto\smodify\sthe\ssame\sconfiguration.
D 2015-01-17T20:01:52.023
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -104,15 +104,15 @@ F ext/fts3/unicode/CaseFolding.txt 8c678ca52ecc95e16bc7afc2dbf6fc9ffa05db8c
F ext/fts3/unicode/UnicodeData.txt cd07314edb62d49fde34debdaf92fa2aa69011e7
F ext/fts3/unicode/mkunicode.tcl 4199cb887040ee3c3cd59a5171ddb0566904586e
F ext/fts5/extract_api_docs.tcl 55a6d648d516f35d9a1e580ac00de27154e1904a
F ext/fts5/fts5.c 790880afffb249c79f9a36b38f9d774515f5cf7b
F ext/fts5/fts5.c 0ba5a8f27e1aa4deab82f0fc295d55f67dfe7f34
F ext/fts5/fts5.h f931954065693898d26c51f23f1d27200184a69a
F ext/fts5/fts5Int.h 0142ba4c3c70e1976578604c0e738670f7689726
F ext/fts5/fts5Int.h b593d5ff5f0cc6493778f88bc19db1dea42e003b
F ext/fts5/fts5_aux.c 549aef152b0fd46020f5595d861b1fd60b3f9b4f
F ext/fts5/fts5_buffer.c 32dd3c950392346ca69a0f1803501766c5c954f9
F ext/fts5/fts5_config.c 33534ca25198cc62c54ff7d285d455c57ad19399
F ext/fts5/fts5_expr.c 6ba7a2e34a80989cca509bd295de1bc9f8e739a3
F ext/fts5/fts5_hash.c 63fa8379c5f2ac107d47c2b7d9ac04c95ef8a279
F ext/fts5/fts5_index.c 6f9f98875b2ee5a16255911e1dc1b0b32cb1c350
F ext/fts5/fts5_index.c 33473b527bc0a20fe4d262c2b7b4b67d6c4db5a2
F ext/fts5/fts5_storage.c 8bc9e5b6654e1545e9513def277ef3f025921664
F ext/fts5/fts5_tcl.c 1293fac2bb26903fd3d5cdee59c5885ba7e620d5
F ext/fts5/fts5_tokenize.c 7c61d5c35c3449597bdeaa54dd48afe26852c7b0
@ -144,7 +144,7 @@ F ext/fts5/test/fts5rebuild.test 2a5e98205393487b4a732c8290999af7c0b907b4
F ext/fts5/test/fts5tokenizer.test b34ae592db66f6e89546d791ce1f905ba0b3395c
F ext/fts5/test/fts5unicode.test 79b3e34eb29ce4929628aa514a40cb467fdabe4d
F ext/fts5/test/fts5unicode2.test 64a5267fd6082fcb46439892ebd0cbaa5c38acee
F ext/fts5/tool/loadfts5.tcl 55c1f3ebf3f4b4f54be5bbdc823e36d59fc5e2dd
F ext/fts5/tool/loadfts5.tcl 17c9771fb225b6b7ddd02a698fc7f320eadd7b15
F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
F ext/icu/icu.c d415ccf984defeb9df2c0e1afcfaa2f6dc05eacb
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
@ -1277,7 +1277,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P af8d43a4a08528bbae25ee38fe25de8a86f8a21c
R bbc2aaea254f25294ae3538c1336787c
P 96ea600440de05ee663e71c3f0d0de2c64108bf9
R 026d50b0e36062cf8629af1a1c3f509d
U dan
Z 3ca0ddccabcad41dd9682a0c32f2940d
Z 986e1351ec9614d6453e829ee3d25fd7

View File

@ -1 +1 @@
96ea600440de05ee663e71c3f0d0de2c64108bf9
f30afd209aa4ce42766b1493750c4f5b5f1e9502