Debian Codegraph @

ext/rbu/rbudor.test

raw
1 # 2016 October 21
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 # This test file focuses on interactions between RBU and the feature
13 # enabled by SQLITE_DIRECT_OVERFLOW_READ - Direct Overflow Read.
14 #
15
16 source [file join [file dirname [info script]] rbu_common.tcl]
17 if_no_rbu_support { finish_test ; return }
18 set ::testprefix rbudor
19
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 } {}
27
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 } {}
37
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]
46
47 do_test 1.3 {
48 while {[rbu step]=="SQLITE_OK"} {}
49 rbu close
50 } {SQLITE_DONE}
51
52 do_execsql_test 1.4 {
53 SELECT * FROM t1
54 } [list 1 $bigA 2 $bigB]
55
56 finish_test