xref: /sqlite-3.40.0/ext/rbu/rbuB.test (revision 6ab91a7a)
1# 2014 August 30
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#
13
14source [file join [file dirname [info script]] rbu_common.tcl]
15set ::testprefix rbuB
16
17db close
18sqlite3_shutdown
19test_sqlite3_log xLog
20reset_db
21
22proc xLog {args} { }
23
24set db_sql {
25  CREATE TABLE t1(a PRIMARY KEY, b, c);
26}
27set rbu_sql {
28  CREATE TABLE data_t1(a, b, c, rbu_control);
29  INSERT INTO data_t1 VALUES(1, 2, 3, 0);
30  INSERT INTO data_t1 VALUES(4, 5, 6, 0);
31  INSERT INTO data_t1 VALUES(7, 8, 9, 0);
32}
33
34do_test 1.1 {
35  forcedelete rbu.db
36  sqlite3 rbu rbu.db
37  rbu eval $rbu_sql
38  rbu close
39
40  db eval $db_sql
41} {}
42
43set ::errlog [list]
44proc xLog {err msg} { lappend ::errlog $err }
45do_test 1.2 {
46  run_rbu test.db rbu.db
47} {SQLITE_DONE}
48
49do_test 1.3 {
50  set ::errlog
51} {SQLITE_NOTICE_RECOVER_WAL SQLITE_INTERNAL}
52
53do_execsql_test 1.4 {
54  SELECT * FROM t1
55} {1 2 3 4 5 6 7 8 9}
56
57db close
58sqlite3_shutdown
59test_sqlite3_log
60sqlite3_initialize
61finish_test
62