1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix a problem to do with loading the value of the FTS automerge setting from the database.

FossilOrigin-Name: 7268119f74602929b372b88eca7b3c3b4964f7d5
This commit is contained in:
dan
2014-05-14 18:45:27 +00:00
parent 9e83e465eb
commit a0b7ca90b7
6 changed files with 71 additions and 26 deletions

View File

@ -53,6 +53,50 @@ do_execsql_test 2.2 { SELECT count(*) FROM t1_segdir; } 35
do_execsql_test 2.3 { INSERT INTO t1(t1) VALUES('optimize') } {}
do_execsql_test 2.4 { SELECT count(*) FROM t1_segdir; } 1
#-------------------------------------------------------------------------
# Now test that the automerge=? option appears to work.
#
do_execsql_test 2.1 { CREATE VIRTUAL TABLE t2 USING fts4; }
set doc ""
foreach c1 "a b c d e f g h i j" {
foreach c2 "a b c d e f g h i j" {
foreach c3 "a b c d e f g h i j" {
lappend doc "$c1$c2$c3"
}
}
}
set doc [string repeat $doc 10]
foreach {tn am expected} {
1 {automerge=2} {1 1 2 1 4 1 6 1}
2 {automerge=4} {1 2 2 1 3 1}
3 {automerge=8} {0 4 1 3 2 1}
4 {automerge=1} {0 4 1 3 2 1}
} {
foreach {tn2 openclose} {1 {} 2 { db close ; sqlite3 db test.db }} {
do_test 2.2.$tn.$tn2 {
execsql { DELETE FROM t2 }
execsql { INSERT INTO t2(t2) VALUES($am) };
eval $openclose
for {set i 0} {$i < 100} {incr i} {
execsql {
BEGIN;
INSERT INTO t2 VALUES($doc);
INSERT INTO t2 VALUES($doc);
INSERT INTO t2 VALUES($doc);
INSERT INTO t2 VALUES($doc);
INSERT INTO t2 VALUES($doc);
COMMIT;
}
}
execsql { SELECT level, count(*) FROM t2_segdir GROUP BY level }
} [list {*}$expected]
}
}
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test