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 with shared-cache turned on.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 ifcapable !wal {finish_test ; return }
22 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
27 do_test walshared-1.0 {
29 PRAGMA cache_size = 10;
30 PRAGMA journal_mode = WAL;
31 CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
32 INSERT INTO t1 VALUES(randomblob(100), randomblob(200));
36 do_test walshared-1.1 {
39 INSERT INTO t1 VALUES(randomblob(100), randomblob(200));
40 INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1;
41 INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1;
42 INSERT INTO t1 SELECT randomblob(100), randomblob(200) FROM t1;
46 do_test walshared-1.2 {
47 catchsql { PRAGMA wal_checkpoint }
48 } {1 {database table is locked}}
50 do_test walshared-1.3 {
51 catchsql { PRAGMA wal_checkpoint } db2
52 } {1 {database table is locked}}
54 do_test walshared-1.4 {
56 execsql { PRAGMA integrity_check } db2
61 sqlite3_enable_shared_cache $::enable_shared_cache