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 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the operation of the library in
13 # "PRAGMA journal_mode=WAL" mode.
15 # Specifically, it tests the case where a connection opens an empty
16 # file. Then, another connection opens the same file and initializes
17 # the connection as a WAL database. Following this, the first connection
18 # executes a "PRAGMA page_size = XXX" command to set its expected page
19 # size, and then queries the database.
21 # This is an unusual case, as normally SQLite is able to glean the page
22 # size from the database file as soon as it is opened (even before the
23 # first read transaction is executed), and the "PRAGMA page_size = XXX"
26 set testdir [file dirname $argv0]
27 source $testdir/tester.tcl
29 ifcapable !wal {finish_test ; return }
32 forcedelete test.db test.db-wal
39 PRAGMA journal_mode = wal;
40 CREATE TABLE t1(a, b);
41 INSERT INTO t1 VALUES(1, 2);
45 do_catchsql_test 1.1 {
46 PRAGMA page_size = 4096;
52 forcedelete test.db test.db-wal
59 CREATE TABLE t1(a, b);
60 INSERT INTO t1 VALUES(1, 2);
61 PRAGMA journal_mode = wal;
65 do_catchsql_test 2.1 {
66 PRAGMA page_size = 4096;
72 forcedelete test.db test.db-wal
79 PRAGMA journal_mode = wal;
80 CREATE TABLE t1(a, b);
81 INSERT INTO t1 VALUES(1, 2);
86 PRAGMA page_size = 4096;
87 SELECT name FROM sqlite_master;