diff options
author | drh <drh@noemail.net> | 2007-08-22 20:18:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-08-22 20:18:21 +0000 |
commit | f3a65f7e443865f00b6799ba9637604b0ae55dc5 (patch) | |
tree | 5fc48b237b66cb49164f136fd222f6a49a21c304 /src/tclsqlite.c | |
parent | dd97a49c1a90e31dae5d47ee91e2618eb4b57eb8 (diff) | |
download | sqlite-f3a65f7e443865f00b6799ba9637604b0ae55dc5.tar.gz sqlite-f3a65f7e443865f00b6799ba9637604b0ae55dc5.zip |
The malloc.test script now passes all tests with no errors. (CVS 4271)
FossilOrigin-Name: db818430e9ea4ef4a4af575784009d5acae785a3
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index d953f9a71..5a65ebe50 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -12,7 +12,7 @@ ** A TCL Interface to SQLite. Append this file to sqlite3.c and ** compile the whole thing to build a TCL-enabled version of SQLite. ** -** $Id: tclsqlite.c,v 1.197 2007/08/22 00:39:21 drh Exp $ +** $Id: tclsqlite.c,v 1.198 2007/08/22 20:18:22 drh Exp $ */ #include "tcl.h" #include <errno.h> @@ -2350,8 +2350,20 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ sqlite3_close(p->db); p->db = 0; } +#ifdef SQLITE_TEST + if( p->db ){ + extern int Md5_Register(sqlite3*); + if( Md5_Register(p->db)==SQLITE_NOMEM ){ + zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db)); + sqlite3_close(p->db); + p->db = 0; + } + } +#endif #ifdef SQLITE_HAS_CODEC - sqlite3_key(p->db, pKey, nKey); + if( p->db ){ + sqlite3_key(p->db, pKey, nKey); + } #endif if( p->db==0 ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); @@ -2363,23 +2375,6 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ p->interp = interp; zArg = Tcl_GetStringFromObj(objv[1], 0); Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd); - - /* If compiled with SQLITE_TEST turned on, then register the "md5sum" - ** SQL function. - */ -#ifdef SQLITE_TEST - { - extern void Md5_Register(sqlite3*); -#if 0 - int mallocfail = sqlite3_iMallocFail; - sqlite3_iMallocFail = 0; -#endif - Md5_Register(p->db); -#if 0 - sqlite3_iMallocFail = mallocfail; -#endif - } -#endif return TCL_OK; } |