mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
If the database is locked when sqlite_open() is called, sqlite_exec() should
still honor the busy callback and should return an error message together with the SQLITE_BUSY result code. (CVS 733) FossilOrigin-Name: 78a0229a7e5e33fe642847381f5514e6ec30f29f
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is database locks.
|
||||
#
|
||||
# $Id: lock.test,v 1.16 2002/08/18 20:28:07 drh Exp $
|
||||
# $Id: lock.test,v 1.17 2002/08/29 23:59:50 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -244,6 +244,34 @@ do_test lock-3.1 {
|
||||
} {1 {cannot start a transaction within a transaction}}
|
||||
integrity_check lock-3.2
|
||||
|
||||
# Make sure the busy handler and error messages work when
|
||||
# opening a new pointer to the database while another pointer
|
||||
# has the database locked.
|
||||
#
|
||||
do_test lock-4.1 {
|
||||
db2 close
|
||||
catch {db eval ROLLBACK}
|
||||
db eval BEGIN
|
||||
sqlite db2 ./test.db
|
||||
set rc [catch {db2 eval {SELECT * FROM t1}} msg]
|
||||
lappend rc $msg
|
||||
} {1 {database is locked}}
|
||||
do_test lock-4.2 {
|
||||
set ::callback_value {}
|
||||
set rc [catch {db2 eval {SELECT * FROM t1}} msg]
|
||||
lappend rc $msg $::callback_value
|
||||
} {1 {database is locked} {}}
|
||||
do_test lock-4.3 {
|
||||
proc callback {file count} {
|
||||
lappend ::callback_value $count
|
||||
if {$count>4} break
|
||||
}
|
||||
db2 busy callback
|
||||
set rc [catch {db2 eval {SELECT * FROM t1}} msg]
|
||||
lappend rc $msg $::callback_value
|
||||
} {1 {database is locked} {1 2 3 4 5}}
|
||||
|
||||
|
||||
do_test lock-999.1 {
|
||||
rename db2 {}
|
||||
} {}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing the ability of the library to detect
|
||||
# past or future file format version numbers and respond appropriately.
|
||||
#
|
||||
# $Id: version.test,v 1.6 2002/08/13 23:02:59 drh Exp $
|
||||
# $Id: version.test,v 1.7 2002/08/29 23:59:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -189,7 +189,7 @@ do_test version-2.2 {
|
||||
close $fd
|
||||
set rc [catch {sqlite db test.db} msg]
|
||||
lappend rc $msg
|
||||
} {1 {}}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user