diff options
author | drh <drh@noemail.net> | 2015-01-14 17:16:23 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-01-14 17:16:23 +0000 |
commit | 7a20f698dfa00d012f7742b0d8c2ca0d5a1ae41a (patch) | |
tree | a94425cfb168f06c47a06af4a683f31b3fc791d6 /src/tclsqlite.c | |
parent | f7af7a17b9a8a1e623604972399711271e1b903a (diff) | |
parent | 068a251d9982d7f57694d5b901078b94dc5b0ad0 (diff) | |
download | sqlite-7a20f698dfa00d012f7742b0d8c2ca0d5a1ae41a.tar.gz sqlite-7a20f698dfa00d012f7742b0d8c2ca0d5a1ae41a.zip |
Merge trunk 3.8.8 beta changes into the sessions branch
FossilOrigin-Name: 0ba124540b5b2a9ceda0f4f4a46e6be54edad813
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 6c67334c1..dd6fbc3e2 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -25,6 +25,14 @@ ** hundreds of new commands used for testing ** SQLite. This option implies -DSQLITE_TCLMD5. */ + +/* +** If requested, include the SQLite compiler options file for MSVC. +*/ +#if defined(INCLUDE_MSVC_H) +#include "msvc.h" +#endif + #include "tcl.h" #include <errno.h> @@ -1129,10 +1137,10 @@ static int dbPrepareAndBind( SqlPreparedStmt **ppPreStmt /* OUT: Object used to cache statement */ ){ const char *zSql = zIn; /* Pointer to first SQL statement in zIn */ - sqlite3_stmt *pStmt; /* Prepared statement object */ + sqlite3_stmt *pStmt = 0; /* Prepared statement object */ SqlPreparedStmt *pPreStmt; /* Pointer to cached statement */ int nSql; /* Length of zSql in bytes */ - int nVar; /* Number of variables in statement */ + int nVar = 0; /* Number of variables in statement */ int iParm = 0; /* Next free entry in apParm */ char c; int i; @@ -3248,7 +3256,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** The EXTERN macros are required by TCL in order to work on windows. */ EXTERN int Sqlite3_Init(Tcl_Interp *interp){ - int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK; + int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR; if( rc==TCL_OK ){ Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0); #ifndef SQLITE_3_SUFFIX_ONLY @@ -3965,6 +3973,11 @@ static void init_all(Tcl_Interp *interp){ #endif } +/* Needed for the setrlimit() system call on unix */ +#if defined(unix) +#include <sys/resource.h> +#endif + #define TCLSH_MAIN main /* Needed to fake out mktclapp */ int TCLSH_MAIN(int argc, char **argv){ Tcl_Interp *interp; @@ -3978,6 +3991,17 @@ int TCLSH_MAIN(int argc, char **argv){ } #endif + /* Since the primary use case for this binary is testing of SQLite, + ** be sure to generate core files if we crash */ +#if defined(SQLITE_TEST) && defined(unix) + { struct rlimit x; + getrlimit(RLIMIT_CORE, &x); + x.rlim_cur = x.rlim_max; + setrlimit(RLIMIT_CORE, &x); + } +#endif /* SQLITE_TEST && unix */ + + /* Call sqlite3_shutdown() once before doing anything else. This is to ** test that sqlite3_shutdown() can be safely called by a process before ** sqlite3_initialize() is. */ |