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]
16 sqlite3_test_control_pending_byte 0x1000000
18 set testprefix recoverpgsz
20 foreach {pgsz bOverflow} {
21 512 0 1024 0 2048 0 4096 0 8192 0 16384 0 32768 0 65536 0
22 512 1 1024 1 2048 1 4096 1 8192 1 16384 1 32768 1 65536 1
25 execsql "PRAGMA page_size = $pgsz"
26 execsql "PRAGMA auto_vacuum = 0"
27 do_execsql_test 1.$pgsz.$bOverflow.1 {
28 CREATE TABLE t1(a, b, c);
29 CREATE INDEX i1 ON t1(b, a, c);
30 INSERT INTO t1(a, b) VALUES(1, 2), (3, 4), (5, 6);
31 DELETE FROM t1 WHERE a=3;
34 do_execsql_test 1.$pgsz.$bOverflow.1a {
35 UPDATE t1 SET c = randomblob(100000);
42 fconfigure $fd -encoding binary -translation binary
44 set pg1 [read $fd $pgsz]
45 set pg2 [read $fd $pgsz]
48 set fd2 [open test.db2 w]
49 fconfigure $fd2 -encoding binary -translation binary
51 puts -nonewline $fd2 $pg1
55 do_test 1.$pgsz.$bOverflow.2 {
56 set R [sqlite3_recover_init db2 main test.db3]
62 do_test 1.$pgsz.$bOverflow.3 {
63 db3 eval { SELECT * FROM sqlite_schema }
64 db3 eval { PRAGMA page_size }
73 set fd2 [open test.db2 w]
74 fconfigure $fd2 -encoding binary -translation binary
76 puts -nonewline $fd2 $pg2
80 do_test 1.$pgsz.$bOverflow.4 {
81 set R [sqlite3_recover_init db2 main test.db3]
87 do_test 1.$pgsz.$bOverflow.5 {
88 db3 eval { SELECT * FROM sqlite_schema }
89 db3 eval { PRAGMA page_size }