-C Add\sdocumentation\son\snew\ssqlite_authorizer\scallback\stypes.\sTicket\s#1744.\s(CVS\s3163)
-D 2006-04-05T01:08:35
+C Make\ssure\sSQLITE_NOMEM\sis\sreported\sout\son\sa\smalloc\sfailure\sin\san\sATTACH\neven\sif\sthe\smalloc\sfailure\sreports\swithin\sa\snested\scalls\sto\ssqlite3_prepare().\s(CVS\s3164)
+D 2006-04-05T11:57:37
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
F src/alter.c 451b34fc4eb2475ca76a2e86b21e1030a9428091
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
-F src/attach.c d73a3505de3fb9e373d0a158978116c4212031d0
+F src/attach.c 514f90623c891143846625afcab409d6b4986565
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c ed343b3dbcbc7da9ac481ef2b98c4239fe6d9629
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
F test/lock2.test d83ba79d3c4fffdb5b926c7d8ca7a36c34288a55
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
F test/main.test e7212ce1023957c7209778cc87fa932bd79ba89a
-F test/malloc.test 7d875b2b59ae1d79fba71403298a1eb4a1ed7c38
+F test/malloc.test 8580d8fe1f5e78e4ddbe07530e7a5d4ee36aac8f
F test/malloc2.test e6e321db96d6c94cb18bf82ad7215070c41e624e
F test/malloc3.test fd4186bee73c2a2638f4e2a05a684c06836f725b
F test/malloc4.test 59cd02f71b363302a04c4e77b97c0a1572eaa210
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 51b35ace203a33f6f04f1139ca8ab652c5c76f9a
-R 37db2ed2a2f394b32b2c98ec1c3f61dd
+P fdbff3f145296d5dcba8987c25629e27353e2ab0
+R a178117f13217df6aee4e3891a129fac
U drh
-Z bea39b4c4681bce541ac61af0db836c7
+Z 43dddd673d1c73ea60cfe59bfb56a0fc
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
-** $Id: attach.c,v 1.49 2006/01/24 12:09:18 danielk1977 Exp $
+** $Id: attach.c,v 1.50 2006/04/05 11:57:37 drh Exp $
*/
#include "sqliteInt.h"
}
sqlite3ResetInternalSchema(db, 0);
db->nDb = iDb;
- sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
+ if( rc==SQLITE_NOMEM ){
+ sqlite3MallocFailed();
+ sqlite3_snprintf(127, zErr, "out of memory");
+ }else{
+ sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
+ }
goto attach_error;
}
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
-# $Id: malloc.test,v 1.30 2006/01/24 10:58:23 danielk1977 Exp $
+# $Id: malloc.test,v 1.31 2006/04/05 11:57:37 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
unset static_string
+# Make sure SQLITE_NOMEM is reported out on an ATTACH failure even
+# when the malloc failure occurs within the nested parse.
+#
+do_malloc_test 20 -tclprep {
+ db close
+ file delete -force test2.db test2.db-journal
+ sqlite3 db test2.db
+ db eval {CREATE TABLE t1(x);}
+ db close
+} -tclbody {
+ if {[catch {sqlite3 db test.db}]} {
+ error "out of memory"
+ }
+} -sqlbody {
+ ATTACH DATABASE 'test2.db' AS t2;
+ SELECT * FROM t1;
+ DETACH DATABASE t2;
+}
+
+
# Ensure that no file descriptors were leaked.
do_test malloc-99.X {
catch {db close}