Snapshot of upstream SQLite 3.43.2
[sqlcipher.git] / ext / rbu / rbudor.test
blobc456d6ab71eb613a7a8a09c068d20ba64b4d3b39
1 # 2016 October 21
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 #***********************************************************************
12 # This test file focuses on interactions between RBU and the feature
13 # enabled by SQLITE_DIRECT_OVERFLOW_READ - Direct Overflow Read.
16 source [file join [file dirname [info script]] rbu_common.tcl]
17 if_no_rbu_support { finish_test ; return }
18 set ::testprefix rbudor
20 set bigA [string repeat a 5000]
21 set bigB [string repeat b 5000]
22 do_execsql_test 1.0 {
23   PRAGMA page_size = 1024;
24   CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB);
25   INSERT INTO t1 VALUES(1, $bigA);
26 } {}
28 do_test 1.1 {
29   forcedelete rbu.db
30   sqlite3 rbu rbu.db 
31   rbu eval {
32     CREATE TABLE data_t1(a, b, rbu_control);
33     INSERT INTO data_t1 VALUES(2, $bigB, 0);
34   }
35   rbu close
36 } {}
38 do_test 1.2 {
39   sqlite3rbu rbu test.db rbu.db
40   while {[rbu state]!="checkpoint"} {
41     rbu step
42   }
43   rbu step
44   db eval { SELECT * FROM t1 }
45 } [list 1 $bigA 2 $bigB]
47 do_test 1.3 {
48   while {[rbu step]=="SQLITE_OK"} {}
49   rbu close
50 } {SQLITE_DONE}
52 do_execsql_test 1.4 {
53   SELECT * FROM t1 
54 } [list 1 $bigA 2 $bigB]
56 finish_test