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]] rbu_common.tcl]
14 if_no_rbu_support { finish_test ; return }
15 set ::testprefix rbusave
18 CREATE TABLE t1(a PRIMARY KEY, b, c) WITHOUT ROWID;
19 CREATE TABLE t2(a INTEGER PRIMARY KEY, b, c);
20 CREATE INDEX i1 ON t1(b);
21 CREATE INDEX i2 ON t2(c, b);
23 INSERT INTO t1 VALUES(1, 1, 1);
24 INSERT INTO t1 VALUES(2, 2, 2);
25 INSERT INTO t1 VALUES(3, 3, 3);
27 INSERT INTO t2 VALUES(1, 1, 1);
28 INSERT INTO t2 VALUES(2, 2, 2);
29 INSERT INTO t2 VALUES(3, 3, 3);
36 CREATE TABLE data_t1(a, b, c, rbu_control);
37 INSERT INTO data_t1 VALUES(4, 4, 4, 0);
38 INSERT INTO data_t1 VALUES(2, NULL, NULL, 1);
39 INSERT INTO data_t1 VALUES(1, 'one', NULL, '.x.');
41 CREATE TABLE data_t2(a, b, c, rbu_control);
42 INSERT INTO data_t2 VALUES(4, 4, 4, 0);
43 INSERT INTO data_t2 VALUES(2, NULL, NULL, 1);
44 INSERT INTO data_t2 VALUES(1, 'one', NULL, '.x.');
50 test.db test.db-wal test.db-oal test.db-journal
51 test.db2 test.db2-wal test.db2-oal test.db2-journal
53 set t [string map {test bak} $f]
55 if {[file exists $f]} { forcecopy $f $t }
61 sqlite3rbu rrr bak.db bak.db2
63 while {[rrr step]=="SQLITE_OK"} {incr nStep}
68 sqlite3rbu rbu test.db test.db2
70 for {set i 1} {$res=="SQLITE_OK"} {incr i} {
76 sqlite3rbu rrr bak.db bak.db2
78 while {[rrr step]=="SQLITE_OK"} {incr nRem}
82 do_test 1.3.$i.3 { expr $nRem+$i } [expr {$nStep + ($res=="SQLITE_DONE")}]
90 } {1 one 1 3 3 3 4 4 4 1 one 1 3 3 3 4 4 4}
95 do_test 1.4 { rbu close } {SQLITE_DONE}
100 } {1 one 1 3 3 3 4 4 4 1 one 1 3 3 3 4 4 4}