OLD | NEW |
| (Empty) |
1 # 2015 Apr 24 | |
2 # | |
3 # The author disclaims copyright to this source code. In place of | |
4 # a legal notice, here is a blessing: | |
5 # | |
6 # May you do good and not evil. | |
7 # May you find forgiveness for yourself and forgive others. | |
8 # May you share freely, never taking more than you give. | |
9 # | |
10 #*********************************************************************** | |
11 # | |
12 # The tests in this file focus on testing that unrecognized file-format | |
13 # versions are detected and reported. | |
14 # | |
15 | |
16 source [file join [file dirname [info script]] fts5_common.tcl] | |
17 set testprefix fts5version | |
18 | |
19 # If SQLITE_ENABLE_FTS5 is defined, omit this file. | |
20 ifcapable !fts5 { | |
21 finish_test | |
22 return | |
23 } | |
24 | |
25 | |
26 do_execsql_test 1.1 { | |
27 CREATE VIRTUAL TABLE t1 USING fts5(one); | |
28 INSERT INTO t1 VALUES('a b c d'); | |
29 } {} | |
30 | |
31 do_execsql_test 1.2 { | |
32 SELECT * FROM t1_config WHERE k='version' | |
33 } {version 4} | |
34 | |
35 do_execsql_test 1.3 { | |
36 SELECT rowid FROM t1 WHERE t1 MATCH 'a'; | |
37 } {1} | |
38 | |
39 do_execsql_test 1.4 { | |
40 UPDATE t1_config set v=5 WHERE k='version'; | |
41 } | |
42 | |
43 do_test 1.5 { | |
44 db close | |
45 sqlite3 db test.db | |
46 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'a' } | |
47 } {1 {invalid fts5 file format (found 5, expected 4) - run 'rebuild'}} | |
48 | |
49 do_test 1.6 { | |
50 db close | |
51 sqlite3 db test.db | |
52 catchsql { INSERT INTO t1 VALUES('x y z') } | |
53 } {1 {invalid fts5 file format (found 5, expected 4) - run 'rebuild'}} | |
54 | |
55 do_test 1.7 { | |
56 execsql { DELETE FROM t1_config WHERE k='version' } | |
57 db close | |
58 sqlite3 db test.db | |
59 catchsql { SELECT * FROM t1 WHERE t1 MATCH 'a' } | |
60 } {1 {invalid fts5 file format (found 0, expected 4) - run 'rebuild'}} | |
61 | |
62 | |
63 finish_test | |
64 | |
OLD | NEW |