diff options
author | drh <drh@noemail.net> | 2009-03-24 15:08:09 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-03-24 15:08:09 +0000 |
commit | d9da78a2c89341d2507ff43c1732821c80ca1664 (patch) | |
tree | 56a14f20c1d1acc86755290f55d943013f9d8e42 /src/tclsqlite.c | |
parent | 4be64691468e95abb6ddc33ea89333b4a63e2e08 (diff) | |
download | sqlite-d9da78a2c89341d2507ff43c1732821c80ca1664.tar.gz sqlite-d9da78a2c89341d2507ff43c1732821c80ca1664.zip |
Changes to insure that lookaside memory allocations are never used to hold
schema content.
Ticket #3743. (CVS 6377)
FossilOrigin-Name: ea74d8dc62f5784089aa8ef098e97c505a79b176
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index a429662d8..8959e6074 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.238 2009/03/16 13:19:36 danielk1977 Exp $ +** $Id: tclsqlite.c,v 1.239 2009/03/24 15:08:10 drh Exp $ */ #include "tcl.h" #include <errno.h> @@ -2593,8 +2593,21 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ int i; const char *zFile; const char *zVfs = 0; - int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX; + int flags; Tcl_DString translatedFilename; + + /* In normal use, each TCL interpreter runs in a single thread. So + ** by default, we can turn of mutexing on SQLite database connections. + ** However, for testing purposes it is useful to have mutexes turned + ** on. So, by default, mutexes default off. But if compiled with + ** SQLITE_TCL_DEFAULT_FULLMUTEX then mutexes default on. + */ +#ifdef SQLITE_TCL_DEFAULT_FULLMUTEX + flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX; +#else + flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX; +#endif + if( objc==2 ){ zArg = Tcl_GetStringFromObj(objv[1], 0); if( strcmp(zArg,"-version")==0 ){ |