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.
13 # This file tests the "query_only" pragma.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 do_execsql_test queryonly-1.1 {
21 INSERT INTO t1 VALUES(123),(456);
22 SELECT a FROM t1 ORDER BY a;
24 do_execsql_test queryonly-1.2 {
27 do_execsql_test queryonly-1.3 {
31 do_test queryonly-1.4 {
32 catchsql {INSERT INTO t1 VALUES(789);}
33 } {1 {attempt to write a readonly database}}
34 do_test queryonly-1.5 {
35 catchsql {DELETE FROM t1;}
36 } {1 {attempt to write a readonly database}}
37 do_test queryonly-1.6 {
38 catchsql {UPDATE t1 SET a=a+1;}
39 } {1 {attempt to write a readonly database}}
40 do_test queryonly-1.7 {
41 catchsql {CREATE TABLE t2(b);}
42 } {1 {attempt to write a readonly database}}
43 do_test queryonly-1.8 {
44 catchsql {CREATE INDEX t1a ON t1(a);}
45 } {1 {attempt to write a readonly database}}
46 do_test queryonly-1.9 {
47 catchsql {DROP TABLE t1;}
48 } {1 {attempt to write a readonly database}}
49 do_test queryonly-1.10 {
51 } {1 {attempt to write a readonly database}}
52 do_execsql_test queryonly-1.11 {
53 SELECT a FROM t1 ORDER BY a;
56 do_execsql_test queryonly-2.2 {
59 do_execsql_test queryonly-2.3 {
60 PRAGMA query_only=OFF;
63 do_execsql_test queryonly-2.4 {
64 INSERT INTO t1 VALUES(789);
65 SELECT a FROM t1 ORDER BY a;
67 do_execsql_test queryonly-2.5 {
69 SELECT a FROM t1 ORDER BY a;