mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
If any error occurs during sqlite3_open(), move the database handle into "sick" state. When in the sick state the user can use sqlite3_errcode() and sqlite3_errmsg(), but not much else. (CVS 5628)
FossilOrigin-Name: ce9c74eaab459ddde213c828e821940f5d6cb354
This commit is contained in:
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\sthe\strans2.test\sscript\sdesigned\sto\sstress\sstatement\srollback\sand\nno-write\soptimizations\son\slarge\stransactions\swith\sa\ssmall\scache.\s(CVS\s5627)
|
C If\sany\serror\soccurs\sduring\ssqlite3_open(),\smove\sthe\sdatabase\shandle\sinto\s"sick"\sstate.\sWhen\sin\sthe\ssick\sstate\sthe\suser\scan\suse\ssqlite3_errcode()\sand\ssqlite3_errmsg(),\sbut\snot\smuch\selse.\s(CVS\s5628)
|
||||||
D 2008-08-27T18:56:36
|
D 2008-08-27T19:01:58
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
|
F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@ -115,7 +115,7 @@ F src/insert.c 110cca7845ed5a66c08fdd413b02e706ae34455f
|
|||||||
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
||||||
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
|
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
|
||||||
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
|
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
|
||||||
F src/main.c 69dbacc8c605f19dd380b2eda8c947a2aac19671
|
F src/main.c f372968372bdf4275333327fd04737f667e0f3af
|
||||||
F src/malloc.c 7ccc630b359f57a47b6034af54e42eb838eebd46
|
F src/malloc.c 7ccc630b359f57a47b6034af54e42eb838eebd46
|
||||||
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
|
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
|
||||||
F src/mem2.c 7256327b96927020824e06ffb3443b99a28da047
|
F src/mem2.c 7256327b96927020824e06ffb3443b99a28da047
|
||||||
@ -398,7 +398,7 @@ F test/lock4.test 09d97d52cae18fadfe631552af9880dac6b3ae90
|
|||||||
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
|
F test/lock5.test f4eeb0400cf65c37f733cb3c74401136f8c46acd
|
||||||
F test/lookaside.test 8866ea41301d74993423c99e523322fca09c259e
|
F test/lookaside.test 8866ea41301d74993423c99e523322fca09c259e
|
||||||
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
|
F test/main.test 8d77c161757ef7d96eaff0413daa7120c3b316fe
|
||||||
F test/malloc.test 69f5bb5a13b24edb1322fc1f42894f9d2f6446b1
|
F test/malloc.test f87273951a359a391b3074e1cb758fe8ca2113d5
|
||||||
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
|
F test/malloc3.test 094f8195fe8e409bd4da0f1d769f7745faec62c8
|
||||||
F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
|
F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
|
||||||
F test/malloc5.test c8d0f7673337e8a29afa558735ae937a0d629751
|
F test/malloc5.test c8d0f7673337e8a29afa558735ae937a0d629751
|
||||||
@ -624,7 +624,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P 9d7722f4f357b96c37f950024f1e7e160e2c1252
|
P 39c34e2238c27b2a2f4f0b896126ccbd299114c5
|
||||||
R 7e38426936c8ee7d92dffd15d06dbe75
|
R 0bf03a77bd82f6ac6f412ad9339ae6a4
|
||||||
U drh
|
U danielk1977
|
||||||
Z 4f34f6e09d3a22e5fabb341c54267054
|
Z ac6800a3d7725cc034896ca6e2243181
|
||||||
|
@ -1 +1 @@
|
|||||||
39c34e2238c27b2a2f4f0b896126ccbd299114c5
|
ce9c74eaab459ddde213c828e821940f5d6cb354
|
10
src/main.c
10
src/main.c
@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.493 2008/08/21 20:21:35 drh Exp $
|
** $Id: main.c,v 1.494 2008/08/27 19:01:58 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -1481,7 +1481,6 @@ static int openDatabase(
|
|||||||
db->pVfs = sqlite3_vfs_find(zVfs);
|
db->pVfs = sqlite3_vfs_find(zVfs);
|
||||||
if( !db->pVfs ){
|
if( !db->pVfs ){
|
||||||
rc = SQLITE_ERROR;
|
rc = SQLITE_ERROR;
|
||||||
db->magic = SQLITE_MAGIC_SICK;
|
|
||||||
sqlite3Error(db, rc, "no such vfs: %s", zVfs);
|
sqlite3Error(db, rc, "no such vfs: %s", zVfs);
|
||||||
goto opendb_out;
|
goto opendb_out;
|
||||||
}
|
}
|
||||||
@ -1495,7 +1494,6 @@ static int openDatabase(
|
|||||||
createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
|
createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
|
||||||
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
|
createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
|
||||||
if( db->mallocFailed ){
|
if( db->mallocFailed ){
|
||||||
db->magic = SQLITE_MAGIC_SICK;
|
|
||||||
goto opendb_out;
|
goto opendb_out;
|
||||||
}
|
}
|
||||||
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0);
|
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0);
|
||||||
@ -1518,7 +1516,6 @@ static int openDatabase(
|
|||||||
&db->aDb[0].pBt);
|
&db->aDb[0].pBt);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
sqlite3Error(db, rc, 0);
|
sqlite3Error(db, rc, 0);
|
||||||
db->magic = SQLITE_MAGIC_SICK;
|
|
||||||
goto opendb_out;
|
goto opendb_out;
|
||||||
}
|
}
|
||||||
db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
|
db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
|
||||||
@ -1608,9 +1605,12 @@ opendb_out:
|
|||||||
assert( db->mutex!=0 || isThreadsafe==0 || sqlite3Config.bFullMutex==0 );
|
assert( db->mutex!=0 || isThreadsafe==0 || sqlite3Config.bFullMutex==0 );
|
||||||
sqlite3_mutex_leave(db->mutex);
|
sqlite3_mutex_leave(db->mutex);
|
||||||
}
|
}
|
||||||
if( SQLITE_NOMEM==(rc = sqlite3_errcode(db)) ){
|
rc = sqlite3_errcode(db);
|
||||||
|
if( rc==SQLITE_NOMEM ){
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
db = 0;
|
db = 0;
|
||||||
|
}else if( rc!=SQLITE_OK ){
|
||||||
|
db->magic = SQLITE_MAGIC_SICK;
|
||||||
}
|
}
|
||||||
*ppDb = db;
|
*ppDb = db;
|
||||||
return sqlite3ApiExit(0, rc);
|
return sqlite3ApiExit(0, rc);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# to see what happens in the library if a malloc were to really fail
|
# to see what happens in the library if a malloc were to really fail
|
||||||
# due to an out-of-memory situation.
|
# due to an out-of-memory situation.
|
||||||
#
|
#
|
||||||
# $Id: malloc.test,v 1.63 2008/07/07 14:56:57 danielk1977 Exp $
|
# $Id: malloc.test,v 1.64 2008/08/27 19:01:58 danielk1977 Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -409,6 +409,9 @@ ifcapable utf16 {
|
|||||||
if {[sqlite3_errcode $DB2] eq "SQLITE_IOERR+12"} {
|
if {[sqlite3_errcode $DB2] eq "SQLITE_IOERR+12"} {
|
||||||
error "out of memory"
|
error "out of memory"
|
||||||
}
|
}
|
||||||
|
if {[regexp ".*automatic extension loading.*" [sqlite3_errmsg $DB2]]} {
|
||||||
|
error "out of memory"
|
||||||
|
}
|
||||||
if {$rc} {
|
if {$rc} {
|
||||||
error [string range $msg 4 end]
|
error [string range $msg 4 end]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user