1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add locks to the in-memory backend so that recursive writes will be detected

and rejected.  Ticket #436. (CVS 1089)

FossilOrigin-Name: 3403d28a49b27d3059d3d399ca057e8d33eb857a
This commit is contained in:
drh
2003-08-27 22:54:31 +00:00
parent 0d4f801c28
commit e4c616931d
3 changed files with 59 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
C Add\slocks\sto\sthe\sin-memory\sdatabase\sso\sthat\srecursive\swrites\swill\sbe\sdetected\nand\srejected.\s\sTicket\s#436.\s(CVS\s1090) C Add\slocks\sto\sthe\sin-memory\sbackend\sso\sthat\srecursive\swrites\swill\sbe\sdetected\nand\srejected.\s\sTicket\s#436.\s(CVS\s1089)
D 2003-08-27T22:52:34 D 2003-08-27T22:54:32
F Makefile.in f7e916ae863393827fa6a4cb292e3398096edcf1 F Makefile.in f7e916ae863393827fa6a4cb292e3398096edcf1
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -97,7 +97,7 @@ F test/memdb.test 6ece25c7c0e6500199d3662607a3edca081abb2a
F test/memleak.test a18e6810cae96d2f6f5136920267adbefc8e1e90 F test/memleak.test a18e6810cae96d2f6f5136920267adbefc8e1e90
F test/minmax.test 6d9b6d6ee34f42e2a58dffece1f76d35f446b3af F test/minmax.test 6d9b6d6ee34f42e2a58dffece1f76d35f446b3af
F test/misc1.test 0b98d493b0cf55cb5f53e1f3df8107c166eecb5a F test/misc1.test 0b98d493b0cf55cb5f53e1f3df8107c166eecb5a
F test/misc2.test 48f1f2187831a89dc4785f493c0c320b3be61a32 F test/misc2.test d7bc75fae9157c4a3f4914b505713f398b3c5422
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162 F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
@@ -168,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
P c95f347cac27732533a2f6fd4ba50bf00eef59f3 P 966b1a16f6687df08f8c21787c1c8b1af1d79e1e
R 002b3717598c8349a2d682847ae9c09b R 1bdb8939bf2c03faad01504d64d78ceb
U drh U drh
Z 4b1d0cc8167eef257f9d48654435d622 Z 0ce806e21caa3af95c40e85810758762

View File

@@ -1 +1 @@
966b1a16f6687df08f8c21787c1c8b1af1d79e1e 3403d28a49b27d3059d3d399ca057e8d33eb857a

View File

@@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were # This file implements tests for miscellanous features that were
# left out of other test files. # left out of other test files.
# #
# $Id: misc2.test,v 1.7 2003/08/26 11:25:58 drh Exp $ # $Id: misc2.test,v 1.8 2003/08/27 22:54:32 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -128,3 +128,54 @@ do_test misc2-6.1 {
SELECT * FROM t1; SELECT * FROM t1;
} }
} {1 2} } {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
sqlite 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
sqlite 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}}