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

Add an English language error message to corresponding to SQLITE_PROTOCOL. "locking protocol".

FossilOrigin-Name: ca327e32cfe1633f2c9d3f058e411f108aaa2b3c
This commit is contained in:
dan
2010-06-04 15:59:58 +00:00
parent 23dced35ea
commit 0dc7b74fbe
4 changed files with 55 additions and 9 deletions

View File

@ -258,6 +258,52 @@ foreach {tn syncmode synccount} {
T delete
}
#-------------------------------------------------------------------------
# When recovering the contents of a WAL file, a process obtains the WRITER
# lock, then locks all other bytes before commencing recovery. If it fails
# to lock all other bytes (because some other process is holding a read
# lock) it should return SQLITE_BUSY to the caller. Test this.
#
proc lock_callback {method filename handle lock} {
lappend ::locks $lock
}
do_test wal3-4.1 {
testvfs T
T filter xShmLock
T script lock_callback
set ::locks [list]
sqlite3 db test.db -vfs T
execsql { SELECT * FROM x }
lrange $::locks 0 3
} [list {0 1 lock exclusive} {1 7 lock exclusive} \
{1 7 unlock exclusive} {0 1 unlock exclusive} \
]
do_test wal3-4.2 {
db close
set ::locks [list]
sqlite3 db test.db -vfs T
execsql { SELECT * FROM x }
lrange $::locks 0 3
} [list {0 1 lock exclusive} {1 7 lock exclusive} \
{1 7 unlock exclusive} {0 1 unlock exclusive} \
]
proc lock_callback {method filename handle lock} {
if {$lock == "1 7 lock exclusive"} { return SQLITE_BUSY }
return SQLITE_OK
}
puts " Warning: This next test case causes SQLite to call xSleep(1) 100 times."
puts " Normally this equates to a 100ms delay, but if SQLite is built on unix"
puts " without HAVE_USLEEP defined, it may be 100 seconds."
do_test wal3-4.3 {
db close
set ::locks [list]
sqlite3 db test.db -vfs T
catchsql { SELECT * FROM x }
} {1 {locking protocol}}
db close
T delete
finish_test