]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
A failed ATTACH leaves the database in a consistent state. Ticket #811. (CVS 1811)
authordrh <drh@noemail.net>
Mon, 19 Jul 2004 00:56:23 +0000 (00:56 +0000)
committerdrh <drh@noemail.net>
Mon, 19 Jul 2004 00:56:23 +0000 (00:56 +0000)
FossilOrigin-Name: c22f9feb1bb00d1d54a8a87b557195573463fda9

manifest
manifest.uuid
src/attach.c
test/attach3.test

index 78c2ce27e43a578115619e3143bb583cc591ff30..c5151703491679bb1bbb4fb3287297c89d38d253 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C When\scomparing\stwo\sexpressions\sdo\snot\sapply\saffinity\sto\seither\soperand.\nTicket\s#805.\s(CVS\s1810)
-D 2004-07-19T00:39:45
+C A\sfailed\sATTACH\sleaves\sthe\sdatabase\sin\sa\sconsistent\sstate.\s\sTicket\s#811.\s(CVS\s1811)
+D 2004-07-19T00:56:24
 F Makefile.in 77d1219b6563476711a7a962e865979a6f314eb0
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -24,7 +24,7 @@ F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b
 F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
 F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
 F sqlite3.def 7610bb4092dcfa7db8fe6d9a92d3e51adce23566
-F src/attach.c 132498271187144919de139673ad648b8e82c77e
+F src/attach.c 5e37aaac0907edad5da8ba785b94f04fbb4003d7
 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
 F src/btree.c 3ed3c19e43bb243f502ee614f6ad0a52e53362a7
 F src/btree.h 934d0ad30b5b419e9291a11da878be349df2277e
@@ -83,7 +83,7 @@ F src/where.c 6507074d8ce3f78e7a4cd33f667f11e62020553e
 F test/all.test 3b692eb43583b52c99c344b2fa8934512d179016
 F test/attach.test 3acdffccbf5f78b07746771b9490758718e28856
 F test/attach2.test 3cd1d4a69e0ec307d0b68a44a96c9c8e1e253d65
-F test/attach3.test c4cc0b806783ce3d860af6b80c947f93ffb14270
+F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e
 F test/auth.test 23d1dbf2235635409fee36535a344edc7494aea2
 F test/bigfile.test 62722ac4b420dfbcdceb137b8634e2cf2865fe27
 F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
@@ -234,7 +234,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P d7e9772c74a2b9377f17149cc1baa3b2d0dfbfb8
-R 1a3746fc881442647db9802248e453ac
+P 88a4e400f916d7af088b39a9653d6452b3666577
+R cdef2dd9c388fa0028ff26d9fe9c7297
 U drh
-Z bcf75b34b3779312497eba95531e13ee
+Z 8c1cc1ba67e40d5ecd6969fb8fd7151c
index 9ff72c2b4920541560fb7636e8de1ca75b05ef92..e3143d5874ef2879440f4038e4dfc451ee519496 100644 (file)
@@ -1 +1 @@
-88a4e400f916d7af088b39a9653d6452b3666577
\ No newline at end of file
+c22f9feb1bb00d1d54a8a87b557195573463fda9
\ No newline at end of file
index dcefb22346690babb5b493515589fe0fddadbd44..dc8f99c33d1cbfc5e918b134b6c385d7d5a97bb7 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to implement the ATTACH and DETACH commands.
 **
-** $Id: attach.c,v 1.21 2004/06/30 09:49:23 danielk1977 Exp $
+** $Id: attach.c,v 1.22 2004/07/19 00:56:24 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -108,8 +108,7 @@ void sqlite3Attach(Parse *pParse, Token *pFilename, Token *pDbname, Token *pKey)
 #endif
   sqliteFree(zFile);
   db->flags &= ~SQLITE_Initialized;
-  if( pParse->nErr ) return;
-  if( rc==SQLITE_OK ){
+  if( pParse->nErr==0 && rc==SQLITE_OK ){
     rc = sqlite3ReadSchema(pParse);
   }
   if( rc ){
index 96ecd98f848604469275be1e2a71abbd5a4d957d..27b59c5ced42ca8ba88737910633a29ea86bb11d 100644 (file)
@@ -12,7 +12,7 @@
 # focus of this script is testing the ATTACH and DETACH commands
 # and schema changes to attached databases.
 #
-# $Id: attach3.test,v 1.8 2004/06/19 02:22:11 danielk1977 Exp $
+# $Id: attach3.test,v 1.9 2004/07/19 00:56:24 drh Exp $
 #
 
 
@@ -219,9 +219,23 @@ do_test attach3-10.0 {
   }
 } {1 {table sqlite_master may not be modified}}
 
+# Failure to attach leaves us in a workable state.
+# Ticket #811
+#
+do_test attach3-11.0 {
+  catchsql {
+    ATTACH DATABASE '/nodir/nofile.x' AS notadb;
+  }
+} {1 {unable to open database: /nodir/nofile.x}}
+do_test attach3-11.1 {
+  catchsql {
+    ATTACH DATABASE ':memory:' AS notadb;
+  }
+} {0 {}}
+do_test attach3-11.2 {
+  catchsql {
+    DETACH DATABASE notadb;
+  }
+} {0 {}}
 
 finish_test
-
-
-
-