3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #*************************************************************************
14 set testdir [file dirname $argv0]
15 source $testdir/tester.tcl
16 source $testdir/fts3_common.tcl
17 set testprefix fts3corrupt5
19 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
25 sqlite3_fts3_may_be_corrupt 1
29 CREATE VIRTUAL TABLE ft USING fts3(a, b, c);
30 INSERT INTO ft VALUES('one', 'one', 'one');
35 SELECT * FROM ft WHERE ft MATCH 'b:one'
39 SELECT quote(root) FROM ft_segdir;
40 } {X'00036F6E6509010201010201020200'}
43 foreach {tn val q bCorrupt} {
44 1 X'00036F6E650901' 'b:one' 1
45 2 X'00036F6E6509010201010201FFFFFF' 'c:one' 1
46 3 X'00036F6E6501' 'b:one' 1
47 4 X'00036F6E650101' 'b:one' 1
48 5 X'00036F6E650100' 'b:one' 0
50 do_execsql_test 1.3.$tn.1 "UPDATE ft_segdir SET root = $val"
53 if {$bCorrupt} { set res {1 {database disk image is malformed}}}
54 do_catchsql_test 1.3.$tn.2 {
55 SELECT * FROM ft WHERE ft MATCH $q