Enhance the command-line completion extension to return the names of
[sqlite.git] / test / lock7.test
blob02f2c6c6305079d7f1e5dcc17a7c4e4a1ce108f4
1 # 2009 August 17
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 #***********************************************************************
12 # Check that reading the database schema from within an active transaction
13 # does not establish a SHARED lock on the database file if one is not
14 # already held (or, more accurately, that the SHARED lock is released after
15 # reading the database schema).
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 do_test lock7-1.1 {
22   execsql { CREATE TABLE t1(a, b) }
23   db close
25   sqlite3 db1 test.db
26   sqlite3 db2 test.db
28   db1 eval {BEGIN}
29   db2 eval {BEGIN}
30 } {}
32 do_test lock7-1.2 {
33   execsql { PRAGMA lock_status } db1
34 } {main unlocked temp closed}
35 do_test lock7-1.3 {
36   execsql { PRAGMA lock_status } db2
37 } {main unlocked temp closed}
39 do_test lock7-1.4 {
40   catchsql { INSERT INTO t1 VALUES(1, 1) } db1
41 } {0 {}}
42 do_test lock7-1.5 {
43   catchsql { INSERT INTO t1 VALUES(2, 2) } db2
44 } {1 {database is locked}}
46 do_test lock7-1.6 {
47   execsql { PRAGMA lock_status } db1
48 } {main reserved temp closed}
49 do_test lock7-1.7 {
50   execsql { PRAGMA lock_status } db2
51 } {main unlocked temp closed}
53 do_test lock7-1.8 {
54   execsql { COMMIT } db1
55 } {}
57 db1 close
58 db2 close
60 finish_test