CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
fts3corrupt5.test60 linesDownload Raw Back to test
1# 2019 May 222#3# The author disclaims copyright to this source code.  In place of4# 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#13 14set testdir [file dirname $argv0]15source $testdir/tester.tcl16source $testdir/fts3_common.tcl17set testprefix fts3corrupt518 19# If SQLITE_ENABLE_FTS3 is defined, omit this file.20ifcapable !fts3 {21  finish_test22  return23}24 25sqlite3_fts3_may_be_corrupt 126 27do_execsql_test 1.0 {28  BEGIN;29    CREATE VIRTUAL TABLE ft USING fts3(a, b, c);30    INSERT INTO ft VALUES('one', 'one', 'one');31  COMMIT;32}33 34do_execsql_test 1.1 {35  SELECT * FROM ft WHERE ft MATCH 'b:one'36} {one one one}37 38do_execsql_test 1.2 {39  SELECT quote(root) FROM ft_segdir;40} {X'00036F6E6509010201010201020200'}41 42breakpoint43foreach {tn val q bCorrupt} {44  1 X'00036F6E650901'                   'b:one'  145  2 X'00036F6E6509010201010201FFFFFF'   'c:one'  146  3 X'00036F6E6501'                     'b:one'  147  4 X'00036F6E650101'                   'b:one'  148  5 X'00036F6E650100'                   'b:one'  049} {50  do_execsql_test 1.3.$tn.1 "UPDATE ft_segdir SET root = $val"51 52  set res {0 {}}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 $q56  } $res57}58 59finish_test60