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 #***********************************************************************
13 source [file join [file dirname [info script]] recover_common.tcl]
14 set testprefix recoverfault2
17 #--------------------------------------------------------------------------
18 proc compare_result {db1 db2 sql} {
19 set r1 [$db1 eval $sql]
20 set r2 [$db2 eval $sql]
24 error "mismatch for $sql"
29 proc compare_dbs {db1 db2} {
30 compare_result $db1 $db2 "SELECT sql FROM sqlite_master ORDER BY 1"
31 foreach tbl [$db1 eval {SELECT name FROM sqlite_master WHERE type='table'}] {
32 compare_result $db1 $db2 "SELECT * FROM $tbl"
35 #--------------------------------------------------------------------------
38 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
39 INSERT INTO t1 VALUES(2, '\012hello\015world\012today\n');
41 faultsim_save_and_close
43 proc my_sql_hook {sql} {
48 do_faultsim_test 1 -faults oom* -prep {
50 faultsim_restore_and_reopen
53 set R [sqlite3_recover_init_sql db main my_sql_hook]
57 faultsim_test_result {0 {}} {1 {}}
60 db2 eval [join $::lSql ";"]
69 PRAGMA encoding='utf-16';
70 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
71 INSERT INTO t1 VALUES(2, '\012hello\015world\012today\n');
73 faultsim_save_and_close
75 proc my_sql_hook {sql} {
80 do_faultsim_test 2 -faults oom-t* -prep {
82 faultsim_restore_and_reopen
85 set R [sqlite3_recover_init_sql db main my_sql_hook]
89 faultsim_test_result {0 {}} {1 {}}
92 db2 eval [join $::lSql ";"]