diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:28:19 +0000 |
commit | 18657a960e125336f704ea058e25c27bd3900dcb (patch) | |
tree | 17b438b680ed45a996d7b59951e6aa34023783f2 /test/lock7.test | |
parent | Initial commit. (diff) | |
download | sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.tar.xz sqlite3-18657a960e125336f704ea058e25c27bd3900dcb.zip |
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/lock7.test | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/lock7.test b/test/lock7.test new file mode 100644 index 0000000..02f2c6c --- /dev/null +++ b/test/lock7.test @@ -0,0 +1,60 @@ +# 2009 August 17 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Check that reading the database schema from within an active transaction +# does not establish a SHARED lock on the database file if one is not +# already held (or, more accurately, that the SHARED lock is released after +# reading the database schema). +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test lock7-1.1 { + execsql { CREATE TABLE t1(a, b) } + db close + + sqlite3 db1 test.db + sqlite3 db2 test.db + + db1 eval {BEGIN} + db2 eval {BEGIN} +} {} + +do_test lock7-1.2 { + execsql { PRAGMA lock_status } db1 +} {main unlocked temp closed} +do_test lock7-1.3 { + execsql { PRAGMA lock_status } db2 +} {main unlocked temp closed} + +do_test lock7-1.4 { + catchsql { INSERT INTO t1 VALUES(1, 1) } db1 +} {0 {}} +do_test lock7-1.5 { + catchsql { INSERT INTO t1 VALUES(2, 2) } db2 +} {1 {database is locked}} + +do_test lock7-1.6 { + execsql { PRAGMA lock_status } db1 +} {main reserved temp closed} +do_test lock7-1.7 { + execsql { PRAGMA lock_status } db2 +} {main unlocked temp closed} + +do_test lock7-1.8 { + execsql { COMMIT } db1 +} {} + +db1 close +db2 close + +finish_test |