1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Back out changes allowing writes to tables that have open cursors. (CVS 2134)

FossilOrigin-Name: af635cab8a1d761c469e35208dda08a29f0964a1
This commit is contained in:
danielk1977
2004-11-22 10:02:21 +00:00
parent 299b187d76
commit 12b13002ce
9 changed files with 96 additions and 591 deletions

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.15 2004/11/22 08:43:32 danielk1977 Exp $
# $Id: misc2.test,v 1.16 2004/11/22 10:02:23 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -135,6 +135,57 @@ do_test misc2-6.1 {
}
} {1 2}
# Make sure we get an error message (not a segfault) on an attempt to
# update a table from within the callback of a select on that same
# table.
#
do_test misc2-7.1 {
db close
file delete -force test.db
sqlite3 db test.db
execsql {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
}
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "DELETE FROM t1 WHERE rowid=$rowid"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.2 {
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "INSERT INTO t1 VALUES(3)"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.3 {
db close
file delete -force test.db
sqlite3 db :memory:
execsql {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
}
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "DELETE FROM t1 WHERE rowid=$rowid"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
do_test misc2-7.4 {
set rc [catch {
db eval {SELECT rowid FROM t1} {} {
db eval "INSERT INTO t1 VALUES(3)"
}
} msg]
lappend rc $msg
} {1 {database table is locked}}
# Ticket #453. If the SQL ended with "-", the tokenizer was calling that
# an incomplete token, which caused problem. The solution was to just call
# it a minus sign.