1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Merge latest trunk changes with this branch.

FossilOrigin-Name: b3348b1e07e168b156636a29fc8c6d6afb3129c2
This commit is contained in:
dan
2015-01-21 06:36:07 +00:00
78 changed files with 1570 additions and 831 deletions

View File

@ -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>
@ -653,9 +661,9 @@ static int DbWalHandler(
#if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_UNLOCK_NOTIFY)
static void setTestUnlockNotifyVars(Tcl_Interp *interp, int iArg, int nArg){
char zBuf[64];
sprintf(zBuf, "%d", iArg);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", iArg);
Tcl_SetVar(interp, "sqlite_unlock_notify_arg", zBuf, TCL_GLOBAL_ONLY);
sprintf(zBuf, "%d", nArg);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%d", nArg);
Tcl_SetVar(interp, "sqlite_unlock_notify_argcount", zBuf, TCL_GLOBAL_ONLY);
}
#else
@ -1085,10 +1093,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;
@ -3102,7 +3110,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
@ -3421,7 +3429,7 @@ static void MD5DigestToBase10x8(unsigned char digest[16], char zDigest[50]){
for(i=j=0; i<16; i+=2){
x = digest[i]*256 + digest[i+1];
if( i>0 ) zDigest[j++] = '-';
sprintf(&zDigest[j], "%05u", x);
sqlite3_snprintf(16-j, &zDigest[j], "%05u", x);
j += 5;
}
zDigest[j] = 0;
@ -3815,6 +3823,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;
@ -3828,6 +3841,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. */