4 # The author disclaims copyright to this source code. In place of
5 # a legal notice, here is a blessing:
7 # May you do good and not evil.
8 # May you find forgiveness for yourself and forgive others.
9 # May you share freely, never taking more than you give.
11 #***********************************************************************
12 # This file implements regression tests for SQLite library. The
13 # focus of this file is testing locks on read-only WAL-mode databases.
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 source $testdir/lock_common.tcl
18 set testprefix rowallock
25 do_multiclient_test tn {
29 do_execsql_test 1.$tn.1 {
30 PRAGMA page_size = 4096;
31 CREATE TABLE t1(a, b);
32 CREATE TABLE t2(a, b);
33 INSERT INTO t1 VALUES(1, 2), (3, 4);
34 PRAGMA journal_mode = wal;
39 sqlite3 db test.db -readonly 1
42 do_execsql_test 1.$tn.2 {
43 PRAGMA mmap_size = 1000000;
45 do_execsql_test 1.$tn.2.1 {
49 do_catchsql_test 1.$tn.3 {
50 INSERT INTO t1 VALUES(5, 6);
51 } {1 {attempt to write a readonly database}}
54 code2 { sqlite3 db2 test.db }
55 sql2 { INSERT INTO t1 VALUES(5, 6); }
57 file exists test.db-wal
61 sql1 { SELECT * FROM t2 }
63 file exists test.db-wal