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 }
33 forcedelete test.db test.db-wal
40 PRAGMA journal_mode = wal;
41 CREATE TABLE t1(a, b);
42 INSERT INTO t1 VALUES(1, 2);
46 do_catchsql_test 1.1 {
47 PRAGMA page_size = 4096;
53 forcedelete test.db test.db-wal
60 CREATE TABLE t1(a, b);
61 INSERT INTO t1 VALUES(1, 2);
62 PRAGMA journal_mode = wal;
66 do_catchsql_test 2.1 {
67 PRAGMA page_size = 4096;
73 forcedelete test.db test.db-wal
80 PRAGMA journal_mode = wal;
81 CREATE TABLE t1(a, b);
82 INSERT INTO t1 VALUES(1, 2);
87 PRAGMA page_size = 4096;
88 SELECT name FROM sqlite_master;