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:
@ -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
|
||||
|
Reference in New Issue
Block a user