1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add test case to demonstrate a "BEGIN EXCLUSIVE" command returning

SQLITE_BUSY_SNAPSHOT.

FossilOrigin-Name: b115856408b6aa5538be67beb619d7aff0630bea
This commit is contained in:
dan
2016-10-25 15:06:11 +00:00
parent 7ad3eb63cf
commit 01e697b4ec
3 changed files with 37 additions and 8 deletions

View File

@ -234,5 +234,34 @@ do_test 4.4.2 {
catchsql { SELECT * FROM t2 } db2
} {1 {database disk image is malformed}}
#-------------------------------------------------------------------------
# Confirm that it is possible to get an SQLITE_BUSY_SNAPSHOT error from
# "BEGIN EXCLUSIVE" if the connection already has an open read-transaction.
#
reset_db
sqlite3 db2 test.db
do_execsql_test 5.1 {
PRAGMA journal_mode = wal;
CREATE TABLE t1(x, y);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
} {wal}
do_test 5.2 {
set res [list]
db eval {
SELECT * FROM t1
} {
if {$x==1} {
db2 eval { INSERT INTO t1 VALUES(5, 6) }
}
if {$x==3} {
set res [catchsql {BEGIN EXCLUSIVE}]
lappend res [sqlite3_extended_errcode db]
}
}
set res
} {1 {database is locked} SQLITE_BUSY_SNAPSHOT}
finish_test