interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / rbu / rbuA.test

80 lines · 1752 bytes Raw Blame History
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# This file contains tests for the RBU module. More specifically, it
13# contains tests to ensure that it is an error to attempt to update
14# a wal mode database via RBU.
15#
16
17source [file join [file dirname [info script]] rbu_common.tcl]
18if_no_rbu_support { finish_test ; return }
19set ::testprefix rbuA
20
21set db_sql {
22 CREATE TABLE t1(a PRIMARY KEY, b, c);
23}
24set rbu_sql {
25 CREATE TABLE data_t1(a, b, c, rbu_control);
26 INSERT INTO data_t1 VALUES(1, 2, 3, 0);
27 INSERT INTO data_t1 VALUES(4, 5, 6, 0);
28 INSERT INTO data_t1 VALUES(7, 8, 9, 0);
29}
30
31do_test 1.0 {
32 db close
33 forcedelete test.db rbu.db
34
35 sqlite3 db test.db
36 db eval $db_sql
37 db eval { PRAGMA journal_mode = wal }
38 db close
39
40 sqlite3 db rbu.db
41 db eval $rbu_sql
42 db close
43
44 sqlite3rbu rbu test.db rbu.db
45 rbu step
46} {SQLITE_ERROR}
47do_test 1.1 {
48 list [catch { rbu close } msg] $msg
49} {1 {SQLITE_ERROR - cannot update wal mode database}}
50
51do_test 2.0 {
52 forcedelete test.db rbu.db
53
54 sqlite3 db test.db
55 db eval $db_sql
56 db close
57
58 sqlite3 db rbu.db
59 db eval $rbu_sql
60 db close
61
62 sqlite3rbu rbu test.db rbu.db
63 rbu step
64 rbu close
65} {SQLITE_OK}
66
67do_test 2.1 {
68 sqlite3 db test.db
69 db eval {PRAGMA journal_mode = wal}
70 db close
71 sqlite3rbu rbu test.db rbu.db
72 rbu step
73} {SQLITE_ERROR}
74
75do_test 2.2 {
76 list [catch { rbu close } msg] $msg
77} {1 {SQLITE_ERROR - cannot update wal mode database}}
78
79
80finish_test