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