Comment: | First attempt at getting the build to work with Tcl 9.0. |
---|---|
Downloads: | Tarball| ZIP archive| SQL archive |
Timelines: | family| ancestors| descendants| both | tcl9 |
Files: | files | file ages | folders |
SHA3-256: | 6e5bb48a74d63fb8c30528f0005d1763 |
User&Date: | drh on 2024-07-30 15:49:02 |
OtherLinks: | branch diff |manifest| tags |
2024-07-30 | ||
16:51 | Fix the incrblob channel so that partial close works with Tcl9.(check-in:d54ec2de user:drh tags:tcl9) | |
15:49 | First attempt at getting the build to work with Tcl 9.0.(check-in:6e5bb48a user:drh tags:tcl9) | |
2024-07-27 | ||
20:28 | Fix documentation typo. Forum post 993cb82402(Leafcheck-in:86de4e75 user:drh tags:trunk) | |
HideDiffsUnifiedDiffsIgnoreWhitespacePatch
Modified autoconf/tea/tclconfig/tcl.m4from [debe1328]to [c6e5f2fc].
︙ | ︙ |
Modified autoconf/tea/win/rules.vcfrom [c511f222]to [7b3bb2ef].
︙ | ︙ | |||
704705706707708709710 | !message *** Optional defines are '$(OPTDEFINES)'!message *** Compiler version $(VCVER). Target machine is $(MACHINE)!message *** Host architecture is $(NATIVE_ARCH)!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'!message *** Link options '$(LINKERFLAGS)'!endif | < | 704705706707708709710 | !message *** Optional defines are '$(OPTDEFINES)'!message *** Compiler version $(VCVER). Target machine is $(MACHINE)!message *** Host architecture is $(NATIVE_ARCH)!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'!message *** Link options '$(LINKERFLAGS)'!endif |
Modified ext/expert/test_expert.cfrom [d56c194b]to [b767b203].
︙ | ︙ | |||
12131415161718 | */#if defined(SQLITE_TEST)#include "sqlite3expert.h"#include <assert.h>#include <string.h> | <<<<|<<<< | 1213141516171820212223242526 | */#if defined(SQLITE_TEST)#include "sqlite3expert.h"#include <assert.h>#include <string.h>#ifndef SQLITE_OMIT_VIRTUALTABLE/*** Extract an sqlite3* db handle from the object passed as the second** argument. If successful, set *pDb to point to the db handle and return** TCL_OK. Otherwise, return TCL_ERROR. |
︙ | ︙ |
Modified ext/fts3/fts3_test.cfrom [d8d7b273]to [a17e6c62].
︙ | ︙ | |||
14151617181920 | ** testing. It contains a Tcl command that can be used to test if a document** matches an FTS NEAR expression.**** As of March 2012, it also contains a version 1 tokenizer used for testing** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly.*/ | <<<|<<<< | 1415161718192022232425262728 | ** testing. It contains a Tcl command that can be used to test if a document** matches an FTS NEAR expression.**** As of March 2012, it also contains a version 1 tokenizer used for testing** that the sqlite3_tokenizer_module.xLanguage() method is invoked correctly.*/#include <string.h>#include <assert.h>#if defined(SQLITE_TEST)#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)/* Required so that the "ifdef SQLITE_ENABLE_FTS3" below works */ |
︙ | ︙ | |||
163164165166167168169 | NearPhrase *aPhrase = 0; NearDocument doc = {0, 0}; Tcl_Obj **apDocToken; Tcl_Obj *pRet; Tcl_Obj *pPhrasecount = 0; Tcl_Obj **apExprToken; | |> | 156157158159160161162165166167168169170171 | NearPhrase *aPhrase = 0; NearDocument doc = {0, 0}; Tcl_Obj **apDocToken; Tcl_Obj *pRet; Tcl_Obj *pPhrasecount = 0; Tcl_Obj **apExprToken; UNUSED_PARAMETER(clientData); /* Must have 3 or more arguments. */ if( objc<3 || (objc%2)==0 ){ Tcl_WrongNumArgs(interp, 1, objv, "DOCUMENT EXPR ?OPTION VALUE?..."); rc = TCL_ERROR; |
︙ | ︙ | |||
197198199200201202203 | switch( aOpt[iOpt].eOpt ){ case NM_PHRASECOUNTS: pPhrasecount = objv[ii+1]; break; } } | |>|>|||>|>| | 191192193194195196197200201202205206207208209211212213214215217218219220221222223224225227231233234235236237238239 | switch( aOpt[iOpt].eOpt ){ case NM_PHRASECOUNTS: pPhrasecount = objv[ii+1]; break; } } if( rc!=TCL_OK ) goto near_match_out; doc.aToken = (NearToken *)ckalloc(doc.nToken*sizeof(NearToken)); for(ii=0; ii<doc.nToken; ii++){ } rc = Tcl_ListObjGetElements(interp, objv[2], &nExprToken, &apExprToken); if( rc!=TCL_OK ) goto near_match_out; aPhrase = (NearPhrase *)ckalloc(nPhrase * sizeof(NearPhrase)); memset(aPhrase, 0, nPhrase * sizeof(NearPhrase)); for(ii=0; ii<nPhrase; ii++){ Tcl_Obj *pPhrase = apExprToken[ii*2]; Tcl_Obj **apToken; int jj; rc = Tcl_ListObjGetElements(interp, pPhrase, &nToken, &apToken); if( rc!=TCL_OK ) goto near_match_out; if( nToken>NM_MAX_TOKEN ){ Tcl_AppendResult(interp, "Too many tokens in phrase", 0); rc = TCL_ERROR; goto near_match_out; } NearToken *pT = &aPhrase[ii].aToken[jj]; } } for(ii=1; ii<nPhrase; ii++){ Tcl_Obj *pNear = apExprToken[2*ii-1]; int nNear; rc = Tcl_GetIntFromObj(interp, pNear, &nNear); if( rc!=TCL_OK ) goto near_match_out; aPhrase[ii].nNear = nNear; |
︙ | ︙ |
Modified ext/fts3/fts3_tokenizer.cfrom [6d8fc150]to [defede96].
︙ | ︙ | |||
222223224225226227228 | sqlite3_free(zCopy); return rc;}#ifdef SQLITE_TEST | <<<|< | 222223224225226227228230231232233234235236 | sqlite3_free(zCopy); return rc;}#ifdef SQLITE_TEST#include <string.h>/*** Implementation of a special SQL scalar function for testing tokenizers ** designed to be used in concert with the Tcl testing framework. This** function must be called with two or more arguments:** |
︙ | ︙ |
Modified ext/fts5/fts5_tcl.cfrom [fdf7e2bb]to [5ca3e3e3].
︙ | ︙ | |||
10111213141516 | ***********************************************************************************/#ifdef SQLITE_TEST | <<<|<<<< | 1011121314151618192021222324 | ***********************************************************************************/#ifdef SQLITE_TEST#ifdef SQLITE_ENABLE_FTS5#include "fts5.h"#include <string.h>#include <assert.h> |
︙ | ︙ | |||
293294295296297298299 | rc = p->pApi->xColumnTotalSize(p->pFts, iCol, &nSize); if( rc==SQLITE_OK ){ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(nSize)); } break; } CASE(3, "xTokenize") { | || | 286287288289290291292294295296297299300301302303304305 | rc = p->pApi->xColumnTotalSize(p->pFts, iCol, &nSize); if( rc==SQLITE_OK ){ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(nSize)); } break; } CASE(3, "xTokenize") { char *zText = Tcl_GetStringFromObj(objv[2], &nText); F5tFunction ctx; ctx.interp = interp; ctx.pScript = objv[3]; if( rc==SQLITE_OK ){ Tcl_ResetResult(interp); } return rc; } CASE(4, "xPhraseCount") { int nPhrase; |
︙ | ︙ | |||
601602603604605606607 | Tcl_DecrRefCount(pEval); Tcl_DeleteCommand(p->interp, zCmd); if( rc!=TCL_OK ){ sqlite3_result_error(pCtx, Tcl_GetStringResult(p->interp), -1); }else{ Tcl_Obj *pVar = Tcl_GetObjResult(p->interp); | <>||>>|| | 594595596597598599600601602603604605609611612613614615616617618619620621622626627628629630631632 | Tcl_DecrRefCount(pEval); Tcl_DeleteCommand(p->interp, zCmd); if( rc!=TCL_OK ){ sqlite3_result_error(pCtx, Tcl_GetStringResult(p->interp), -1); }else{ Tcl_Obj *pVar = Tcl_GetObjResult(p->interp); const char *zType = (pVar->typePtr ? pVar->typePtr->name : ""); char c = zType[0]; if( c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0 ){ /* Only return a BLOB type if the Tcl variable is a bytearray and ** has no string representation. */ }else if( c=='b' && strcmp(zType,"boolean")==0 ){ Tcl_GetIntFromObj(0, pVar, &n); sqlite3_result_int(pCtx, n); }else if( c=='d' && strcmp(zType,"double")==0 ){ double r; Tcl_GetDoubleFromObj(0, pVar, &r); sqlite3_result_double(pCtx, r); }else if( (c=='w' && strcmp(zType,"wideInt")==0) || (c=='i' && strcmp(zType,"int")==0) ){ Tcl_WideInt v; Tcl_GetWideIntFromObj(0, pVar, &v); sqlite3_result_int64(pCtx, v); }else{ } }}static void xF5tDestroy(void *pCtx){ F5tFunction *p = (F5tFunction*)pCtx; Tcl_DecrRefCount(p->pScript); |
︙ | ︙ | |||
716717718719720721722 | static int SQLITE_TCLAPI f5tTokenize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *zText; | || | 711712713714715716717719720721722723724725726728729730731732733734 | static int SQLITE_TCLAPI f5tTokenize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *zText; sqlite3 *db = 0; fts5_api *pApi = 0; Fts5Tokenizer *pTok = 0; fts5_tokenizer tokenizer; Tcl_Obj *pRet = 0; void *pUserdata; int rc; const char **azArg; F5tTokenizeCtx ctx; if( objc!=4 && objc!=5 ){ Tcl_WrongNumArgs(interp, 1, objv, "?-subst? DB NAME TEXT"); return TCL_ERROR; } |
︙ | ︙ | |||
757758759760761762763 | rc = pApi->xFindTokenizer(pApi, azArg[0], &pUserdata, &tokenizer); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "no such tokenizer: ", azArg[0], 0); return TCL_ERROR; } | || | 752753754755756757758760761762763764765766767768769770772773774775776777778 | rc = pApi->xFindTokenizer(pApi, azArg[0], &pUserdata, &tokenizer); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "no such tokenizer: ", azArg[0], 0); return TCL_ERROR; } if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "error in tokenizer.xCreate()", 0); return TCL_ERROR; } pRet = Tcl_NewObj(); Tcl_IncrRefCount(pRet); ctx.bSubst = (objc==5); ctx.pRet = pRet; ctx.zInput = zText; rc = tokenizer.xTokenize( ); tokenizer.xDelete(pTok); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "error in tokenizer.xTokenize()", 0); Tcl_DecrRefCount(pRet); return TCL_ERROR; } |
︙ | ︙ | |||
924925926927928929930 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ F5tTokenizerContext *p = (F5tTokenizerContext*)clientData; int iStart; int iEnd; | || | 919920921922923924925927928929930931933934935936937938939 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ F5tTokenizerContext *p = (F5tTokenizerContext*)clientData; int iStart; int iEnd; int tflags = 0; char *zToken; int rc; if( objc==5 ){ char *zArg = Tcl_GetStringFromObj(objv[1], &nArg); if( nArg<=10 && nArg>=2 && memcmp("-colocated", zArg, nArg)==0 ){ tflags |= FTS5_TOKEN_COLOCATED; }else{ goto usage; } }else if( objc!=4 ){ |
︙ | ︙ | |||
955956957958959960961 | if( p->xToken==0 ){ Tcl_AppendResult(interp, "sqlite3_fts5_token may only be used by tokenizer callback", 0 ); return TCL_ERROR; } | | | 950951952953954955956958959960961962963964 | if( p->xToken==0 ){ Tcl_AppendResult(interp, "sqlite3_fts5_token may only be used by tokenizer callback", 0 ); return TCL_ERROR; } Tcl_SetResult(interp, (char*)sqlite3ErrName(rc), TCL_VOLATILE); return rc==SQLITE_OK ? TCL_OK : TCL_ERROR; usage: Tcl_WrongNumArgs(interp, 1, objv, "?-colocated? TEXT START END"); return TCL_ERROR;} |
︙ | ︙ | |||
1079108010811082108310841085 | static int SQLITE_TCLAPI f5tTokenHash( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *z; | || | 10741075107610771078107910801082108310841085108610871088108910901091109210931095109610971098109911001101 | static int SQLITE_TCLAPI f5tTokenHash( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *z; unsigned int iVal; int nSlot; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "NSLOT TOKEN"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[1], &nSlot) ){ return TCL_ERROR; } z = Tcl_GetStringFromObj(objv[2], &n); Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal)); return TCL_OK;}static int SQLITE_TCLAPI f5tRegisterMatchinfo( void * clientData, Tcl_Interp *interp, |
︙ | ︙ |
Modified ext/intck/test_intck.cfrom [6050ed1f]to [4f9eaada].
︙ | ︙ | |||
11121314151617 | *************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"#include "sqlite3intck.h" | <<<<|<< | 1112131415161719202122232425 | *************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"#include "sqlite3intck.h"#include <string.h>#include <assert.h>/* In test1.c */int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);const char *sqlite3ErrName(int); |
︙ | ︙ |
Modified ext/rbu/test_rbu.cfrom [ee6ede75]to [b9727c33].
︙ | ︙ | |||
13141516171819 | #include "sqlite3.h"#if defined(SQLITE_TEST)#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)#include "sqlite3rbu.h" | <<<|<<<< | 1314151617181921222324252627 | #include "sqlite3.h"#if defined(SQLITE_TEST)#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)#include "sqlite3rbu.h"#include <assert.h>#include <string.h>typedef struct TestRbu TestRbu;struct TestRbu { sqlite3rbu *pRbu; Tcl_Interp *interp; |
︙ | ︙ | |||
428429430431432433434 | for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); } return TCL_OK;}#else | <<<|< | 421422423424425426427429430431 | for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, 0, 0); } return TCL_OK;}#elseint SqliteRbu_Init(Tcl_Interp *interp){ return TCL_OK; }#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */#endif /* defined(SQLITE_TEST) */ |
Modified ext/recover/test_recover.cfrom [fd871a40]to [072260d7].
︙ | ︙ | |||
10111213141516 | ******************************************************************************/#include "sqlite3recover.h"#include "sqliteInt.h" | <| | 1011121314151618192021222324 | ******************************************************************************/#include "sqlite3recover.h"#include "sqliteInt.h"#include <assert.h>#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct TestRecover TestRecover;struct TestRecover { sqlite3_recover *p; |
︙ | ︙ | |||
304305306307308309310 | for(i=0; i<sizeof(aCmd)/sizeof(struct Cmd); i++){ struct Cmd *p = &aCmd[i]; Tcl_CreateObjCommand(interp, p->zCmd, p->xProc, p->pArg, 0); }#endif return TCL_OK;} | < | 303304305306307308309 | for(i=0; i<sizeof(aCmd)/sizeof(struct Cmd); i++){ struct Cmd *p = &aCmd[i]; Tcl_CreateObjCommand(interp, p->zCmd, p->xProc, p->pArg, 0); }#endif return TCL_OK;} |
Modified ext/rtree/test_rtreedoc.cfrom [de76b347]to [d20f51d1].
︙ | ︙ | |||
10111213141516 | ***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h" | <<<|< | 1011121314151618192021222324 | ***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"/* Solely for the UNUSED_PARAMETER() macro. */#include "sqliteInt.h"#ifdef SQLITE_ENABLE_RTREEtypedef struct BoxGeomCtx BoxGeomCtx; |
︙ | ︙ | |||
86878889909192 | sqlite3_snprintf(sizeof(aPtr)-1, aPtr, "%p", (void*)p); Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj(aPtr,-1)); rc = Tcl_EvalObjEx(interp, pScript, 0); if( rc!=TCL_OK ){ rc = SQLITE_ERROR; }else{ | | | 8283848586878890919293949596 | sqlite3_snprintf(sizeof(aPtr)-1, aPtr, "%p", (void*)p); Tcl_ListObjAppendElement(interp, pScript, Tcl_NewStringObj(aPtr,-1)); rc = Tcl_EvalObjEx(interp, pScript, 0); if( rc!=TCL_OK ){ rc = SQLITE_ERROR; }else{ Tcl_Obj **aObj = 0; pRes = Tcl_GetObjResult(interp); if( Tcl_ListObjGetElements(interp, pRes, &nObj, &aObj) ) return TCL_ERROR; if( nObj>0 ){ const char *zCmd = Tcl_GetString(aObj[0]); if( 0==sqlite3_stricmp(zCmd, "zero") ){ |
︙ | ︙ | |||
275276277278279280281 | ); Tcl_ListObjAppendElement(interp, pEval, pArg); rc = Tcl_EvalObjEx(interp, pEval, 0) ? SQLITE_ERROR : SQLITE_OK; if( rc==SQLITE_OK ){ double rScore = 0.0; | | | 271272273274275276277279280281282283284285 | ); Tcl_ListObjAppendElement(interp, pEval, pArg); rc = Tcl_EvalObjEx(interp, pEval, 0) ? SQLITE_ERROR : SQLITE_OK; if( rc==SQLITE_OK ){ double rScore = 0.0; int eP = 0; Tcl_Obj **aObj = 0; Tcl_Obj *pRes = Tcl_GetObjResult(interp); if( Tcl_ListObjGetElements(interp, pRes, &nObj, &aObj) || nObj!=2 || Tcl_GetDoubleFromObj(interp, aObj[1], &rScore) |
︙ | ︙ |
Modified ext/session/test_session.cfrom [8bcc8571]to [6acbe67d].
1234567 | #if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_SESSION) \ && defined(SQLITE_ENABLE_PREUPDATE_HOOK)#include "sqlite3session.h"#include <assert.h>#include <string.h> | <<<|<<<< | 12345679101112131415 | #if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_SESSION) \ && defined(SQLITE_ENABLE_PREUPDATE_HOOK)#include "sqlite3session.h"#include <assert.h>#include <string.h>#ifndef SQLITE_AMALGAMATION typedef unsigned char u8;#endiftypedef struct TestSession TestSession;struct TestSession { |
︙ | ︙ | |||
513514515516517518519 | struct TestConflictHandler { Tcl_Interp *interp; Tcl_Obj *pConflictScript; Tcl_Obj *pFilterScript;};static int test_obj_eq_string(Tcl_Obj *p, const char *z){ | ||| | 506507508509510511512515516518519520521522523524 | struct TestConflictHandler { Tcl_Interp *interp; Tcl_Obj *pConflictScript; Tcl_Obj *pFilterScript;};static int test_obj_eq_string(Tcl_Obj *p, const char *z){ char *zObj; zObj = Tcl_GetStringFromObj(p, &nObj); return (nObj==n && (n==0 || 0==memcmp(zObj, z, n)));}static int test_filter_handler( void *pCtx, /* Pointer to TestConflictHandler structure */ |
︙ | ︙ | |||
792793794795796797798 | int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ int rc; /* Return code from changeset_invert() */ void *pChangeset; /* Buffer containing changeset */ | | | 785786787788789790791793794795796797798799 | int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ int rc; /* Return code from changeset_invert() */ void *pChangeset; /* Buffer containing changeset */ TestConflictHandler ctx; TestStreamInput sStr; void *pRebase = 0; int nRebase = 0; int flags = 0; /* Flags for apply_v2() */ memset(&sStr, 0, sizeof(sStr)); |
︙ | ︙ | |||
849850851852853854855 | pChangeset = (void *)Tcl_GetByteArrayFromObj(objv[2], &nChangeset); ctx.pConflictScript = objv[3]; ctx.pFilterScript = objc==5 ? objv[4] : 0; ctx.interp = interp; if( sStr.nStream==0 ){ if( bV2==0 ){ | ||| | 842843844845846847848850851852854855856857858859861862863864865866867 | pChangeset = (void *)Tcl_GetByteArrayFromObj(objv[2], &nChangeset); ctx.pConflictScript = objv[3]; ctx.pFilterScript = objc==5 ? objv[4] : 0; ctx.interp = interp; if( sStr.nStream==0 ){ if( bV2==0 ){ (objc==5)?test_filter_handler:0, test_conflict_handler, (void *)&ctx ); }else{ (objc==5)?test_filter_handler:0, test_conflict_handler, (void *)&ctx, &pRebase, &nRebase, flags ); } }else{ sStr.aData = (unsigned char*)pChangeset; if( bV2==0 ){ rc = sqlite3changeset_apply_strm(db, testStreamInput, (void*)&sStr, (objc==5) ? test_filter_handler : 0, test_conflict_handler, (void *)&ctx ); }else{ rc = sqlite3changeset_apply_v2_strm(db, testStreamInput, (void*)&sStr, |
︙ | ︙ | |||
923924925926927928929 | int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ int rc; /* Return code from changeset_invert() */ void *pChangeset; /* Buffer containing changeset */ | ||>>|> | 916917918919920921922924925926927928929930931932933934935938939940941942943944945946947948949950951952953954955957958959960961962963964965966967970971972973974975976 | int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db; /* Database handle */ Tcl_CmdInfo info; /* Database Tcl command (objv[1]) info */ int rc; /* Return code from changeset_invert() */ void *pChangeset; /* Buffer containing changeset */ if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB CHANGESET"); return TCL_ERROR; } if( 0==Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) ){ Tcl_AppendResult(interp, "no such handle: ", Tcl_GetString(objv[2]), 0); return TCL_ERROR; } db = *(sqlite3 **)info.objClientData; pChangeset = (void *)Tcl_GetByteArrayFromObj(objv[2], &nChangeset); if( rc!=SQLITE_OK ){ return test_session_error(interp, rc, 0); } Tcl_ResetResult(interp); return TCL_OK;}/*** sqlite3changeset_invert CHANGESET*/static int SQLITE_TCLAPI test_sqlite3changeset_invert( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int rc; /* Return code from changeset_invert() */ TestStreamInput sIn; /* Input stream */ TestSessionsBlob sOut; /* Output blob */ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "CHANGESET"); return TCL_ERROR; } memset(&sIn, 0, sizeof(sIn)); memset(&sOut, 0, sizeof(sOut)); sIn.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); if( sIn.nStream ){ rc = sqlite3changeset_invert_strm( testStreamInput, (void*)&sIn, testStreamOutput, (void*)&sOut ); }else{ rc = sqlite3changeset_invert(sIn.nData, sIn.aData, &sOut.n, &sOut.p); |
︙ | ︙ | |||
99599699799899910001001100210031004100510061007100810091010101110121013 | static int SQLITE_TCLAPI test_sqlite3changeset_concat( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int rc; /* Return code from changeset_invert() */ TestStreamInput sLeft; /* Input stream */ TestStreamInput sRight; /* Input stream */ TestSessionsBlob sOut = {0,0}; /* Output blob */ if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "LEFT RIGHT"); return TCL_ERROR; } memset(&sLeft, 0, sizeof(sLeft)); memset(&sRight, 0, sizeof(sRight)); | >|>|> | 991992993994995996997999100010011002100310041005100610071008100910101015101610171018101910201021 | static int SQLITE_TCLAPI test_sqlite3changeset_concat( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int rc; /* Return code from changeset_invert() */ TestStreamInput sLeft; /* Input stream */ TestStreamInput sRight; /* Input stream */ TestSessionsBlob sOut = {0,0}; /* Output blob */ if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "LEFT RIGHT"); return TCL_ERROR; } memset(&sLeft, 0, sizeof(sLeft)); memset(&sRight, 0, sizeof(sRight)); sLeft.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); sRight.nStream = sLeft.nStream; if( sLeft.nStream>0 ){ rc = sqlite3changeset_concat_strm( testStreamInput, (void*)&sLeft, testStreamInput, (void*)&sRight, |
︙ | ︙ | |||
1102110311041105110611071108 | static int SQLITE_TCLAPI test_sqlite3session_foreach( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset; | | | 11011102110311041105110611071109111011111112111311141115 | static int SQLITE_TCLAPI test_sqlite3session_foreach( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset; sqlite3_changeset_iter *pIter; int rc; Tcl_Obj *pVarname; Tcl_Obj *pCS; Tcl_Obj *pScript; int isCheckNext = 0; int isInvert = 0; |
︙ | ︙ | |||
1144114511461147114811491150 | pScript = objv[3]; pChangeset = (void *)Tcl_GetByteArrayFromObj(pCS, &nChangeset); sStr.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); if( isInvert ){ int f = SQLITE_CHANGESETSTART_INVERT; if( sStr.nStream==0 ){ | |||| | 11431144114511461147114811491151115211531155115611571158116011611163116411651166116711681169 | pScript = objv[3]; pChangeset = (void *)Tcl_GetByteArrayFromObj(pCS, &nChangeset); sStr.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); if( isInvert ){ int f = SQLITE_CHANGESETSTART_INVERT; if( sStr.nStream==0 ){ }else{ void *pCtx = (void*)&sStr; sStr.aData = (unsigned char*)pChangeset; rc = sqlite3changeset_start_v2_strm(&pIter, testStreamInput, pCtx, f); } }else{ if( sStr.nStream==0 ){ }else{ sStr.aData = (unsigned char*)pChangeset; rc = sqlite3changeset_start_strm(&pIter, testStreamInput, (void*)&sStr); } } if( rc!=SQLITE_OK ){ return test_session_error(interp, rc, 0); } |
︙ | ︙ | |||
1233123412351236123712381239 | return TCL_ERROR; } assert( iSub==0 || iSub==1 || iSub==2 ); assert( rc==SQLITE_OK ); switch( iSub ){ case 0: { /* configure */ | ||>|> | 1232123312341235123612371238124012421243124412451246124712481249125012511253125412551258125912601261126212631264 | return TCL_ERROR; } assert( iSub==0 || iSub==1 || iSub==2 ); assert( rc==SQLITE_OK ); switch( iSub ){ case 0: { /* configure */ unsigned char *pRebase = Tcl_GetByteArrayFromObj(objv[2], &nRebase); break; } case 1: /* delete */ Tcl_DeleteCommand(interp, Tcl_GetString(objv[0])); break; default: { /* rebase */ TestStreamInput sStr; /* Input stream */ TestSessionsBlob sOut; /* Output blob */ memset(&sStr, 0, sizeof(sStr)); memset(&sOut, 0, sizeof(sOut)); sStr.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); if( sStr.nStream ){ rc = sqlite3rebaser_rebase_strm(p, testStreamInput, (void*)&sStr, testStreamOutput, (void*)&sOut ); |
︙ | ︙ | |||
1388138913901391139213931394 | static int SQLITE_TCLAPI test_changeset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset = 0; /* Buffer containing changeset */ | || | 138913901391139213931394139513971398139914001401140214031404140514061408140914101411141214131414 | static int SQLITE_TCLAPI test_changeset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset = 0; /* Buffer containing changeset */ int rc = SQLITE_OK; char *z = 0; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "CHANGESET"); return TCL_ERROR; } pChangeset = (void *)Tcl_GetByteArrayFromObj(objv[1], &nChangeset); Tcl_ResetResult(interp); if( rc!=SQLITE_OK ){ char *zErr = sqlite3_mprintf("(%d) - \"%s\"", rc, z); Tcl_SetObjResult(interp, Tcl_NewStringObj(zErr, -1)); sqlite3_free(zErr); } sqlite3_free(z); |
︙ | ︙ | |||
1524152515261527152815291530 | } rc = sqlite3changegroup_schema(p->pGrp, db, zDb); if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); break; }; case 1: { /* add */ | || | 152515261527152815291530153115331535153615371538153915401541 | } rc = sqlite3changegroup_schema(p->pGrp, db, zDb); if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); break; }; case 1: { /* add */ const u8 *aByte = Tcl_GetByteArrayFromObj(objv[2], &nByte); if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); break; }; case 2: { /* output */ int nByte = 0; u8 *aByte = 0; |
︙ | ︙ | |||
1674167516761677167816791680 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int isInvert = 0; void *pChangeset = 0; /* Buffer containing changeset */ | |||| | 167516761677167816791680168116831684168516861687168816891690169116931695169616971698169917001701170217031705170617071708170917101711 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int isInvert = 0; void *pChangeset = 0; /* Buffer containing changeset */ TestChangeIter *pNew = 0; sqlite3_changeset_iter *pIter = 0; int flags = 0; int rc = SQLITE_OK; static int iCmd = 1; char zCmd[64]; if( objc==3 ){ const char *z = Tcl_GetStringFromObj(objv[1], &n); } if( objc!=2 && (objc!=3 || !isInvert) ){ Tcl_WrongNumArgs(interp, 1, objv, "?-invert? CHANGESET"); return TCL_ERROR; } flags = isInvert ? SQLITE_CHANGESETSTART_INVERT : 0; pChangeset = (void *)Tcl_GetByteArrayFromObj(objv[objc-1], &nChangeset); if( rc!=SQLITE_OK ){ char *zErr = sqlite3_mprintf( "error in sqlite3changeset_start_v2() - %d", rc ); Tcl_AppendResult(interp, zErr, (char*)0); return TCL_ERROR; } |
︙ | ︙ |
Modified src/tclsqlite.cfrom [ecbc3c99]to [f4753c1c].
︙ | ︙ | |||
31323334353637 | /*** If requested, include the SQLite compiler options file for MSVC.*/#if defined(INCLUDE_MSVC_H)# include "msvc.h"#endif | <<<|<<<< | 3132333435363739404142434445 | /*** If requested, include the SQLite compiler options file for MSVC.*/#if defined(INCLUDE_MSVC_H)# include "msvc.h"#endif#include <errno.h>/*** Some additional include files are needed if this file is not** appended to the amalgamation.*/#ifndef SQLITE_AMALGAMATION |
︙ | ︙ | |||
384385386387388389390 | ClientData *hPtr){ return TCL_ERROR;}static Tcl_ChannelType IncrblobChannelType = { "incrblob", /* typeName */ | | | 377378379380381382383385386387388389390391 | ClientData *hPtr){ return TCL_ERROR;}static Tcl_ChannelType IncrblobChannelType = { "incrblob", /* typeName */ incrblobClose, /* closeProc */ incrblobInput, /* inputProc */ incrblobOutput, /* outputProc */ incrblobSeek, /* seekProc */ 0, /* setOptionProc */ 0, /* getOptionProc */ incrblobWatch, /* watchProc (this is a no-op) */ |
︙ | ︙ | |||
470471472473474475476 | */static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){ /* We could try to do something with Tcl_Parse(). But we will instead ** just do a search for forbidden characters. If any of the forbidden ** characters appear in pCmd, we will report the string as unsafe. */ const char *z; | | | 463464465466467468469471472473474475476477 | */static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){ /* We could try to do something with Tcl_Parse(). But we will instead ** just do a search for forbidden characters. If any of the forbidden ** characters appear in pCmd, we will report the string as unsafe. */ const char *z; z = Tcl_GetStringFromObj(pCmd, &n); while( n-- > 0 ){ int c = *(z++); if( c=='$' || c=='[' || c==';' ) return 0; } return 1;} |
︙ | ︙ | |||
977978979980981982983 | ** By "shallow" copy, we mean only the outer list Tcl_Obj is duplicated. ** The new Tcl_Obj contains pointers to the original list elements. ** That way, when Tcl_EvalObjv() is run and shimmers the first element ** of the list to tclCmdNameType, that alternate representation will ** be preserved and reused on the next invocation. */ Tcl_Obj **aArg; | | | 970971972973974975976978979980981982983984 | ** By "shallow" copy, we mean only the outer list Tcl_Obj is duplicated. ** The new Tcl_Obj contains pointers to the original list elements. ** That way, when Tcl_EvalObjv() is run and shimmers the first element ** of the list to tclCmdNameType, that alternate representation will ** be preserved and reused on the next invocation. */ Tcl_Obj **aArg; if( Tcl_ListObjGetElements(p->interp, p->pScript, &nArg, &aArg) ){ sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); return; } pCmd = Tcl_NewListObj(nArg, aArg); Tcl_IncrRefCount(pCmd); for(i=0; i<argc; i++){ |
︙ | ︙ | |||
1040104110421043104410451046 | Tcl_DecrRefCount(pCmd); } if( rc && rc!=TCL_RETURN ){ sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); }else{ Tcl_Obj *pVar = Tcl_GetObjResult(p->interp); | | | 10331034103510361037103810391041104210431044104510461047 | Tcl_DecrRefCount(pCmd); } if( rc && rc!=TCL_RETURN ){ sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); }else{ Tcl_Obj *pVar = Tcl_GetObjResult(p->interp); u8 *data; const char *zType = (pVar->typePtr ? pVar->typePtr->name : ""); char c = zType[0]; int eType = p->eType; if( eType==SQLITE_NULL ){ if( c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0 ){ |
︙ | ︙ | |||
1451145214531454145514561457 | rc = TCL_ERROR; break; }else{ pVar = 0; } } if( pVar ){ | |>|| | 144414451446144714481449145014521453145414551456145714581459146014611462146314641468146914701471147214731474 | rc = TCL_ERROR; break; }else{ pVar = 0; } } if( pVar ){ u8 *data; const char *zType = (pVar->typePtr ? pVar->typePtr->name : ""); c = zType[0]; if( zVar[0]=='@' || (c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0) ){ /* Load a BLOB type if the Tcl variable is a bytearray and ** it has no string representation or the host ** parameter name begins with "@". */ data = Tcl_GetByteArrayFromObj(pVar, &n); sqlite3_bind_blob(pStmt, i, data, n, SQLITE_STATIC); Tcl_IncrRefCount(pVar); pPreStmt->apParm[iParm++] = pVar; }else if( c=='b' && strcmp(zType,"boolean")==0 ){ }else if( c=='d' && strcmp(zType,"double")==0 ){ double r; Tcl_GetDoubleFromObj(interp, pVar, &r); sqlite3_bind_double(pStmt, i, r); }else if( (c=='w' && strcmp(zType,"wideInt")==0) || (c=='i' && strcmp(zType,"int")==0) ){ Tcl_WideInt v; |
︙ | ︙ | |||
2030203120322033203420352036 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zAuth ){ Tcl_AppendResult(interp, pDb->zAuth, (char*)0); } }else{ char *zAuth; | | | 20242025202620272028202920302032203320342035203620372038 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zAuth ){ Tcl_AppendResult(interp, pDb->zAuth, (char*)0); } }else{ char *zAuth; if( pDb->zAuth ){ Tcl_Free(pDb->zAuth); } zAuth = Tcl_GetStringFromObj(objv[2], &len); if( zAuth && len>0 ){ pDb->zAuth = Tcl_Alloc( len + 1 ); memcpy(pDb->zAuth, zAuth, len+1); |
︙ | ︙ | |||
2133213421352136213721382139 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBindFallback ){ Tcl_AppendResult(interp, pDb->zBindFallback, (char*)0); } }else{ char *zCallback; | | | 21272128212921302131213221332135213621372138213921402141 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBindFallback ){ Tcl_AppendResult(interp, pDb->zBindFallback, (char*)0); } }else{ char *zCallback; if( pDb->zBindFallback ){ Tcl_Free(pDb->zBindFallback); } zCallback = Tcl_GetStringFromObj(objv[2], &len); if( zCallback && len>0 ){ pDb->zBindFallback = Tcl_Alloc( len + 1 ); memcpy(pDb->zBindFallback, zCallback, len+1); |
︙ | ︙ | |||
2163216421652166216721682169 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBusy ){ Tcl_AppendResult(interp, pDb->zBusy, (char*)0); } }else{ char *zBusy; | | | 21572158215921602161216221632165216621672168216921702171 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBusy ){ Tcl_AppendResult(interp, pDb->zBusy, (char*)0); } }else{ char *zBusy; if( pDb->zBusy ){ Tcl_Free(pDb->zBusy); } zBusy = Tcl_GetStringFromObj(objv[2], &len); if( zBusy && len>0 ){ pDb->zBusy = Tcl_Alloc( len + 1 ); memcpy(pDb->zBusy, zBusy, len+1); |
︙ | ︙ | |||
2270227122722273227422752276 | ** Create a new SQL collation function called NAME. Whenever ** that function is called, invoke SCRIPT to evaluate the function. */ case DB_COLLATE: { SqlCollate *pCollate; char *zName; char *zScript; | | | 22642265226622672268226922702272227322742275227622772278 | ** Create a new SQL collation function called NAME. Whenever ** that function is called, invoke SCRIPT to evaluate the function. */ case DB_COLLATE: { SqlCollate *pCollate; char *zName; char *zScript; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 2, objv, "NAME SCRIPT"); return TCL_ERROR; } zName = Tcl_GetStringFromObj(objv[2], 0); zScript = Tcl_GetStringFromObj(objv[3], &nScript); pCollate = (SqlCollate*)Tcl_Alloc( sizeof(*pCollate) + nScript + 1 ); |
︙ | ︙ | |||
2329233023312332233323342335 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zCommit ){ Tcl_AppendResult(interp, pDb->zCommit, (char*)0); } }else{ const char *zCommit; | | | 23232324232523262327232823292331233223332334233523362337 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zCommit ){ Tcl_AppendResult(interp, pDb->zCommit, (char*)0); } }else{ const char *zCommit; if( pDb->zCommit ){ Tcl_Free(pDb->zCommit); } zCommit = Tcl_GetStringFromObj(objv[2], &len); if( zCommit && len>0 ){ pDb->zCommit = Tcl_Alloc( len + 1 ); memcpy(pDb->zCommit, zCommit, len+1); |
︙ | ︙ | |||
2649265026512652265326542655 | (char*)0); rc = TCL_ERROR;#else const char *zSchema = 0; Tcl_Obj *pValue = 0; unsigned char *pBA; unsigned char *pData; | >| | 26432644264526462647264826492652265326542655265626572658 | (char*)0); rc = TCL_ERROR;#else const char *zSchema = 0; Tcl_Obj *pValue = 0; unsigned char *pBA; unsigned char *pData; sqlite3_int64 mxSize = 0; int i; int isReadonly = 0; if( objc<3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? VALUE"); |
︙ | ︙ | |||
3020302130223023302430253026 | */ case DB_NULLVALUE: { if( objc!=2 && objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE"); return TCL_ERROR; } if( objc==3 ){ | | | 30153016301730183019302030213023302430253026302730283029 | */ case DB_NULLVALUE: { if( objc!=2 && objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE"); return TCL_ERROR; } if( objc==3 ){ char *zNull = Tcl_GetStringFromObj(objv[2], &len); if( pDb->zNull ){ Tcl_Free(pDb->zNull); } if( zNull && len>0 ){ pDb->zNull = Tcl_Alloc( len + 1 ); memcpy(pDb->zNull, zNull, len); |
︙ | ︙ | |||
3074307530763077307830793080 | Tcl_AppendResult(interp, pDb->zProgress, (char*)0); }#ifndef SQLITE_OMIT_PROGRESS_CALLBACK sqlite3_progress_handler(pDb->db, 0, 0, 0);#endif }else if( objc==4 ){ char *zProgress; | | | 30693070307130723073307430753077307830793080308130823083 | Tcl_AppendResult(interp, pDb->zProgress, (char*)0); }#ifndef SQLITE_OMIT_PROGRESS_CALLBACK sqlite3_progress_handler(pDb->db, 0, 0, 0);#endif }else if( objc==4 ){ char *zProgress; int N; if( TCL_OK!=Tcl_GetIntFromObj(interp, objv[2], &N) ){ return TCL_ERROR; }; if( pDb->zProgress ){ Tcl_Free(pDb->zProgress); } |
︙ | ︙ | |||
3120312131223123312431253126 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zProfile ){ Tcl_AppendResult(interp, pDb->zProfile, (char*)0); } }else{ char *zProfile; | | | 31153116311731183119312031213123312431253126312731283129 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zProfile ){ Tcl_AppendResult(interp, pDb->zProfile, (char*)0); } }else{ char *zProfile; if( pDb->zProfile ){ Tcl_Free(pDb->zProfile); } zProfile = Tcl_GetStringFromObj(objv[2], &len); if( zProfile && len>0 ){ pDb->zProfile = Tcl_Alloc( len + 1 ); memcpy(pDb->zProfile, zProfile, len+1); |
︙ | ︙ | |||
3331333233333334333533363337 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTrace ){ Tcl_AppendResult(interp, pDb->zTrace, (char*)0); } }else{ char *zTrace; | | | 33263327332833293330333133323334333533363337333833393340 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTrace ){ Tcl_AppendResult(interp, pDb->zTrace, (char*)0); } }else{ char *zTrace; if( pDb->zTrace ){ Tcl_Free(pDb->zTrace); } zTrace = Tcl_GetStringFromObj(objv[2], &len); if( zTrace && len>0 ){ pDb->zTrace = Tcl_Alloc( len + 1 ); memcpy(pDb->zTrace, zTrace, len+1); |
︙ | ︙ | |||
3371337233733374337533763377 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTraceV2 ){ Tcl_AppendResult(interp, pDb->zTraceV2, (char*)0); } }else{ char *zTraceV2; | | | 33663367336833693370337133723374337533763377337833793380 | return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTraceV2 ){ Tcl_AppendResult(interp, pDb->zTraceV2, (char*)0); } }else{ char *zTraceV2; Tcl_WideInt wMask = 0; if( objc==4 ){ static const char *TTYPE_strs[] = { "statement", "profile", "row", "close", 0 }; enum TTYPE_enum { TTYPE_STMT, TTYPE_PROFILE, TTYPE_ROW, TTYPE_CLOSE |
︙ | ︙ | |||
3957395839593960396139623963 | /* Because it accesses the file-system and uses persistent state, SQLite** is not considered appropriate for safe interpreters. Hence, we cause** the _SafeInit() interfaces return TCL_ERROR.*/EXTERN int Sqlite3_SafeInit(Tcl_Interp *interp){ return TCL_ERROR; }EXTERN int Sqlite3_SafeUnload(Tcl_Interp *interp, int flags){return TCL_ERROR;} | |||>>>>>||||<>> | 39523953395439553956395739583973397439753976397739783979 | /* Because it accesses the file-system and uses persistent state, SQLite** is not considered appropriate for safe interpreters. Hence, we cause** the _SafeInit() interfaces return TCL_ERROR.*/EXTERN int Sqlite3_SafeInit(Tcl_Interp *interp){ return TCL_ERROR; }EXTERN int Sqlite3_SafeUnload(Tcl_Interp *interp, int flags){return TCL_ERROR;}/*** If the TCLSH macro is defined, add code to make a stand-alone program.*/#if defined(TCLSH)/* This is the main routine for an ordinary TCL shell. If there are |
︙ | ︙ |
Added src/tclsqlite.h version [f3dc9ed1].
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
Modified src/test1.cfrom [6bd20342]to [9f01a43b].
︙ | ︙ | |||
22232425262728 | # if defined(__APPLE__)# include <sys/param.h># include <sys/sysctl.h># endif#endif#include "vdbeInt.h" | <<<|< | 2223242526272830313233343536 | # if defined(__APPLE__)# include <sys/param.h># include <sys/sysctl.h># endif#endif#include "vdbeInt.h"#include <stdlib.h>#include <string.h>/*** This is a copy of the first part of the SqliteDb structure in ** tclsqlite.c. We need it here so that the get_sqlite_pointer routine** can extract the sqlite3* pointer from an existing Tcl SQLite |
︙ | ︙ | |||
1768176917701771177217731774 | static int SQLITE_TCLAPI blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; | | | 17641765176617671768176917701772177317741775177617771778 | static int SQLITE_TCLAPI blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; z = Tcl_GetStringFromObj(pObj, &n); if( n==0 ){ *ppBlob = 0; }else{ int notUsed; Tcl_Channel channel; |
︙ | ︙ | |||
4098409941004101410241034104 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; int idx; | | | 40944095409640974098409941004102410341044105410641074108 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; int idx; int bytes; char *value; int rc; char *toFree = 0; if( objc!=5 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", |
︙ | ︙ | |||
4156415741584159416041614162 | #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; int idx; int bytes; char *value; char *toFree = 0; int rc; | | | 41524153415441554156415741584160416141624163416441654166 | #ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; int idx; int bytes; char *value; char *toFree = 0; int rc; void (*xDel)(void*) = (objc==6?SQLITE_STATIC:SQLITE_TRANSIENT); Tcl_Obj *oStmt = objv[objc-4]; Tcl_Obj *oN = objv[objc-3]; Tcl_Obj *oString = objv[objc-2]; Tcl_Obj *oBytes = objv[objc-1]; |
︙ | ︙ | |||
4210421142124213421442154216 | static int SQLITE_TCLAPI test_bind_blob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; | >| | 42064207420842094210421142124215421642174218421942204221 | static int SQLITE_TCLAPI test_bind_blob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; int bytes; char *value; int rc; sqlite3_destructor_type xDestructor = SQLITE_TRANSIENT; if( objc!=5 && objc!=6 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", |
︙ | ︙ | |||
4236423742384239424042414242 | value = (char*)Tcl_GetByteArrayFromObj(objv[3], &len); if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR; if( bytes>len ){ char zBuf[200]; sqlite3_snprintf(sizeof(zBuf), zBuf, | | | 42334234423542364237423842394241424242434244424542464247 | value = (char*)Tcl_GetByteArrayFromObj(objv[3], &len); if( Tcl_GetIntFromObj(interp, objv[4], &bytes) ) return TCL_ERROR; if( bytes>len ){ char zBuf[200]; sqlite3_snprintf(sizeof(zBuf), zBuf, Tcl_AppendResult(interp, zBuf, (char*)0); return TCL_ERROR; } rc = sqlite3_bind_blob(pStmt, idx, value, bytes, xDestructor); if( sqlite3TestErrCode(interp, StmtToDb(pStmt), rc) ) return TCL_ERROR; if( rc!=SQLITE_OK ){ |
︙ | ︙ | |||
4534453545364537453845394540 | aData = a; break; } case 4: { /* BLOB */ struct iovec *a = sqlite3_malloc( sizeof(struct iovec)*nData ); if( a==0 ){ rc = SQLITE_NOMEM; goto carray_bind_done; } for(j=0; j<nData; j++){ | || | 453145324533453445354536453745394541454245434544454545464547 | aData = a; break; } case 4: { /* BLOB */ struct iovec *a = sqlite3_malloc( sizeof(struct iovec)*nData ); if( a==0 ){ rc = SQLITE_NOMEM; goto carray_bind_done; } for(j=0; j<nData; j++){ unsigned char *v = Tcl_GetByteArrayFromObj(objv[i+i], &n); a[j].iov_base = sqlite3_malloc64( n ); if( a[j].iov_base==0 ){ a[j].iov_len = 0; }else{ memcpy(a[j].iov_base, v, n); } } |
︙ | ︙ | |||
5112511351145115511651175118 | const void *zSql; const void *zTail = 0; Tcl_Obj *pTail = 0; sqlite3_stmt *pStmt = 0; char zBuf[50]; int rc; int bytes; /* The integer specified as arg 3 */ | | | 51095110511151125113511451155117511851195120512151225123 | const void *zSql; const void *zTail = 0; Tcl_Obj *pTail = 0; sqlite3_stmt *pStmt = 0; char zBuf[50]; int rc; int bytes; /* The integer specified as arg 3 */ if( objc!=5 && objc!=4 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; |
︙ | ︙ | |||
5172517351745175517651775178 | const void *zSql; const void *zTail = 0; Tcl_Obj *pTail = 0; sqlite3_stmt *pStmt = 0; char zBuf[50]; int rc; int bytes; /* The integer specified as arg 3 */ | | | 51695170517151725173517451755177517851795180518151825183 | const void *zSql; const void *zTail = 0; Tcl_Obj *pTail = 0; sqlite3_stmt *pStmt = 0; char zBuf[50]; int rc; int bytes; /* The integer specified as arg 3 */ if( objc!=5 && objc!=4 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; |
︙ | ︙ | |||
5252525352545255525652575258 | const char *zFilename; const char *zVfs; int flags = 0; sqlite3 *db; int rc; char zBuf[100]; | || | 524952505251525252535254525552575259526052615262526352645265 | const char *zFilename; const char *zVfs; int flags = 0; sqlite3 *db; int rc; char zBuf[100]; Tcl_Obj **apFlag; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME FLAGS VFS"); return TCL_ERROR; } zFilename = Tcl_GetString(objv[1]); zVfs = Tcl_GetString(objv[3]); |
︙ | ︙ | |||
8729873087318732873387348735 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db = 0; Tcl_WideInt iOff = 0; const unsigned char *aData = 0; | || | 87268727872887298730873187328734873587368737873887398740874187428743874487458747874887498750875187528753 | Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db = 0; Tcl_WideInt iOff = 0; const unsigned char *aData = 0; sqlite3_file *pFile = 0; int rc; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "DB OFFSET DATA"); return TCL_ERROR; } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; if( Tcl_GetWideIntFromObj(interp, objv[2], &iOff) ) return TCL_ERROR; aData = Tcl_GetByteArrayFromObj(objv[3], &nData); sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, (void*)&pFile); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK;}/*** Usage: sqlite3_register_cksumvfs |
︙ | ︙ |
Modified src/test2.cfrom [54520d05]to [7ebc518e].
︙ | ︙ | |||
10111213141516 | ***************************************************************************** Code for testing the pager.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h" | <<<|< | 1011121314151618192021222324 | ***************************************************************************** Code for testing the pager.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#include <ctype.h>extern const char *sqlite3ErrName(int);/* |
︙ | ︙ |
Modified src/test3.cfrom [e5178558]to [e7573aa0].
︙ | ︙ | |||
11121314151617 | *************************************************************************** Code for testing the btree.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h"#include "btreeInt.h" | <<<|< | 1112131415161719202122232425 | *************************************************************************** Code for testing the btree.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h"#include "btreeInt.h"#include <stdlib.h>#include <string.h>extern const char *sqlite3ErrName(int);/*** A bogus sqlite3 connection structure for use in the btree |
︙ | ︙ | |||
619620621622623624625626627628629630631632633634635 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]){ BtCursor *pCur; int rc; BtreePayload x; if( objc!=4 && objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "?-intkey? CSR KEY VALUE"); return TCL_ERROR; } memset(&x, 0, sizeof(x)); if( objc==4 ){ if( Tcl_GetIntFromObj(interp, objv[2], &rc) ) return TCL_ERROR; x.nKey = rc; | >|>|| | 615616617618619620621623624625626627628629630631632635638639640641642643644 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]){ BtCursor *pCur; int rc; BtreePayload x; if( objc!=4 && objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "?-intkey? CSR KEY VALUE"); return TCL_ERROR; } memset(&x, 0, sizeof(x)); if( objc==4 ){ if( Tcl_GetIntFromObj(interp, objv[2], &rc) ) return TCL_ERROR; x.nKey = rc; }else{ } pCur = (BtCursor*)sqlite3TestTextToPtr(Tcl_GetString(objv[1])); sqlite3_mutex_enter(pCur->pBtree->db->mutex); sqlite3BtreeEnter(pCur->pBtree); rc = sqlite3BtreeInsert(pCur, &x, 0, 0); sqlite3BtreeLeave(pCur->pBtree); |
︙ | ︙ |
Modified src/test4.cfrom [4533b764]to [13e57ae7].
︙ | ︙ | |||
891011121314 | ** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** Code for testing the SQLite library in a multithreaded environment.*/#include "sqliteInt.h" | <<<|< | 89101112131416171819202122 | ** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** Code for testing the SQLite library in a multithreaded environment.*/#include "sqliteInt.h"#if SQLITE_OS_UNIX && SQLITE_THREADSAFE#include <stdlib.h>#include <string.h>#include <pthread.h>#include <sched.h>#include <ctype.h> |
︙ | ︙ |
Modified src/test5.cfrom [328aae2c]to [bb87279e].
︙ | ︙ | |||
13141516171819 | ** is not included in the SQLite library. It is used for automated** testing of the SQLite library. Specifically, the code in this file** is used for testing the SQLite routines for converting between** the various supported unicode encodings.*/#include "sqliteInt.h"#include "vdbeInt.h" | <<<|<| | 13141516171819212223242526272829303132333436373839404142 | ** is not included in the SQLite library. It is used for automated** testing of the SQLite library. Specifically, the code in this file** is used for testing the SQLite routines for converting between** the various supported unicode encodings.*/#include "sqliteInt.h"#include "vdbeInt.h"#include <stdlib.h>#include <string.h>/*** The first argument is a TCL UTF-8 string. Return the byte array** object with the encoded representation of the string, including** the NULL terminator.*/static int SQLITE_TCLAPI binarize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *bytes; Tcl_Obj *pRet; assert(objc==2); bytes = Tcl_GetStringFromObj(objv[1], &len); pRet = Tcl_NewByteArrayObj((u8*)bytes, len+1); Tcl_SetObjResult(interp, pRet); |
︙ | ︙ | |||
129130131132133134135 | Tcl_Obj *CONST objv[]){ u8 enc_from; u8 enc_to; sqlite3_value *pVal; char *z; | | | 125126127128129130131133134135136137138139 | Tcl_Obj *CONST objv[]){ u8 enc_from; u8 enc_to; sqlite3_value *pVal; char *z; void (*xDel)(void *p) = SQLITE_STATIC; if( objc!=4 && objc!=5 ){ Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetStringFromObj(objv[0], 0), " <string/blob> <from enc> <to enc>", 0 ); |
︙ | ︙ | |||
160161162163164165166 | z = sqlite3_mprintf("%s", z); } sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel); }else{ z = (char*)Tcl_GetByteArrayFromObj(objv[1], &len); if( objc==5 ){ char *zTmp = z; | | | 156157158159160161162164165166167168169170 | z = sqlite3_mprintf("%s", z); } sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel); }else{ z = (char*)Tcl_GetByteArrayFromObj(objv[1], &len); if( objc==5 ){ char *zTmp = z; memcpy(z, zTmp, len); } sqlite3ValueSetStr(pVal, -1, z, enc_from, xDel); } z = (char *)sqlite3ValueText(pVal, enc_to); len = sqlite3ValueBytes(pVal, enc_to) + (enc_to==SQLITE_UTF8?1:2); |
︙ | ︙ |
Modified src/test6.cfrom [e53bc69d]to [763b9248].
︙ | ︙ | |||
12131415161718 | **** This file contains code that modified the OS layer in order to simulate** the effect on the database file of an OS crash or power failure. This** is used to test the ability of SQLite to recover from those situations.*/#if SQLITE_TEST /* This file is used for testing only */#include "sqliteInt.h" | <<<|< | 1213141516171820212223242526 | **** This file contains code that modified the OS layer in order to simulate** the effect on the database file of an OS crash or power failure. This** is used to test the ability of SQLite to recover from those situations.*/#if SQLITE_TEST /* This file is used for testing only */#include "sqliteInt.h"#ifndef SQLITE_OMIT_DISKIO /* This file is a no-op if disk I/O is disabled *//* #define TRACE_CRASHTEST */typedef struct CrashFile CrashFile;typedef struct CrashGlobal CrashGlobal; |
︙ | ︙ | |||
747748749750751752753 | int i; int iDc = 0; int iSectorSize = 0; int setSectorsize = 0; int setDeviceChar = 0; for(i=0; i<objc; i+=2){ | | | 743744745746747748749751752753754755756757 | int i; int iDc = 0; int iSectorSize = 0; int setSectorsize = 0; int setDeviceChar = 0; for(i=0; i<objc; i+=2){ char *zOpt = Tcl_GetStringFromObj(objv[i], &nOpt); if( (nOpt>11 || nOpt<2 || strncmp("-sectorsize", zOpt, nOpt)) && (nOpt>16 || nOpt<2 || strncmp("-characteristics", zOpt, nOpt)) ){ Tcl_AppendResult(interp, "Bad option: \"", zOpt, |
︙ | ︙ | |||
772773774775776777778 | if( Tcl_GetIntFromObj(interp, objv[i+1], &iSectorSize) ){ return TCL_ERROR; } setSectorsize = 1; }else{ int j; Tcl_Obj **apObj; | || | 768769770771772773774776777778780781782783784785786 | if( Tcl_GetIntFromObj(interp, objv[i+1], &iSectorSize) ){ return TCL_ERROR; } setSectorsize = 1; }else{ int j; Tcl_Obj **apObj; if( Tcl_ListObjGetElements(interp, objv[i+1], &nObj, &apObj) ){ return TCL_ERROR; } int rc; int iChoice; Tcl_Obj *pFlag = Tcl_DuplicateObj(apObj[j]); Tcl_IncrRefCount(pFlag); Tcl_UtfToLower(Tcl_GetString(pFlag)); rc = Tcl_GetIndexFromObjStruct( |
︙ | ︙ | |||
921922923924925926927 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int iDelay; const char *zCrashFile; | >| | 917918919920921922923926927928929930931932 | void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int iDelay; const char *zCrashFile; iDc = -1; iSectorSize = -1; if( objc<3 ){ Tcl_WrongNumArgs(interp, 1, objv, "?OPTIONS? DELAY CRASHFILE"); goto error; |
︙ | ︙ |
Modified src/test8.cfrom [303c2e3b]to [206d8f3c].
︙ | ︙ | |||
10111213141516 | ***************************************************************************** Code for testing the virtual table interfaces. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h" | <<<|< | 1011121314151618192021222324 | ***************************************************************************** Code for testing the virtual table interfaces. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct echo_vtab echo_vtab;typedef struct echo_cursor echo_cursor; |
︙ | ︙ |
Modified src/test9.cfrom [12e5ba55]to [7a708ad2].
︙ | ︙ | |||
11121314151617 | ***************************************************************************** This file contains obscure tests of the C-interface required** for completeness. Test code is written in C for these cases** as there is not much point in binding to Tcl.*/#include "sqliteInt.h" | <<<|< | 1112131415161719202122232425 | ***************************************************************************** This file contains obscure tests of the C-interface required** for completeness. Test code is written in C for these cases** as there is not much point in binding to Tcl.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>/*** c_collation_test*/static int SQLITE_TCLAPI c_collation_test( |
︙ | ︙ |
Modified src/test_async.cfrom [195ab49d]to [0101173c].
︙ | ︙ | |||
10111213141516 | ******************************************************************************* This file contains a binding of the asynchronous IO extension interface** (defined in ext/async/sqlite3async.h) to Tcl.*/ | |<<<|<<<< | 1011121314151619202122232425 | ******************************************************************************* This file contains a binding of the asynchronous IO extension interface** (defined in ext/async/sqlite3async.h) to Tcl.*/#ifdef SQLITE_ENABLE_ASYNCIO#include "sqlite3async.h"#include "sqlite3.h"#include <assert.h> |
︙ | ︙ |
Modified src/test_autoext.cfrom [915d245e]to [14d4bbd3].
12345678910111213 | /*** 2006 August 23**** The author disclaims copyright to this source code. In place of** a legal notice, here is a blessing:**** May you do good and not evil.** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** Test extension for testing the sqlite3_auto_extension() function.*/ | <<<|<<<< | 1234567891011121315161718192021 | /*** 2006 August 23**** The author disclaims copyright to this source code. In place of** a legal notice, here is a blessing:**** May you do good and not evil.** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** Test extension for testing the sqlite3_auto_extension() function.*/#include "sqlite3ext.h"#ifndef SQLITE_OMIT_LOAD_EXTENSIONSQLITE_EXTENSION_INIT1/*** The sqr() SQL function returns the square of its input value. |
︙ | ︙ |
Modified src/test_backup.cfrom [bf5da90c]to [bd901e3c].
︙ | ︙ | |||
9101112131415 | ** May you share freely, never taking more than you give.***************************************************************************** This file contains test logic for the sqlite3_backup() interface.***/ | <<<|<<<< | 910111213141517181920212223 | ** May you share freely, never taking more than you give.***************************************************************************** This file contains test logic for the sqlite3_backup() interface.***/#include "sqlite3.h"#include <assert.h>/* These functions are implemented in main.c. */extern const char *sqlite3ErrName(int);/* These functions are implemented in test1.c. */ |
︙ | ︙ |
Modified src/test_bestindex.cfrom [1b5a1407]to [3401bee5].
︙ | ︙ | |||
89909192939495 | ** for the current scan. The leftmost column returned by the SELECT is assumed** to contain the rowid. Other columns must follow, in order from left to** right.*/#include "sqliteInt.h" | <<<|< | 89909192939495979899100101102103 | ** for the current scan. The leftmost column returned by the SELECT is assumed** to contain the rowid. Other columns must follow, in order from left to** right.*/#include "sqliteInt.h"#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct tcl_vtab tcl_vtab;typedef struct tcl_cursor tcl_cursor;typedef struct TestFindFunction TestFindFunction; |
︙ | ︙ | |||
348349350351352353354 | ** list object with an even number of elements. The first element of each ** pair must be one of: ** ** "sql" (SQL statement to return data) */ Tcl_Obj *pRes = Tcl_GetObjResult(interp); Tcl_Obj **apElem = 0; | || | 344345346347348349350352353354355356357359360361362363364365 | ** list object with an even number of elements. The first element of each ** pair must be one of: ** ** "sql" (SQL statement to return data) */ Tcl_Obj *pRes = Tcl_GetObjResult(interp); Tcl_Obj **apElem = 0; rc = Tcl_ListObjGetElements(interp, pRes, &nElem, &apElem); if( rc!=TCL_OK ){ const char *zErr = Tcl_GetStringResult(interp); rc = SQLITE_ERROR; pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); }else{ const char *zCmd = Tcl_GetString(apElem[ii]); Tcl_Obj *p = apElem[ii+1]; if( sqlite3_stricmp("sql", zCmd)==0 ){ const char *zSql = Tcl_GetString(p); rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); if( rc!=SQLITE_OK ){ const char *zErr = sqlite3_errmsg(pTab->db); |
︙ | ︙ | |||
660661662663664665666 | ** "use" (index of used constraint in aConstraint[]) ** "idxnum" (value of idxNum field) ** "idxstr" (value of idxStr field) ** "omit" (index of omitted constraint in aConstraint[]) */ Tcl_Obj *pRes = Tcl_GetObjResult(interp); Tcl_Obj **apElem = 0; | || | 656657658659660661662664665666667668669670671673674675676677678679 | ** "use" (index of used constraint in aConstraint[]) ** "idxnum" (value of idxNum field) ** "idxstr" (value of idxStr field) ** "omit" (index of omitted constraint in aConstraint[]) */ Tcl_Obj *pRes = Tcl_GetObjResult(interp); Tcl_Obj **apElem = 0; rc = Tcl_ListObjGetElements(interp, pRes, &nElem, &apElem); if( rc!=TCL_OK ){ const char *zErr = Tcl_GetStringResult(interp); rc = SQLITE_ERROR; pTab->base.zErrMsg = sqlite3_mprintf("%s", zErr); }else{ int ii; int iArgv = 1; const char *zCmd = Tcl_GetString(apElem[ii]); Tcl_Obj *p = apElem[ii+1]; if( sqlite3_stricmp("cost", zCmd)==0 ){ rc = Tcl_GetDoubleFromObj(interp, p, &pIdxInfo->estimatedCost); }else if( sqlite3_stricmp("orderby", zCmd)==0 ){ rc = Tcl_GetIntFromObj(interp, p, &pIdxInfo->orderByConsumed); |
︙ | ︙ |
Modified src/test_blob.cfrom [ae4a0620]to [bcdf6a6c].
︙ | ︙ | |||
891011121314 | ** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.******************************************************************************/#include "sqliteInt.h" | <<<|< | 89101112131416171819202122 | ** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.******************************************************************************/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#include <assert.h>#ifndef SQLITE_OMIT_INCRBLOB/* These functions are implemented in main.c. */extern const char *sqlite3ErrName(int); |
︙ | ︙ | |||
54555657585960 | */static int blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; | | | 5051525354555658596061626364 | */static int blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; z = Tcl_GetStringFromObj(pObj, &n); if( n==0 ){ *ppBlob = 0; }else if( n>9 && 0==memcmp("incrblob_", z, 9) ){ int notUsed; Tcl_Channel channel; |
︙ | ︙ | |||
84858687888990 | }/*** Like Tcl_GetString(), except that if the string is 0 bytes in size, a** NULL Pointer is returned.*/static char *blobStringFromObj(Tcl_Obj *pObj){ | | | 8081828384858688899091929394 | }/*** Like Tcl_GetString(), except that if the string is 0 bytes in size, a** NULL Pointer is returned.*/static char *blobStringFromObj(Tcl_Obj *pObj){ char *z; z = Tcl_GetStringFromObj(pObj, &n); return (n ? z : 0);}/*** sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME |
︙ | ︙ | |||
108109110111112113114 | sqlite3 *db; const char *zDb; const char *zTable; const char *zColumn; Tcl_WideInt iRowid; int flags; const char *zVarname; | | | 104105106107108109110112113114115116117118 | sqlite3 *db; const char *zDb; const char *zTable; const char *zColumn; Tcl_WideInt iRowid; int flags; const char *zVarname; sqlite3_blob *pBlob = (sqlite3_blob*)&flags; /* Non-zero initialization */ int rc; if( objc!=8 ){ const char *zUsage = "DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME"; Tcl_WrongNumArgs(interp, 1, objv, zUsage); |
︙ | ︙ | |||
277278279280281282283 | Tcl_Obj *CONST objv[] /* Command arguments */){ sqlite3_blob *pBlob; int iOffset; int rc; unsigned char *zBuf; | >|>|| | 273274275276277278279282283284285286287288289290291292293296297299300301302303304305 | Tcl_Obj *CONST objv[] /* Command arguments */){ sqlite3_blob *pBlob; int iOffset; int rc; unsigned char *zBuf; if( objc!=4 && objc!=5 ){ Tcl_WrongNumArgs(interp, 1, objv, "HANDLE OFFSET DATA ?NDATA?"); return TCL_ERROR; } if( blobHandleFromObj(interp, objv[1], &pBlob) ) return TCL_ERROR; if( TCL_OK!=Tcl_GetIntFromObj(interp, objv[2], &iOffset) ){ return TCL_ERROR; } zBuf = Tcl_GetByteArrayFromObj(objv[3], &nBuf); return TCL_ERROR; } if( rc!=SQLITE_OK ){ Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); } return (rc==SQLITE_OK ? TCL_OK : TCL_ERROR);}#endif /* SQLITE_OMIT_INCRBLOB */ |
︙ | ︙ |
Modified src/test_btree.cfrom [8b2dc8b8]to [28283787].
︙ | ︙ | |||
10111213141516 | ***************************************************************************** Code for testing the btree.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "btreeInt.h" | <<<|< | 1011121314151618192021222324 | ***************************************************************************** Code for testing the btree.c module in SQLite. This code** is not included in the SQLite library. It is used for automated** testing of the SQLite library.*/#include "btreeInt.h"/*** Usage: sqlite3_shared_cache_report**** Return a list of file that are shared and the number of** references to each file.*/ |
︙ | ︙ |
Modified src/test_config.cfrom [5fa77ee6]to [46eaf398].
︙ | ︙ | |||
20212223242526 | #include "sqliteLimit.h"#include "sqliteInt.h"#if SQLITE_OS_WIN# include "os_win.h"#endif | <<<|< | 2021222324252628293031323334 | #include "sqliteLimit.h"#include "sqliteInt.h"#if SQLITE_OS_WIN# include "os_win.h"#endif#include <stdlib.h>#include <string.h>/*** Macro to stringify the results of the evaluation a pre-processor** macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7".*/ |
︙ | ︙ |
Modified src/test_demovfs.cfrom [38a459d1]to [3efa2adf].
︙ | ︙ | |||
641642643644645646647 | }#endif /* !defined(SQLITE_TEST) || SQLITE_OS_UNIX */#ifdef SQLITE_TEST | <<<|<<<< | 641642643644645646647649650651652653654655 | }#endif /* !defined(SQLITE_TEST) || SQLITE_OS_UNIX */#ifdef SQLITE_TEST#if SQLITE_OS_UNIXstatic int SQLITE_TCLAPI register_demovfs( ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int objc, /* Number of arguments */ Tcl_Obj *CONST objv[] /* Command arguments */ |
︙ | ︙ |
Modified src/test_fs.cfrom [56cc17e4]to [c411c40b].
︙ | ︙ | |||
58596061626364 | ** contents of the file-system, starting at "/". To restrict the search** space, the virtual table supports LIKE and GLOB constraints on the** 'path' column. For example:**** SELECT * FROM fstree WHERE path LIKE '/home/dan/sqlite/%'*/#include "sqliteInt.h" | <<<|<< | 5859606162636466676869707172 | ** contents of the file-system, starting at "/". To restrict the search** space, the virtual table supports LIKE and GLOB constraints on the** 'path' column. For example:**** SELECT * FROM fstree WHERE path LIKE '/home/dan/sqlite/%'*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#if SQLITE_OS_UNIX || defined(__MINGW_H) |
︙ | ︙ |
Modified src/test_func.cfrom [4d2dc7e3]to [8c0e8919].
︙ | ︙ | |||
9101112131415 | ** May you share freely, never taking more than you give.***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** implements new SQL functions used by the test scripts.*/#include "sqlite3.h" | <<<|< | 910111213141517181920212223 | ** May you share freely, never taking more than you give.***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** implements new SQL functions used by the test scripts.*/#include "sqlite3.h"#include <stdlib.h>#include <string.h>#include <assert.h>#include "sqliteInt.h"#include "vdbeInt.h" |
︙ | ︙ |
Modified src/test_hexio.cfrom [9478e56a]to [af6db930].
︙ | ︙ | |||
14151617181920 | ** database files and displaying the content of those files as** hexadecimal. We could, in theory, use the built-in "binary"** command of TCL to do a lot of this, but there are some issues** with historical versions of the "binary" command. So it seems** easier and safer to build our own mechanism.*/#include "sqliteInt.h" | <<<|< | 1415161718192022232425262728 | ** database files and displaying the content of those files as** hexadecimal. We could, in theory, use the built-in "binary"** command of TCL to do a lot of this, but there are some issues** with historical versions of the "binary" command. So it seems** easier and safer to build our own mechanism.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#include <assert.h>/*** Convert binary to hex. The input zBuf[] contains N bytes of |
︙ | ︙ | |||
151152153154155156157 | static int SQLITE_TCLAPI hexio_write( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int offset; | >||| | 147148149150151152153156157158159160161162163164165166167169170171173174175176177178179 | static int SQLITE_TCLAPI hexio_write( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int offset; const char *zFile; const unsigned char *zIn; unsigned char *aOut; FILE *out; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME OFFSET HEXDATA"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[2], &offset) ) return TCL_ERROR; zFile = Tcl_GetString(objv[1]); zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[3], &nIn); if( aOut==0 ){ return TCL_ERROR; } out = fopen(zFile, "r+b"); if( out==0 ){ out = fopen(zFile, "r+"); } if( out==0 ){ Tcl_AppendResult(interp, "cannot open output file ", zFile, 0); return TCL_ERROR; |
︙ | ︙ | |||
199200201202203204205 | static int SQLITE_TCLAPI hexio_get_int( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int val; | >||| | 196197198199200201202205206207208209210211212213215216217219220221222223224225 | static int SQLITE_TCLAPI hexio_get_int( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int val; const unsigned char *zIn; unsigned char *aOut; unsigned char aNum[4]; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HEXDATA"); return TCL_ERROR; } zIn = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &nIn); if( aOut==0 ){ return TCL_ERROR; } if( nOut>=4 ){ memcpy(aNum, aOut, 4); }else{ memset(aNum, 0, sizeof(aNum)); memcpy(&aNum[4-nOut], aOut, nOut); } sqlite3_free(aOut); |
︙ | ︙ | |||
296297298299300301302 | static int SQLITE_TCLAPI utf8_to_utf8( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){#ifdef SQLITE_DEBUG | ||| | 294295296297298299300302303304305306307308309312313314315316317318 | static int SQLITE_TCLAPI utf8_to_utf8( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){#ifdef SQLITE_DEBUG int nOut; const unsigned char *zOrig; unsigned char *z; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "HEX"); return TCL_ERROR; } zOrig = (unsigned char *)Tcl_GetStringFromObj(objv[1], &n); z[n] = 0; nOut = sqlite3Utf8To8(z); sqlite3TestBinToHex(z,nOut); Tcl_AppendResult(interp, (char*)z, 0); sqlite3_free(z); return TCL_OK;#else |
︙ | ︙ | |||
357358359360361362363 | */static int SQLITE_TCLAPI read_fts3varint( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ | | | 355356357358359360361363364365366367368369 | */static int SQLITE_TCLAPI read_fts3varint( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ unsigned char *zBlob; sqlite3_int64 iVal; int nVal; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "BLOB VARNAME"); return TCL_ERROR; |
︙ | ︙ | |||
384385386387388389390 | static int SQLITE_TCLAPI make_fts3record( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ Tcl_Obj **aArg = 0; | ||||||| | 382383384385386387388390393394395396397398399400401402404405406407408409410411412413414415416417419420423424425426427428429 | static int SQLITE_TCLAPI make_fts3record( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ Tcl_Obj **aArg = 0; unsigned char *aOut = 0; int i; if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "LIST"); return TCL_ERROR; } if( Tcl_ListObjGetElements(interp, objv[1], &nArg, &aArg) ){ return TCL_ERROR; } sqlite3_int64 iVal; if( TCL_OK==Tcl_GetWideIntFromObj(0, aArg[i], &iVal) ){ if( nOut+10>nAlloc ){ int nNew = nAlloc?nAlloc*2:128; unsigned char *aNew = sqlite3_realloc(aOut, nNew); if( aNew==0 ){ sqlite3_free(aOut); return TCL_ERROR; } aOut = aNew; nAlloc = nNew; } nOut += putFts3Varint((char*)&aOut[nOut], iVal); }else{ char *zVal = Tcl_GetStringFromObj(aArg[i], &nVal); while( (nOut + nVal)>nAlloc ){ if( aNew==0 ){ sqlite3_free(aOut); return TCL_ERROR; } aOut = aNew; nAlloc = nNew; } |
︙ | ︙ |
Modified src/test_init.cfrom [f2cc4774]to [17313332].
︙ | ︙ | |||
23242526272829 | ** of those subsystems that were initialized, and** 3) A subsequent call to sqlite3_initialize() attempts to initialize** the remaining, uninitialized, subsystems.*/#include "sqliteInt.h"#include <string.h> | <<<|< | 2324252627282931323334353637 | ** of those subsystems that were initialized, and** 3) A subsequent call to sqlite3_initialize() attempts to initialize** the remaining, uninitialized, subsystems.*/#include "sqliteInt.h"#include <string.h>static struct Wrapped { sqlite3_pcache_methods2 pcache; sqlite3_mem_methods mem; sqlite3_mutex_methods mutex; int mem_init; /* True if mem subsystem is initialized */ |
︙ | ︙ |
Modified src/test_intarray.cfrom [26ffba66]to [e4216aad].
︙ | ︙ | |||
275276277278279280281 | }/******************************************************************************* Everything below is interface for testing this module.*/#ifdef SQLITE_TEST | <<<|<<<< | 275276277278279280281283284285286287288289 | }/******************************************************************************* Everything below is interface for testing this module.*/#ifdef SQLITE_TEST/*** Routines to encode and decode pointers*/extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);extern void *sqlite3TestTextToPtr(const char*);extern int sqlite3TestMakePointerStr(Tcl_Interp*, char *zPtr, void*); |
︙ | ︙ |
Modified src/test_malloc.cfrom [21121ea8]to [a0295e02].
︙ | ︙ | |||
10111213141516 | ******************************************************************************* This file contains code used to implement test interfaces to the** memory allocation subsystem.*/#include "sqliteInt.h" | <<<|< | 1011121314151618192021222324 | ******************************************************************************* This file contains code used to implement test interfaces to the** memory allocation subsystem.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#include <assert.h>/*** This structure is used to encapsulate the global state variables used ** by malloc() fault simulation. |
︙ | ︙ | |||
383384385386387388389 | static int SQLITE_TCLAPI test_memset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *p; | |> | 379380381382383384385388389390391392393394 | static int SQLITE_TCLAPI test_memset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *p; char *zHex; char *zOut; char zBin[100]; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "ADDRESS SIZE HEX"); return TCL_ERROR; |
︙ | ︙ | |||
405406407408409410411 | } if( size<=0 ){ Tcl_AppendResult(interp, "size must be positive", (char*)0); return TCL_ERROR; } zHex = Tcl_GetStringFromObj(objv[3], &n); if( n>sizeof(zBin)*2 ) n = sizeof(zBin)*2; | | | 402403404405406407408410411412413414415416 | } if( size<=0 ){ Tcl_AppendResult(interp, "size must be positive", (char*)0); return TCL_ERROR; } zHex = Tcl_GetStringFromObj(objv[3], &n); if( n>sizeof(zBin)*2 ) n = sizeof(zBin)*2; if( n==0 ){ Tcl_AppendResult(interp, "no data", (char*)0); return TCL_ERROR; } zOut = p; for(i=0; i<size; i++){ zOut[i] = zBin[i%n]; |
︙ | ︙ | |||
620621622623624625626 | if( objc<2 ){ Tcl_WrongNumArgs(interp, 1, objv, "COUNTER ?OPTIONS?"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[1], &iFail) ) return TCL_ERROR; for(ii=2; ii<objc; ii+=2){ | | | 617618619620621622623625626627628629630631 | if( objc<2 ){ Tcl_WrongNumArgs(interp, 1, objv, "COUNTER ?OPTIONS?"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[1], &iFail) ) return TCL_ERROR; for(ii=2; ii<objc; ii+=2){ char *zOption = Tcl_GetStringFromObj(objv[ii], &nOption); char *zErr = 0; if( nOption>1 && strncmp(zOption, "-repeat", nOption)==0 ){ if( ii==(objc-1) ){ zErr = "option requires an argument: "; }else{ |
︙ | ︙ |
Modified src/test_md5.cfrom [0472c86d]to [811a4533].
︙ | ︙ | |||
12131415161718 | **** This file contains code to implement an MD5 extension to TCL.*/#include "sqlite3.h"#include <stdlib.h>#include <string.h>#include "sqlite3.h" | <<<|<<<< | 1213141516171820212223242526 | **** This file contains code to implement an MD5 extension to TCL.*/#include "sqlite3.h"#include <stdlib.h>#include <string.h>#include "sqlite3.h"/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * |
︙ | ︙ |
Modified src/test_multiplex.cfrom [70479161]to [b99d7f43].
︙ | ︙ | |||
1215121612171218121912201221 | sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TEST | <<<|<<<< | 12151216121712181219122012211223122412251226122712281229 | sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TESTextern const char *sqlite3ErrName(int);/*** tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT*/static int SQLITE_TCLAPI test_multiplex_initialize( |
︙ | ︙ |
Modified src/test_mutex.cfrom [cd5bac43]to [f10fcbc2].
12345678910111213 | /*** 2008 June 18**** The author disclaims copyright to this source code. In place of** a legal notice, here is a blessing:**** May you do good and not evil.** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** This file contains test logic for the sqlite3_mutex interfaces.*/ | <<<<|< | 1234567891011121315161718192021 | /*** 2008 June 18**** The author disclaims copyright to this source code. In place of** a legal notice, here is a blessing:**** May you do good and not evil.** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.***************************************************************************** This file contains test logic for the sqlite3_mutex interfaces.*/#include "sqlite3.h"#include "sqliteInt.h"#include <stdlib.h>#include <assert.h>#include <string.h>#define MAX_MUTEXES (SQLITE_MUTEX_STATIC_VFS3+1) |
︙ | ︙ |
Modified src/test_osinst.cfrom [8e11faf1]to [7aa3feaa].
︙ | ︙ | |||
1105110611071108110911101111 | /******************************************************************************************************************************************************* Tcl interface starts here.*/#if defined(SQLITE_TEST) || defined(TCLSH) | <<<|<<<< | 11051106110711081109111011111113111411151116111711181119 | /******************************************************************************************************************************************************* Tcl interface starts here.*/#if defined(SQLITE_TEST) || defined(TCLSH)static int SQLITE_TCLAPI test_vfslog( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ |
︙ | ︙ |
Modified src/test_quota.cfrom [ea44c05f]to [07369655].
︙ | ︙ | |||
1274127512761277127812791280 | quotaLeave(); sqlite3_free(zFull); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TEST | <<<|<<<< | 12741275127612771278127912801282128312841285128612871288 | quotaLeave(); sqlite3_free(zFull); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TEST/*** Argument passed to a TCL quota-over-limit callback.*/typedef struct TclQuotaCallback TclQuotaCallback;struct TclQuotaCallback { Tcl_Interp *interp; /* Interpreter in which to run the script */ |
︙ | ︙ | |||
1416141714181419142014211422 | Tcl_Obj *CONST objv[]){ const char *zPattern; /* File pattern to configure */ Tcl_WideInt iLimit; /* Initial quota in bytes */ Tcl_Obj *pScript; /* Tcl script to invoke to increase quota */ int rc; /* Value returned by quota_set() */ TclQuotaCallback *p; /* Callback object */ | | | 14091410141114121413141414151417141814191420142114221423 | Tcl_Obj *CONST objv[]){ const char *zPattern; /* File pattern to configure */ Tcl_WideInt iLimit; /* Initial quota in bytes */ Tcl_Obj *pScript; /* Tcl script to invoke to increase quota */ int rc; /* Value returned by quota_set() */ TclQuotaCallback *p; /* Callback object */ void (*xDestroy)(void*); /* Optional destructor for pArg */ void (*xCallback)(const char *, sqlite3_int64 *, sqlite3_int64, void *); /* Process arguments */ if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "PATTERN LIMIT SCRIPT"); return TCL_ERROR; |
︙ | ︙ |
Modified src/test_rtree.cfrom [671f3fae]to [d844d746].
︙ | ︙ | |||
10111213141516 | ***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h" | <<<|< | 1011121314151618192021222324 | ***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"/* Solely for the UNUSED_PARAMETER() macro. */#include "sqliteInt.h"#ifdef SQLITE_ENABLE_RTREE/* ** Type used to cache parameter information for the "circle" r-tree geometry |
︙ | ︙ | |||
353354355356357358359 | }/* END of implementation of "circle" geometry callback.***************************************************************************************************************************************************/#include <assert.h> | <<<|< | 349350351352353354355357358359360361362363 | }/* END of implementation of "circle" geometry callback.***************************************************************************************************************************************************/#include <assert.h>typedef struct Cube Cube;struct Cube { double x; double y; double z; double width; |
︙ | ︙ |
Modified src/test_schema.cfrom [cbfd7a9a]to [b06d3ddc].
︙ | ︙ | |||
32333435363738 | /* If SQLITE_TEST is defined this code is preprocessed for use as part** of the sqlite test binary "testfixture". Otherwise it is preprocessed** to be compiled into an sqlite dynamic extension.*/#ifdef SQLITE_TEST# include "sqliteInt.h" | <<<|< | 3233343536373840414243444546 | /* If SQLITE_TEST is defined this code is preprocessed for use as part** of the sqlite test binary "testfixture". Otherwise it is preprocessed** to be compiled into an sqlite dynamic extension.*/#ifdef SQLITE_TEST# include "sqliteInt.h"#else# include "sqlite3ext.h" SQLITE_EXTENSION_INIT1#endif#include <stdlib.h>#include <string.h> |
︙ | ︙ |
Modified src/test_superlock.cfrom [4839644b]to [18355ca2].
︙ | ︙ | |||
252253254255256257258 | *****************************************************************************************************************************************************************************************************************************/#ifdef SQLITE_TEST | <<<|<<<< | 252253254255256257258260261262263264265266 | *****************************************************************************************************************************************************************************************************************************/#ifdef SQLITE_TESTstruct InterpAndScript { Tcl_Interp *interp; Tcl_Obj *pScript;};typedef struct InterpAndScript InterpAndScript; |
︙ | ︙ |
Modified src/test_syscall.cfrom [9fdb13b1]to [9ad7ab39].
︙ | ︙ | |||
72737475767778 | ** If PGSZ is a power of two greater than 256, install a wrapper around** OS function getpagesize() that reports the system page size as PGSZ.** Or, if PGSZ is less than zero, remove any wrapper already installed.*/#include "sqliteInt.h"#include "sqlite3.h" | <<<|< | 7273747576777880818283848586 | ** If PGSZ is a power of two greater than 256, install a wrapper around** OS function getpagesize() that reports the system page size as PGSZ.** Or, if PGSZ is less than zero, remove any wrapper already installed.*/#include "sqliteInt.h"#include "sqlite3.h"#include <stdlib.h>#include <string.h>#include <assert.h>#if SQLITE_OS_UNIX/* From main.c */ |
︙ | ︙ | |||
193194195196197198199 | **** Usually, the current error-number is the value that errno should be set** to if the named system call fails. The exception is "fallocate". See ** comments above the implementation of ts_fallocate() for details.*/static int tsErrno(const char *zFunc){ int i; | | | 189190191192193194195197198199200201202203 | **** Usually, the current error-number is the value that errno should be set** to if the named system call fails. The exception is "fallocate". See ** comments above the implementation of ts_fallocate() for details.*/static int tsErrno(const char *zFunc){ int i; for(i=0; aSyscall[i].zName; i++){ if( strlen(aSyscall[i].zName)!=nFunc ) continue; if( memcmp(aSyscall[i].zName, zFunc, nFunc) ) continue; return aSyscall[i].custom_errno; } assert(0); |
︙ | ︙ | |||
425426427428429430431 | static int SQLITE_TCLAPI test_syscall_install( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_vfs *pVfs; | || | 421422423424425426427429430431432433434435436437438439440442443444445446447448 | static int SQLITE_TCLAPI test_syscall_install( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_vfs *pVfs; int i; Tcl_Obj **apElem; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "SYSCALL-LIST"); return TCL_ERROR; } if( Tcl_ListObjGetElements(interp, objv[2], &nElem, &apElem) ){ return TCL_ERROR; } pVfs = sqlite3_vfs_find(0); int iCall; int rc = Tcl_GetIndexFromObjStruct(interp, apElem[i], aSyscall, sizeof(aSyscall[0]), "system-call", 0, &iCall ); if( rc ) return rc; if( aSyscall[iCall].xOrig==0 ){ aSyscall[iCall].xOrig = pVfs->xGetSystemCall(pVfs, aSyscall[iCall].zName); |
︙ | ︙ | |||
498499500501502503504 | } pVfs = sqlite3_vfs_find(0); if( objc==2 ){ rc = pVfs->xSetSystemCall(pVfs, 0, 0); for(i=0; aSyscall[i].zName; i++) aSyscall[i].xOrig = 0; }else{ | | | 494495496497498499500502503504505506507508 | } pVfs = sqlite3_vfs_find(0); if( objc==2 ){ rc = pVfs->xSetSystemCall(pVfs, 0, 0); for(i=0; aSyscall[i].zName; i++) aSyscall[i].xOrig = 0; }else{ char *zFunc = Tcl_GetStringFromObj(objv[2], &nFunc); rc = pVfs->xSetSystemCall(pVfs, Tcl_GetString(objv[2]), 0); for(i=0; rc==SQLITE_OK && aSyscall[i].zName; i++){ if( strlen(aSyscall[i].zName)!=nFunc ) continue; if( memcmp(aSyscall[i].zName, zFunc, nFunc) ) continue; aSyscall[i].xOrig = 0; } |
︙ | ︙ |
Modified src/test_tclsh.cfrom [aaf0d1de]to [6077f2bd].
︙ | ︙ | |||
16171819202122 | ** "testfixture.exe") using logic encoded by this file.**** The code in this file used to be found in tclsqlite3.c, contained within** #if SQLITE_TEST ... #endif. It is factored out into this separate module** in an effort to keep the tclsqlite.c file pure.*/#include "sqlite3.h" | <<<|<<<< | 1617181920212224252627282930 | ** "testfixture.exe") using logic encoded by this file.**** The code in this file used to be found in tclsqlite3.c, contained within** #if SQLITE_TEST ... #endif. It is factored out into this separate module** in an effort to keep the tclsqlite.c file pure.*/#include "sqlite3.h"/* Needed for the setrlimit() system call on unix */#if defined(unix)#include <sys/resource.h>#endif/* Forward declaration */ |
︙ | ︙ |
Modified src/test_tclvar.cfrom [3273f9d5]to [2c42fe9a].
︙ | ︙ | |||
32333435363738 | **** For SELECT operations, the "name" and "arrayname" fields will always** match the "fullname" field. For DELETE, INSERT, and UPDATE, the** "name" and "arrayname" fields are ignored and the variable is modified** according to "fullname" and "value" only.*/#include "sqliteInt.h" | <<<|< | 3233343536373840414243444546 | **** For SELECT operations, the "name" and "arrayname" fields will always** match the "fullname" field. For DELETE, INSERT, and UPDATE, the** "name" and "arrayname" fields are ignored and the variable is modified** according to "fullname" and "value" only.*/#include "sqliteInt.h"#include <stdlib.h>#include <string.h>#ifndef SQLITE_OMIT_VIRTUALTABLE/*** Characters that make up the idxStr created by xBestIndex for xFilter. |
︙ | ︙ | |||
146147148149150151152 | Tcl_ListObjAppendElement(0, p, pObj); Tcl_EvalObjEx(interp, p, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(p); pCur->pList2 = Tcl_GetObjResult(interp); Tcl_IncrRefCount(pCur->pList2); assert( pCur->i2==0 ); }else{ | |||| | 142143144145146147148150151153154155156157158159160161162163164165167168169170171172174175176177178179180 | Tcl_ListObjAppendElement(0, p, pObj); Tcl_EvalObjEx(interp, p, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(p); pCur->pList2 = Tcl_GetObjResult(interp); Tcl_IncrRefCount(pCur->pList2); assert( pCur->i2==0 ); }else{ pCur->i2++; Tcl_ListObjLength(0, pCur->pList2, &n); Tcl_DecrRefCount(pCur->pList2); pCur->pList2 = 0; pCur->i2 = 0; return 0; } } } return 1;}static int tclvarNext(sqlite3_vtab_cursor *cur){ Tcl_Obj *pObj; int ok = 0; tclvar_cursor *pCur = (tclvar_cursor *)cur; Tcl_Interp *interp = ((tclvar_vtab *)(cur->pVtab))->interp; Tcl_ListObjLength(0, pCur->pList1, &n); Tcl_ListObjIndex(0, pCur->pList1, pCur->i1, &pObj); ok = next2(interp, pCur, pObj); if( !ok ){ pCur->i1++; } } |
︙ | ︙ |
Modified src/test_thread.cfrom [7ddcf0c8]to [d7a8bcea].
︙ | ︙ | |||
12131415161718 | **** This file contains the implementation of some Tcl commands used to** test that sqlite3 database handles may be concurrently accessed by ** multiple threads. Right now this only works on unix.*/#include "sqliteInt.h" | <<<|< | 1213141516171820212223242526 | **** This file contains the implementation of some Tcl commands used to** test that sqlite3 database handles may be concurrently accessed by ** multiple threads. Right now this only works on unix.*/#include "sqliteInt.h"#if SQLITE_THREADSAFE#include <errno.h>#if !defined(_MSC_VER)#include <unistd.h> |
︙ | ︙ | |||
90919293949596 | /*** Register an EvalEvent to evaluate the script pScript in the** parent interpreter/thread of SqlThread p.*/static void postToParent(SqlThread *p, Tcl_Obj *pScript){ EvalEvent *pEvent; char *zMsg; | | | 86878889909192949596979899100 | /*** Register an EvalEvent to evaluate the script pScript in the** parent interpreter/thread of SqlThread p.*/static void postToParent(SqlThread *p, Tcl_Obj *pScript){ EvalEvent *pEvent; char *zMsg; zMsg = Tcl_GetStringFromObj(pScript, &nMsg); pEvent = (EvalEvent *)ckalloc(sizeof(EvalEvent)+nMsg+1); pEvent->base.nextPtr = 0; pEvent->base.proc = tclScriptEvent; pEvent->zScript = (char *)&pEvent[1]; memcpy(pEvent->zScript, zMsg, nMsg+1); |
︙ | ︙ | |||
177178179180181182183 | int objc, Tcl_Obj *CONST objv[]){ Tcl_ThreadId x; SqlThread *pNew; int rc; | || | 173174175176177178179182183184185186187188 | int objc, Tcl_Obj *CONST objv[]){ Tcl_ThreadId x; SqlThread *pNew; int rc; /* Parameters for thread creation */ const int nStack = TCL_THREAD_STACK_DEFAULT; const int flags = TCL_THREAD_NOFLAGS; assert(objc==4); UNUSED_PARAMETER(clientData); |
︙ | ︙ | |||
228229230231232233234 | ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ EvalEvent *pEvent; char *zMsg; | | | 224225226227228229230232233234235236237238 | ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ EvalEvent *pEvent; char *zMsg; SqlThread *p = (SqlThread *)clientData; assert(objc==3); UNUSED_PARAMETER(objc); if( p==0 ){ Tcl_AppendResult(interp, "no parent thread", 0); |
︙ | ︙ |
Modified src/test_vdbecov.cfrom [f60c6f13]to [5c426d9c].
︙ | ︙ | |||
11121314151617 | *********************************************************************************/#if SQLITE_TEST /* This file is used for testing only */#include "sqlite3.h"#include "sqliteInt.h" | <<<|< | 1112131415161719202122232425 | *********************************************************************************/#if SQLITE_TEST /* This file is used for testing only */#include "sqlite3.h"#include "sqliteInt.h"#ifdef SQLITE_VDBE_COVERAGEstatic u8 aBranchArray[200000];static void test_vdbe_branch( void *pCtx, |
︙ | ︙ |
Modified src/test_vfs.cfrom [193c18da]to [f298475e].
︙ | ︙ | |||
24252627282930 | ** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname)** -iversion INTEGER (Value for sqlite3_vfs.iVersion)*/#if SQLITE_TEST /* This file is used for testing only */#include "sqlite3.h"#include "sqliteInt.h" | <<<|< | 2425262728293032333435363738 | ** -mxpathname INTEGER (Value for sqlite3_vfs.mxPathname)** -iversion INTEGER (Value for sqlite3_vfs.iVersion)*/#if SQLITE_TEST /* This file is used for testing only */#include "sqlite3.h"#include "sqliteInt.h"typedef struct Testvfs Testvfs;typedef struct TestvfsShm TestvfsShm;typedef struct TestvfsBuffer TestvfsBuffer;typedef struct TestvfsFile TestvfsFile;typedef struct TestvfsFd TestvfsFd; |
︙ | ︙ | |||
1146114711481149115011511152 | } ckfree(zName); if( !pBuffer ){ Tcl_AppendResult(interp, "no such file: ", Tcl_GetString(objv[2]), 0); return TCL_ERROR; } if( objc==4 ){ | ||| | 11421143114411451146114711481150115111521154115511561158115911601161116211631164 | } ckfree(zName); if( !pBuffer ){ Tcl_AppendResult(interp, "no such file: ", Tcl_GetString(objv[2]), 0); return TCL_ERROR; } if( objc==4 ){ u8 *a = Tcl_GetByteArrayFromObj(objv[3], &n); int pgsz = pBuffer->pgsz; if( pgsz==0 ) pgsz = 65536; int nByte = pgsz; tvfsAllocPage(pBuffer, i, pgsz); if( n-i*pgsz<pgsz ){ } memcpy(pBuffer->aPage[i], &a[i*pgsz], nByte); } } pObj = Tcl_NewObj(); for(i=0; pBuffer->aPage[i]; i++){ |
︙ | ︙ | |||
1199120012011202120312041205 | { "xFullPathname", TESTVFS_FULLPATHNAME_MASK }, { "xUnlock", TESTVFS_UNLOCK_MASK }, { "xLock", TESTVFS_LOCK_MASK }, { "xCheckReservedLock", TESTVFS_CKLOCK_MASK }, { "xFileControl", TESTVFS_FCNTL_MASK }, }; Tcl_Obj **apElem = 0; | || | 11951196119711981199120012011203120412051206120712081209121012111213121412151216121712181219 | { "xFullPathname", TESTVFS_FULLPATHNAME_MASK }, { "xUnlock", TESTVFS_UNLOCK_MASK }, { "xLock", TESTVFS_LOCK_MASK }, { "xCheckReservedLock", TESTVFS_CKLOCK_MASK }, { "xFileControl", TESTVFS_FCNTL_MASK }, }; Tcl_Obj **apElem = 0; int mask = 0; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "LIST"); return TCL_ERROR; } if( Tcl_ListObjGetElements(interp, objv[2], &nElem, &apElem) ){ return TCL_ERROR; } Tcl_ResetResult(interp); int iMethod; char *zElem = Tcl_GetString(apElem[i]); for(iMethod=0; iMethod<ArraySize(vfsmethod); iMethod++){ if( strcmp(zElem, vfsmethod[iMethod].zName)==0 ){ mask |= vfsmethod[iMethod].mask; break; } |
︙ | ︙ | |||
1235123612371238123912401241 | ** TESTVFS script ?SCRIPT? ** ** Query or set the script to be run when filtered VFS events ** occur. */ case CMD_SCRIPT: { if( objc==3 ){ | | | 12311232123312341235123612371239124012411242124312441245 | ** TESTVFS script ?SCRIPT? ** ** Query or set the script to be run when filtered VFS events ** occur. */ case CMD_SCRIPT: { if( objc==3 ){ if( p->pScript ){ Tcl_DecrRefCount(p->pScript); p->pScript = 0; } Tcl_GetStringFromObj(objv[2], &nByte); if( nByte>0 ){ p->pScript = Tcl_DuplicateObj(objv[2]); |
︙ | ︙ | |||
1333133413351336133713381339 | Tcl_WrongNumArgs(interp, 2, objv, "?ATTR-LIST?"); return TCL_ERROR; } if( objc==3 ){ int j; int iNew = 0; Tcl_Obj **flags = 0; | || | 1329133013311332133313341335133713381339134013411343134413451346134713481349 | Tcl_WrongNumArgs(interp, 2, objv, "?ATTR-LIST?"); return TCL_ERROR; } if( objc==3 ){ int j; int iNew = 0; Tcl_Obj **flags = 0; if( Tcl_ListObjGetElements(interp, objv[2], &nFlags, &flags) ){ return TCL_ERROR; } int idx = 0; if( Tcl_GetIndexFromObjStruct(interp, flags[j], aFlag, sizeof(aFlag[0]), "flag", 0, &idx) ){ return TCL_ERROR; } if( aFlag[idx].iValue<0 && nFlags>1 ){ |
︙ | ︙ | |||
1487148814891490149114921493 | int isDefault = 0; /* True if -default is passed */ int szOsFile = 0; /* Value passed to -szosfile */ int mxPathname = -1; /* Value passed to -mxpathname */ int iVersion = 3; /* Value passed to -iversion */ if( objc<2 || 0!=(objc%2) ) goto bad_args; for(i=2; i<objc; i += 2){ | | | 14831484148514861487148814891491149214931494149514961497 | int isDefault = 0; /* True if -default is passed */ int szOsFile = 0; /* Value passed to -szosfile */ int mxPathname = -1; /* Value passed to -mxpathname */ int iVersion = 3; /* Value passed to -iversion */ if( objc<2 || 0!=(objc%2) ) goto bad_args; for(i=2; i<objc; i += 2){ char *zSwitch; zSwitch = Tcl_GetStringFromObj(objv[i], &nSwitch); if( nSwitch>2 && 0==strncmp("-noshm", zSwitch, nSwitch) ){ if( Tcl_GetBooleanFromObj(interp, objv[i+1], &isNoshm) ){ return TCL_ERROR; } |
︙ | ︙ |
Modified src/test_window.cfrom [cdae419f]to [6d80e11f].
︙ | ︙ | |||
12131415161718 | */#include "sqlite3.h"#ifdef SQLITE_TEST#include "sqliteInt.h" | | | 1213141516171820212223242526 | */#include "sqlite3.h"#ifdef SQLITE_TEST#include "sqliteInt.h"extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);extern const char *sqlite3ErrName(int);typedef struct TestWindow TestWindow;struct TestWindow { Tcl_Obj *xStep; |
︙ | ︙ |
Modified tool/mkmsvcmin.tclfrom [8897d515]to [d76c45ef].
︙ | ︙ | |||
19202122232425 | if {[file exists $toFileName]} { error "output file \"$toFileName\" already exists" }}proc readFile { fileName } { set file_id [open $fileName RDONLY] | || | 192021222324252728293031323335363738394041 | if {[file exists $toFileName]} { error "output file \"$toFileName\" already exists" }}proc readFile { fileName } { set file_id [open $fileName RDONLY] set result [read $file_id] close $file_id return $result}proc writeFile { fileName data } { set file_id [open $fileName {WRONLY CREAT TRUNC}] puts -nonewline $file_id $data close $file_id return ""}proc escapeSubSpec { data } { regsub -all -- {&} $data {\\\&} data |
︙ | ︙ |
Modified tool/mkvsix.tclfrom [b9e0777a]to [67b40996].
︙ | ︙ | |||
152153154155156157158 | proc readFile { fileName } { # # NOTE: Reads and returns the entire contents of the specified file, which # may contain binary data. # set file_id [open $fileName RDONLY] | || | 152153154155156157158160161162163164165166167168169170172173174175176177178 | proc readFile { fileName } { # # NOTE: Reads and returns the entire contents of the specified file, which # may contain binary data. # set file_id [open $fileName RDONLY] set result [read $file_id] close $file_id return $result}proc writeFile { fileName data } { # # NOTE: Writes the entire contents of the specified file, which may contain # binary data. # set file_id [open $fileName {WRONLY CREAT TRUNC}] puts -nonewline $file_id $data close $file_id return ""}## TODO: Modify this procedure when a new version of Visual Studio is released. |
︙ | ︙ |
Modified tool/replace.tclfrom [937c931a]to [511c61ac].
123456 | #!/usr/bin/tcl## Replace string with another string -OR- include# only lines successfully modified with a regular# expression.# | || | 1234569101112131415 | #!/usr/bin/tcl## Replace string with another string -OR- include# only lines successfully modified with a regular# expression.#set mode [string tolower [lindex $argv 0]]set from [lindex $argv 1]set to [lindex $argv 2]if {-1 == [lsearch -exact [list exact regsub include] $mode]} {exit 1}if {[string length $from]==0} {exit 2}while {![eof stdin]} { set line [gets stdin] |
︙ | ︙ |
Modified tool/restore_jrnl.tclfrom [6957a34f]to [1079ecba].
︙ | ︙ | |||
119120121122123124125 | $jrnl_pgno $db_pgno] puts [ format {nonce: %08x chksum: %08x} \ $nonce $chksum] # now hex dump the data # This is derived from the Tcler's WIKI set fid [open $jrnl_name r] | | | 119120121122123124125127128129130131132133 | $jrnl_pgno $db_pgno] puts [ format {nonce: %08x chksum: %08x} \ $nonce $chksum] # now hex dump the data # This is derived from the Tcler's WIKI set fid [open $jrnl_name r] seek $fid [expr $jrnl_pg_offset+4] set data [read $fid $db_pgsz] close $fid for {set addr 0} {$addr<$db_pgsz} {set addr [expr $addr+16]} { # get 16 bytes of data set s [string range $data $addr [expr $addr+16]] |
︙ | ︙ | |||
226227228229230231232 | # check the integrity of the database with the patched journalsqlite3 db $db_namedo_test restore_jrnl-1.0 { catchsql {PRAGMA integrity_check}} {0 ok}db close | < | 226227228229230231232 | # check the integrity of the database with the patched journalsqlite3 db $db_namedo_test restore_jrnl-1.0 { catchsql {PRAGMA integrity_check}} {0 ok}db close |