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.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 source $testdir/lock_common.tcl
19 source $testdir/wal_common.tcl
20 source $testdir/malloc_common.tcl
21 ifcapable !wal {finish_test ; return }
23 #-------------------------------------------------------------------------
24 # Changing to WAL mode in one connection forces the change in others.
29 set all_journal_modes {delete persist truncate memory off}
30 foreach jmode $all_journal_modes {
32 do_test wal6-1.0.$jmode {
34 execsql "PRAGMA journal_mode = $jmode;"
37 do_test wal6-1.1.$jmode {
39 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
40 INSERT INTO t1 VALUES(1,2);
45 # Under Windows, you'll get an error trying to delete
46 # a file this is already opened. For now, make sure
47 # we get that error, then close the first connection
48 # so the other tests work.
49 if {$tcl_platform(platform)=="windows"} {
50 if {$jmode=="persist" || $jmode=="truncate"} {
51 do_test wal6-1.2.$jmode.win {
54 PRAGMA journal_mode=WAL;
56 } {1 {disk I/O error}}
62 do_test wal6-1.2.$jmode {
65 PRAGMA journal_mode=WAL;
66 INSERT INTO t1 VALUES(3,4);
67 SELECT * FROM t1 ORDER BY a;
71 if {$tcl_platform(platform)=="windows"} {
72 if {$jmode=="persist" || $jmode=="truncate"} {
77 do_test wal6-1.3.$jmode {
79 SELECT * FROM t1 ORDER BY a;