]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add locks to the in-memory backend so that recursive writes will be detected
authordrh <drh@noemail.net>
Wed, 27 Aug 2003 22:54:31 +0000 (22:54 +0000)
committerdrh <drh@noemail.net>
Wed, 27 Aug 2003 22:54:31 +0000 (22:54 +0000)
and rejected.  Ticket #436. (CVS 1089)

FossilOrigin-Name: 3403d28a49b27d3059d3d399ca057e8d33eb857a

manifest
manifest.uuid
test/misc2.test

index 6c33a555677982c71c19eb3dddccbd7f19397157..2c2d1ed1b77692d0e528d606b437e41c45e10c29 100644 (file)
--- a/manifest
+++ b/manifest
@@ -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)
-D 2003-08-27T22:52:34
+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:54:32
 F Makefile.in f7e916ae863393827fa6a4cb292e3398096edcf1
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -97,7 +97,7 @@ F test/memdb.test 6ece25c7c0e6500199d3662607a3edca081abb2a
 F test/memleak.test a18e6810cae96d2f6f5136920267adbefc8e1e90
 F test/minmax.test 6d9b6d6ee34f42e2a58dffece1f76d35f446b3af
 F test/misc1.test 0b98d493b0cf55cb5f53e1f3df8107c166eecb5a
-F test/misc2.test 48f1f2187831a89dc4785f493c0c320b3be61a32
+F test/misc2.test d7bc75fae9157c4a3f4914b505713f398b3c5422
 F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
 F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
@@ -168,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P c95f347cac27732533a2f6fd4ba50bf00eef59f3
-R 002b3717598c8349a2d682847ae9c09b
+P 966b1a16f6687df08f8c21787c1c8b1af1d79e1e
+R 1bdb8939bf2c03faad01504d64d78ceb
 U drh
-Z 4b1d0cc8167eef257f9d48654435d622
+Z 0ce806e21caa3af95c40e85810758762
index 60b81cd31acb7dade478904c4fd77437fc6c7511..56104e69c19bf81bbd4dc108b044e7b40eb01a3a 100644 (file)
@@ -1 +1 @@
-966b1a16f6687df08f8c21787c1c8b1af1d79e1e
\ No newline at end of file
+3403d28a49b27d3059d3d399ca057e8d33eb857a
\ No newline at end of file
index 8df1c7212a6d3414ee58cd7040a8db7d529b7554..60acb05c37358c8c51e2cb2e8a81d67a729907be 100644 (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.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]
 source $testdir/tester.tcl
@@ -128,3 +128,54 @@ do_test misc2-6.1 {
     SELECT * FROM t1;
   }
 } {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}}