1# 2014-01-20 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 13set testdir [file dirname $argv0] 14source $testdir/tester.tcl 15set testprefix corruptI 16 17if {[permutation]=="mmap"} { 18 finish_test 19 return 20} 21 22# Do not use a codec for tests in this file, as the database file is 23# manipulated directly using tcl scripts (using the [hexio_write] command). 24# 25do_not_use_codec 26database_may_be_corrupt 27 28# Initialize the database. 29# 30do_execsql_test 1.1 { 31 PRAGMA page_size=1024; 32 PRAGMA auto_vacuum=0; 33 CREATE TABLE t1(a); 34 CREATE INDEX i1 ON t1(a); 35 INSERT INTO t1 VALUES('a'); 36} {} 37db close 38 39do_test 1.2 { 40 set offset [hexio_get_int [hexio_read test.db [expr 2*1024 + 8] 2]] 41 set off [expr 2*1024 + $offset + 1] 42 hexio_write test.db $off FF06 43 sqlite3 db test.db 44 catchsql { SELECT * FROM t1 WHERE a = 10 } 45} {0 {}} 46 47 48finish_test 49