replace use of sqlite3StrICmp with public sqlite3_stricmp API
[sqlcipher.git] / ext / rbu / rbu8.test
blobc0ccd8c5eb8f6fe0c2be75837fe4783ede9fa53c
1 # 2014 November 20
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 # Test the rbu_delta() feature.
15 if {![info exists testdir]} {
16   set testdir [file join [file dirname [info script]] .. .. test]
18 source $testdir/tester.tcl
19 set ::testprefix rbu8
21 do_execsql_test 1.0 {
22   CREATE TABLE t1(x, y PRIMARY KEY, z);
23   INSERT INTO t1 VALUES(NULL, 1, 'one');
24   INSERT INTO t1 VALUES(NULL, 2, 'two');
25   INSERT INTO t1 VALUES(NULL, 3, 'three');
26   CREATE INDEX i1z ON t1(z, x);
29 do_test 1.1 {
30   forcedelete rbu.db
31   sqlite3 db2 rbu.db
32   db2 eval {
33     CREATE TABLE data_t1(x, y, z, rbu_control);
34     INSERT INTO data_t1 VALUES('a',    1, '_i'      , 'x.d');
35     INSERT INTO data_t1 VALUES('b',    2, 2         , '..x');
36     INSERT INTO data_t1 VALUES('_iii', 3, '-III'    , 'd.d');
37   }
38   db2 close
39 } {}
41 do_test 1.2.1 {
42   sqlite3rbu rbu test.db rbu.db
43   rbu step
44 } {SQLITE_ERROR}
45 do_test 1.2.2 {
46   list [catch {rbu close} msg] $msg
47 } {1 {SQLITE_ERROR - no such function: rbu_delta}}
49 proc rbu_delta {orig new} {
50  return "${orig}${new}"
53 do_test 1.3.1 {
54   while 1 {
55     sqlite3rbu rbu test.db rbu.db
56     rbu create_rbu_delta
57     set rc [rbu step]
58     if {$rc != "SQLITE_OK"} break
59     rbu close
60   }
61   rbu close
62 } {SQLITE_DONE}
64 do_execsql_test 1.3.2 {
65   SELECT * FROM t1
66 } {
67   a    1 one_i
68   {}   2 2
69   _iii 3 three-III
71 integrity_check 1.3.3
74 finish_test