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 / rbupass.test

81 lines · 1589 bytes Raw Blame History
1# 2023 January 13
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
13source [file join [file dirname [info script]] rbu_common.tcl]
14if_no_rbu_support { finish_test ; return }
15set ::testprefix rbupass
16
17if {[info commands register_demovfs]==""} {
18 finish_test
19 return
20}
21
22db close
23
24register_demovfs
25sqlite3rbu_create_vfs myvfs demo
26
27sqlite3 db file:test.db?vfs=myvfs -uri 1
28do_execsql_test 1.0 {
29 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
30 INSERT INTO t1 VALUES(1, 2);
31 SELECT * FROM t1;
32} {1 2}
33
34if {[permutation]!="inmemory_journal"} {
35 do_execsql_test 1.1 {
36 PRAGMA journal_mode = wal;
37 } {delete}
38}
39
40do_execsql_test 1.2 {
41 SELECT * FROM t1;
42} {1 2}
43
44do_test 1.3 {
45 forcedelete rbu.db
46 sqlite3 rbu rbu.db
47 rbu eval {
48 CREATE TABLE data_t1(a, b, rbu_control);
49 INSERT INTO data_t1 VALUES(2, 4, 0);
50 }
51 rbu close
52} {}
53
54do_test 1.4 {
55 sqlite3rbu rbu test.db rbu.db
56} {rbu}
57do_test 1.5 {
58 rbu step
59} {SQLITE_CANTOPEN}
60do_test 1.6 {
61 list [catch { rbu close } msg] $msg
62} {1 {SQLITE_CANTOPEN - unable to open database file}}
63
64do_test 1.7 {
65 sqlite3rbu_vacuum rbu test.db
66} {rbu}
67do_test 1.8 {
68 rbu step
69 catch { rbu close }
70} {1}
71
72do_execsql_test 1.9 {
73 SELECT * FROM t1;
74} {1 2}
75
76db close
77sqlite3rbu_destroy_vfs myvfs
78unregister_demovfs
79sqlite3_shutdown
80finish_test
81