]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Additional attach testing. I now believe that ticket #317 was fixed
authordrh <drh@noemail.net>
Sat, 17 May 2003 19:23:51 +0000 (19:23 +0000)
committerdrh <drh@noemail.net>
Sat, 17 May 2003 19:23:51 +0000 (19:23 +0000)
by check-in (981). (CVS 985)

FossilOrigin-Name: 24191373796b7fd6255ef9b70ce2344326308113

manifest
manifest.uuid
test/attach.test

index 179de3406a464dd60a9950ca718015ff1a427883..5531040e0602a7bc5d712da0821854b661b61f24 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Prevent\san\sinfinite\sloop\swhen\sdeleting\sa\stable\sthat\shas\sa\sTEMP\strigger.\s(CVS\s984)
-D 2003-05-17T19:04:04
+C Additional\sattach\stesting.\s\sI\snow\sbelieve\sthat\sticket\s#317\swas\sfixed\nby\scheck-in\s(981).\s(CVS\s985)
+D 2003-05-17T19:23:52
 F Makefile.in 1ff85c27d4350c74118341024e8a4fb2a04a3a43
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -63,7 +63,7 @@ F src/vdbe.c 81b9868acd7e7d54ddd26af4ffe8442c312ad374
 F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
 F src/where.c 1e645d430cb4b347159c28c6085e9801160f2099
 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
-F test/attach.test ca8304e0f2236d1bf68e53ccc17cf3e8d76de0f1
+F test/attach.test 20b35533a5460e1a1ed518948233f870c31ba824
 F test/auth.test dee78be1f4f920bd6b15c4c947ce4d01bfe2826d
 F test/bigfile.test 1cd8256d4619c39bea48147d344f348823e78678
 F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
@@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be
 F www/sqlite.tcl 4bd1729e320f5fa9125f0022b281fbe839192125
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P f542e5fc8896111e5165cc625607f95e4993bb16
-R fa932d99cd2f240b0dbcaa691638c769
+P c8c823b068916711857fa67db10fb479999b55c2
+R bc3167929b77207fc599db40b8510a4e
 U drh
-Z c96cb30883171b8cc67337276b3d728f
+Z 07eb60187b21aabbdcf71968529d48bd
index b058f6b57a8c84315dda53af235f9592a6b1ecd9..eeadd48e75c1e896662b13e9bc777208dee9a0e0 100644 (file)
@@ -1 +1 @@
-c8c823b068916711857fa67db10fb479999b55c2
\ No newline at end of file
+24191373796b7fd6255ef9b70ce2344326308113
\ No newline at end of file
index 6611bc6e49b7acc0a630e464306276f300d90bbc..fd14e0e9f496c65515f66cf39589c1f1e60a5b96 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this script is testing the ATTACH and DETACH commands
 # and related functionality.
 #
-# $Id: attach.test,v 1.4 2003/05/17 17:35:13 drh Exp $
+# $Id: attach.test,v 1.5 2003/05/17 19:23:52 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -259,7 +259,7 @@ do_test attach-2.10 {
   } db2
 } {table t2 t2 table tx tx trigger r1 t2 index i2 t2}
 do_test attach-2.11 {
-  catchsql { pragma vdbe_trace=on;
+  catchsql { 
     SELECT * FROM t2 WHERE x>5;
   }
 } {1 {database schema has changed}}
@@ -292,6 +292,83 @@ do_test attach-2.16 {
   }
 } {table t2 t2 table tx tx trigger r1 t2 index i2 t2}
 
+do_test attach-3.1 {
+  db close
+  db2 close
+  sqlite db test.db
+  sqlite db2 test2.db
+  execsql {
+    SELECT * FROM t1
+  }
+} {1 2 3 4}
+do_test attach-3.2 {
+  catchsql {
+    SELECT * FROM t2
+  }
+} {1 {no such table: t2}}
+do_test attach-3.3 {
+  catchsql {
+    ATTACH DATABASE 'test2.db' AS db2;
+    SELECT * FROM t2
+  }
+} {0 {21 x 22 y}}
+
+# Even though main has a transaction, test2.db should not be locked.
+do_test attach-3.4 {
+  execsql BEGIN
+  catchsql {
+    SELECT * FROM t2;
+  } db2;
+} {0 {21 x 22 y}}
+
+# Reading from db2 should not lock test2.db
+do_test attach-3.5 {
+  execsql {SELECT * FROM t2}
+  catchsql {
+    SELECT * FROM t2;
+  } db2;
+} {0 {21 x 22 y}}
+
+# Making a change to db2 causes test2.ddb to become locked.
+do_test attach-3.6 {
+  execsql {
+    UPDATE t2 SET x=x+1 WHERE x=50;
+  }
+  catchsql {
+    SELECT * FROM t2;
+  } db2;
+} {1 {database is locked}}
+
+do_test attach-3.7 {
+  execsql ROLLBACK
+  execsql {SELECT * FROM t2} db2
+} {21 x 22 y}
+do_test attach-3.8 {
+  execsql BEGIN
+  execsql BEGIN db2
+  catchsql {SELECT * FROM t2}
+} {1 {database is locked}}
+do_test attach-3.9 {
+  catchsql {SELECT * FROM t2} db2
+} {0 {21 x 22 y}}
+do_test attach-3.10 {
+  execsql {SELECT * FROM t1}
+} {1 2 3 4}
+do_test attach-3.11 {
+  catchsql {UPDATE t1 SET a=a+1}
+} {0 {}}
+do_test attach-3.12 {
+  execsql {SELECT * FROM t1}
+} {2 2 4 4}
+do_test attach-3.13 {
+  catchsql {UPDATE t2 SET x=x+1 WHERE x=50}
+} {1 {database is locked}}
+do_test attach-3.14 {
+  # the "database is locked" error on the previous test should have
+  # caused a rollback.
+  execsql {SELECT * FROM t1}
+} {1 2 3 4}
+
 for {set i 2} {$i<=15} {incr i} {
   catch {db$i close}
 }