3 # The author disclaims copyright to this source code.
5 #*************************************************************************
6 # This file implements regression tests for SQLite library. These
7 # make sure that fts3 insertion buffering is fully transparent when
10 # $Id: fts3ak.test,v 1.1 2007/08/20 17:38:42 shess Exp $
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
16 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
23 CREATE VIRTUAL TABLE t1 USING fts3(content);
24 INSERT INTO t1 (rowid, content) VALUES(1, 'hello world');
25 INSERT INTO t1 (rowid, content) VALUES(2, 'hello there');
26 INSERT INTO t1 (rowid, content) VALUES(3, 'cruel world');
29 # Test that possibly-buffered inserts went through after commit.
33 INSERT INTO t1 (rowid, content) VALUES(4, 'false world');
34 INSERT INTO t1 (rowid, content) VALUES(5, 'false door');
36 SELECT rowid FROM t1 WHERE t1 MATCH 'world';
40 # Test that buffered inserts are seen by selects in the same
45 INSERT INTO t1 (rowid, content) VALUES(6, 'another world');
46 INSERT INTO t1 (rowid, content) VALUES(7, 'another test');
47 SELECT rowid FROM t1 WHERE t1 MATCH 'world';
52 # Test that buffered inserts are seen within a transaction. This is
53 # really the same test as 1.2.
57 INSERT INTO t1 (rowid, content) VALUES(8, 'second world');
58 INSERT INTO t1 (rowid, content) VALUES(9, 'second sight');
59 SELECT rowid FROM t1 WHERE t1 MATCH 'world';
64 # Double-check that the previous result doesn't persist past the
68 SELECT rowid FROM t1 WHERE t1 MATCH 'world';
72 # Test it all together.
76 INSERT INTO t1 (rowid, content) VALUES(10, 'second world');
77 INSERT INTO t1 (rowid, content) VALUES(11, 'second sight');
79 SELECT rowid FROM t1 WHERE t1 MATCH 'world';
83 # Test that the obvious case works.
87 INSERT INTO t1 (rowid, content) VALUES(12, 'third world');
89 SELECT rowid FROM t1 WHERE t1 MATCH 'third';
93 # This is exactly the same as the previous test, except that older
94 # code loses the INSERT due to an SQLITE_SCHEMA error.
98 INSERT INTO t1 (rowid, content) VALUES(13, 'third dimension');
101 SELECT rowid FROM t1 WHERE t1 MATCH 'dimension';