-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
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
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
# 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]
} 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}}
}
} {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}
}