SQLite: Check-in [6e5bb48a] (2024)

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:6e5bb48a74d63fb8c30528f0005d1763cd2dbb882abf86baf1565721e6bfcf84
User&Date:drh on 2024-07-30 15:49:02
OtherLinks: branch diff |manifest| tags

2024-07-30

16:51Fix the incrblob channel so that partial close works with Tcl9.(check-in:d54ec2de user:drh tags:tcl9)
15:49First attempt at getting the build to work with Tcl 9.0.(check-in:6e5bb48a user:drh tags:tcl9)

2024-07-27

20:28Fix 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].

704705706707708709710711
!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].

1213141516171819202122232425262728293031323334
*/#if defined(SQLITE_TEST)#include "sqlite3expert.h"#include <assert.h>#include <string.h>#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#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.
<<<<|<<<<
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].

14151617181920212223242526272829303132333435
** 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.*/#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#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 */
<<<|<<<<
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 */
163164165166167168169170171172173174175176177
 NearPhrase *aPhrase = 0; NearDocument doc = {0, 0}; Tcl_Obj **apDocToken; Tcl_Obj *pRet; Tcl_Obj *pPhrasecount = 0; Tcl_Obj **apExprToken; int nExprToken; 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;
|>
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;
197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
 switch( aOpt[iOpt].eOpt ){ case NM_PHRASECOUNTS: pPhrasecount = objv[ii+1]; break; } } rc = Tcl_ListObjGetElements(interp, objv[1], &doc.nToken, &apDocToken); if( rc!=TCL_OK ) goto near_match_out; doc.aToken = (NearToken *)ckalloc(doc.nToken*sizeof(NearToken)); for(ii=0; ii<doc.nToken; ii++){ doc.aToken[ii].z = Tcl_GetStringFromObj(apDocToken[ii], &doc.aToken[ii].n); } rc = Tcl_ListObjGetElements(interp, objv[2], &nExprToken, &apExprToken); if( rc!=TCL_OK ) goto near_match_out; nPhrase = (nExprToken + 1) / 2; 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 nToken; 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; } for(jj=0; jj<nToken; jj++){ NearToken *pT = &aPhrase[ii].aToken[jj]; pT->z = Tcl_GetStringFromObj(apToken[jj], &pT->n); } aPhrase[ii].nToken = nToken; } 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;
|>|>|||>|>|
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].

222223224225226227228229230231232233234235236237238239240
 sqlite3_free(zCopy); return rc;}#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#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:**
<<<|<
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].

10111213141516171819202122232425262728293031
***********************************************************************************/#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#ifdef SQLITE_ENABLE_FTS5#include "fts5.h"#include <string.h>#include <assert.h>
<<<|<<<<
1011121314151618192021222324
***********************************************************************************/#ifdef SQLITE_TEST#ifdef SQLITE_ENABLE_FTS5#include "fts5.h"#include <string.h>#include <assert.h>
293294295296297298299300301302303304305306307308309310311312
 rc = p->pApi->xColumnTotalSize(p->pFts, iCol, &nSize); if( rc==SQLITE_OK ){ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(nSize)); } break; } CASE(3, "xTokenize") { int nText; char *zText = Tcl_GetStringFromObj(objv[2], &nText); F5tFunction ctx; ctx.interp = interp; ctx.pScript = objv[3]; rc = p->pApi->xTokenize(p->pFts, zText, nText, &ctx, xTokenizeCb); if( rc==SQLITE_OK ){ Tcl_ResetResult(interp); } return rc; } CASE(4, "xPhraseCount") { int nPhrase;
||
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;
601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
 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); int n; 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. */ unsigned char *data = Tcl_GetByteArrayFromObj(pVar, &n); sqlite3_result_blob(pCtx, data, n, SQLITE_TRANSIENT); }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{ unsigned char *data = (unsigned char *)Tcl_GetStringFromObj(pVar, &n); sqlite3_result_text(pCtx, (char *)data, n, SQLITE_TRANSIENT); } }}static void xF5tDestroy(void *pCtx){ F5tFunction *p = (F5tFunction*)pCtx; Tcl_DecrRefCount(p->pScript);
<>||>>||
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);
716717718719720721722723724725726727728729730731732733734735736737738739
static int SQLITE_TCLAPI f5tTokenize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *zText; int nText; sqlite3 *db = 0; fts5_api *pApi = 0; Fts5Tokenizer *pTok = 0; fts5_tokenizer tokenizer; Tcl_Obj *pRet = 0; void *pUserdata; int rc; int nArg; const char **azArg; F5tTokenizeCtx ctx; if( objc!=4 && objc!=5 ){ Tcl_WrongNumArgs(interp, 1, objv, "?-subst? DB NAME TEXT"); return TCL_ERROR; }
||
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; }
757758759760761762763764765766767768769770771772773774775776777778779780781782783
 rc = pApi->xFindTokenizer(pApi, azArg[0], &pUserdata, &tokenizer); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "no such tokenizer: ", azArg[0], 0); return TCL_ERROR; } rc = tokenizer.xCreate(pUserdata, &azArg[1], nArg-1, &pTok); 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( pTok, (void*)&ctx, FTS5_TOKENIZE_DOCUMENT, zText, nText, xTokenizeCb2 ); tokenizer.xDelete(pTok); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "error in tokenizer.xTokenize()", 0); Tcl_DecrRefCount(pRet); 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; }
924925926927928929930931932933934935936937938939940941942943944
 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ F5tTokenizerContext *p = (F5tTokenizerContext*)clientData; int iStart; int iEnd; int nToken; int tflags = 0; char *zToken; int rc; if( objc==5 ){ int nArg; 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 ){
||
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 ){
955956957958959960961962963964965966967968969
 if( p->xToken==0 ){ Tcl_AppendResult(interp, "sqlite3_fts5_token may only be used by tokenizer callback", 0 ); return TCL_ERROR; } rc = p->xToken(p->pCtx, tflags, zToken, nToken, iStart, iEnd); 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;}
|
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;}
1079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
static int SQLITE_TCLAPI f5tTokenHash( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ char *z; int n; 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); iVal = f5t_fts5HashKey(nSlot, z, n); Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal)); return TCL_OK;}static int SQLITE_TCLAPI f5tRegisterMatchinfo( void * clientData, Tcl_Interp *interp,
||
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].

111213141516171819202122232425262728293031
*************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"#include "sqlite3intck.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <string.h>#include <assert.h>/* In test1.c */int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb);const char *sqlite3ErrName(int);
<<<<|<<
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].

13141516171819202122232425262728293031323334
#include "sqlite3.h"#if defined(SQLITE_TEST)#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)#include "sqlite3rbu.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#include <assert.h>#include <string.h>typedef struct TestRbu TestRbu;struct TestRbu { sqlite3rbu *pRbu; Tcl_Interp *interp;
<<<|<<<<
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;
428429430431432433434435436437438439440441442
 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#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endifint SqliteRbu_Init(Tcl_Interp *interp){ return TCL_OK; }#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */#endif /* defined(SQLITE_TEST) */
<<<|<
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].

10111213141516171819202122232425
******************************************************************************/#include "sqlite3recover.h"#include "sqliteInt.h"#include <tcl.h>#include <assert.h>#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct TestRecover TestRecover;struct TestRecover { sqlite3_recover *p;
<|
1011121314151618192021222324
******************************************************************************/#include "sqlite3recover.h"#include "sqliteInt.h"#include <assert.h>#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct TestRecover TestRecover;struct TestRecover { sqlite3_recover *p;
304305306307308309310311
 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].

10111213141516171819202122232425262728
***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif/* Solely for the UNUSED_PARAMETER() macro. */#include "sqliteInt.h"#ifdef SQLITE_ENABLE_RTREEtypedef struct BoxGeomCtx BoxGeomCtx;
<<<|<
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;
8687888990919293949596979899100
 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{ int nObj = 0; 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") ){
|
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") ){
275276277278279280281282283284285286287288289
 ); Tcl_ListObjAppendElement(interp, pEval, pArg); rc = Tcl_EvalObjEx(interp, pEval, 0) ? SQLITE_ERROR : SQLITE_OK; if( rc==SQLITE_OK ){ double rScore = 0.0; int nObj = 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)
|
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].

12345678910111213141516171819202122
#if defined(SQLITE_TEST) && defined(SQLITE_ENABLE_SESSION) \ && defined(SQLITE_ENABLE_PREUPDATE_HOOK)#include "sqlite3session.h"#include <assert.h>#include <string.h>#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#ifndef SQLITE_AMALGAMATION typedef unsigned char u8;#endiftypedef struct TestSession TestSession;struct TestSession {
<<<|<<<<
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 {
513514515516517518519520521522523524525526527528529530531
struct TestConflictHandler { Tcl_Interp *interp; Tcl_Obj *pConflictScript; Tcl_Obj *pFilterScript;};static int test_obj_eq_string(Tcl_Obj *p, const char *z){ int n; int nObj; char *zObj; n = (int)strlen(z); 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 */
|||
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 */
792793794795796797798799800801802803804805806
 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 */ int nChangeset;  /* Size of buffer aChangeset in bytes */ TestConflictHandler ctx; TestStreamInput sStr; void *pRebase = 0; int nRebase = 0; int flags = 0; /* Flags for apply_v2() */ memset(&sStr, 0, sizeof(sStr));
|
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));
849850851852853854855856857858859860861862863864865866867868869870871872873874
 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 ){ rc = sqlite3changeset_apply(db, nChangeset, pChangeset,  (objc==5)?test_filter_handler:0, test_conflict_handler, (void *)&ctx ); }else{ rc = sqlite3changeset_apply_v2(db, nChangeset, pChangeset,  (objc==5)?test_filter_handler:0, test_conflict_handler, (void *)&ctx, &pRebase, &nRebase, flags ); } }else{ sStr.aData = (unsigned char*)pChangeset; sStr.nData = nChangeset; 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,
|||
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,
923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
 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 */ int nChangeset;  /* Size of buffer aChangeset in bytes */ 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); rc = sqlite3changeset_apply(db, nChangeset, pChangeset, 0, replace_handler,0); 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); sIn.aData = Tcl_GetByteArrayFromObj(objv[1], &sIn.nData); 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);
||>>|>
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);
99599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
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.aData = Tcl_GetByteArrayFromObj(objv[1], &sLeft.nData); sRight.aData = Tcl_GetByteArrayFromObj(objv[2], &sRight.nData); 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,
>|>|>
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,
110211031104110511061107110811091110111111121113111411151116
static int SQLITE_TCLAPI test_sqlite3session_foreach( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset; int nChangeset; sqlite3_changeset_iter *pIter; int rc; Tcl_Obj *pVarname; Tcl_Obj *pCS; Tcl_Obj *pScript; int isCheckNext = 0; int isInvert = 0;
|
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;
114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170
 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 ){ rc = sqlite3changeset_start_v2(&pIter, nChangeset, pChangeset, f); }else{ void *pCtx = (void*)&sStr; sStr.aData = (unsigned char*)pChangeset; sStr.nData = nChangeset; rc = sqlite3changeset_start_v2_strm(&pIter, testStreamInput, pCtx, f); } }else{ if( sStr.nStream==0 ){ rc = sqlite3changeset_start(&pIter, nChangeset, pChangeset); }else{ sStr.aData = (unsigned char*)pChangeset; sStr.nData = nChangeset; rc = sqlite3changeset_start_strm(&pIter, testStreamInput, (void*)&sStr); } } if( rc!=SQLITE_OK ){ return test_session_error(interp, rc, 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); }
1233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263
 return TCL_ERROR; } assert( iSub==0 || iSub==1 || iSub==2 ); assert( rc==SQLITE_OK ); switch( iSub ){ case 0: { /* configure */ int nRebase = 0; unsigned char *pRebase = Tcl_GetByteArrayFromObj(objv[2], &nRebase); rc = sqlite3rebaser_configure(p, nRebase, pRebase); 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.aData = Tcl_GetByteArrayFromObj(objv[2], &sStr.nData); sStr.nStream = test_tcl_integer(interp, SESSION_STREAM_TCL_VAR); if( sStr.nStream ){ rc = sqlite3rebaser_rebase_strm(p, testStreamInput, (void*)&sStr, testStreamOutput, (void*)&sOut );
||>|>
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 );
13881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
static int SQLITE_TCLAPI test_changeset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *pChangeset = 0; /* Buffer containing changeset */ int nChangeset = 0;  /* Size of buffer aChangeset in bytes */ 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); rc = sqlite3_test_changeset(nChangeset, pChangeset, &z); 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);
||
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);
15241525152615271528152915301531153215331534153515361537153815391540
 } rc = sqlite3changegroup_schema(p->pGrp, db, zDb); if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); break; }; case 1: { /* add */ int nByte = 0; const u8 *aByte = Tcl_GetByteArrayFromObj(objv[2], &nByte); rc = sqlite3changegroup_add(p->pGrp, nByte, (void*)aByte); if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); break; }; case 2: { /* output */ int nByte = 0; u8 *aByte = 0;
||
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;
1674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710
 void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int isInvert = 0; void *pChangeset = 0; /* Buffer containing changeset */ int nChangeset = 0;  /* Size of buffer aChangeset in bytes */ 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 ){ int n = 0; const char *z = Tcl_GetStringFromObj(objv[1], &n); isInvert = (n>=2 && sqlite3_strnicmp(z, "-invert", n)==0); } 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); rc = sqlite3changeset_start_v2(&pIter, nChangeset, pChangeset, flags); if( rc!=SQLITE_OK ){ char *zErr = sqlite3_mprintf( "error in sqlite3changeset_start_v2() - %d", rc ); Tcl_AppendResult(interp, zErr, (char*)0); return TCL_ERROR; }
||||
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].

31323334353637383940414243444546474849505152
/*** If requested, include the SQLite compiler options file for MSVC.*/#if defined(INCLUDE_MSVC_H)# include "msvc.h"#endif#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#include <errno.h>/*** Some additional include files are needed if this file is not** appended to the amalgamation.*/#ifndef SQLITE_AMALGAMATION
<<<|<<<<
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
384385386387388389390391392393394395396397398
 ClientData *hPtr){ return TCL_ERROR;}static Tcl_ChannelType IncrblobChannelType = { "incrblob", /* typeName */ TCL_CHANNEL_VERSION_2, /* version */ incrblobClose, /* closeProc */ incrblobInput, /* inputProc */ incrblobOutput, /* outputProc */ incrblobSeek, /* seekProc */ 0, /* setOptionProc */ 0, /* getOptionProc */ incrblobWatch, /* watchProc (this is a no-op) */
|
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) */
470471472473474475476477478479480481482483484
*/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; int n; z = Tcl_GetStringFromObj(pCmd, &n); while( n-- > 0 ){ int c = *(z++); if( c=='$' || c=='[' || c==';' ) return 0; } return 1;}
|
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;}
977978979980981982983984985986987988989990991
 ** 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; int nArg; 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++){
|
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++){
104010411042104310441045104610471048104910501051105210531054
 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); int n; 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 ){
|
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 ){
145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480
 rc = TCL_ERROR; break; }else{ pVar = 0; } } if( pVar ){ int n; 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 ){ Tcl_GetIntFromObj(interp, pVar, &n); sqlite3_bind_int(pStmt, i, n); }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;
|>||
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;
203020312032203320342035203620372038203920402041204220432044
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zAuth ){ Tcl_AppendResult(interp, pDb->zAuth, (char*)0); } }else{ char *zAuth; int len; 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);
|
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);
213321342135213621372138213921402141214221432144214521462147
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBindFallback ){ Tcl_AppendResult(interp, pDb->zBindFallback, (char*)0); } }else{ char *zCallback; int len; 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);
|
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);
216321642165216621672168216921702171217221732174217521762177
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zBusy ){ Tcl_AppendResult(interp, pDb->zBusy, (char*)0); } }else{ char *zBusy; int len; 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);
|
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);
227022712272227322742275227622772278227922802281228222832284
 ** 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; int nScript; 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 );
|
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 );
232923302331233223332334233523362337233823392340234123422343
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zCommit ){ Tcl_AppendResult(interp, pDb->zCommit, (char*)0); } }else{ const char *zCommit; int len; 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);
|
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);
264926502651265226532654265526562657265826592660266126622663
 (char*)0); rc = TCL_ERROR;#else const char *zSchema = 0; Tcl_Obj *pValue = 0; unsigned char *pBA; unsigned char *pData; int len, xrc; sqlite3_int64 mxSize = 0; int i; int isReadonly = 0; if( objc<3 ){ Tcl_WrongNumArgs(interp, 2, objv, "?DATABASE? VALUE");
>|
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");
302030213022302330243025302630273028302930303031303230333034
 */ case DB_NULLVALUE: { if( objc!=2 && objc!=3 ){ Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE"); return TCL_ERROR; } if( objc==3 ){ int len; 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);
|
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);
307430753076307730783079308030813082308330843085308630873088
 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 len; int N; if( TCL_OK!=Tcl_GetIntFromObj(interp, objv[2], &N) ){ return TCL_ERROR; }; if( pDb->zProgress ){ Tcl_Free(pDb->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); }
312031213122312331243125312631273128312931303131313231333134
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zProfile ){ Tcl_AppendResult(interp, pDb->zProfile, (char*)0); } }else{ char *zProfile; int len; 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);
|
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);
333133323333333433353336333733383339334033413342334333443345
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTrace ){ Tcl_AppendResult(interp, pDb->zTrace, (char*)0); } }else{ char *zTrace; int len; 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);
|
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);
337133723373337433753376337733783379338033813382338333843385
 return TCL_ERROR; }else if( objc==2 ){ if( pDb->zTraceV2 ){ Tcl_AppendResult(interp, pDb->zTraceV2, (char*)0); } }else{ char *zTraceV2; int len; 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
|
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
3957395839593960396139623963396439653966396739683969397039713972397339743975397639773978
/* 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;}#ifndef SQLITE_3_SUFFIX_ONLYint Sqlite_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }int Tclsqlite_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }int Sqlite_Unload(Tcl_Interp *interp, int flags){ return TCL_OK; }int Tclsqlite_Unload(Tcl_Interp *interp, int flags){ return TCL_OK; }#endif/*** 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
|||>>>>>||||<>>
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].

22232425262728293031323334353637383940
# if defined(__APPLE__)# include <sys/param.h># include <sys/sysctl.h># endif#endif#include "vdbeInt.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#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
<<<|<
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
176817691770177117721773177417751776177717781779178017811782
static int SQLITE_TCLAPI blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; int n; z = Tcl_GetStringFromObj(pObj, &n); if( n==0 ){ *ppBlob = 0; }else{ int notUsed; Tcl_Channel channel;
|
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;
409840994100410141024103410441054106410741084109411041114112
 void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; int idx; int trueLength = 0; int bytes; char *value; int rc; char *toFree = 0; if( objc!=5 ){ Tcl_AppendResult(interp, "wrong # args: should be \"",
|
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 \"",
415641574158415941604161416241634164416541664167416841694170
#ifndef SQLITE_OMIT_UTF16 sqlite3_stmt *pStmt; int idx; int bytes; char *value; char *toFree = 0; int rc; int trueLength = 0; 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];
|
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];
421042114212421342144215421642174218421942204221422242234224
static int SQLITE_TCLAPI test_bind_blob( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_stmt *pStmt; int len, idx; int bytes; char *value; int rc; sqlite3_destructor_type xDestructor = SQLITE_TRANSIENT; if( objc!=5 && objc!=6 ){ Tcl_AppendResult(interp, "wrong # args: should be \"",
>|
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 \"",
423642374238423942404241424242434244424542464247424842494250
 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, "cannot use %d blob bytes, have %d", bytes, len); 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 ){
|
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 ){
45344535453645374538453945404541454245434544454545464547454845494550
 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++){ int n = 0; unsigned char *v = Tcl_GetByteArrayFromObj(objv[i+i], &n); a[j].iov_len = 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); } }
||
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); } }
511251135114511551165117511851195120512151225123512451255126
 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 */ int objlen;  /* The byte-array length of arg 2 */ 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;
|
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;
517251735174517551765177517851795180518151825183518451855186
 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 */ int objlen;  /* The byte-array length of arg 2 */ 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;
|
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;
52525253525452555256525752585259526052615262526352645265526652675268
 const char *zFilename; const char *zVfs; int flags = 0; sqlite3 *db; int rc; char zBuf[100]; int nFlag; Tcl_Obj **apFlag; int i; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME FLAGS VFS"); return TCL_ERROR; } zFilename = Tcl_GetString(objv[1]); zVfs = Tcl_GetString(objv[3]);
||
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]);
8729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756
 Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3 *db = 0; Tcl_WideInt iOff = 0; const unsigned char *aData = 0; int nData = 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); rc = pFile->pMethods->xWrite(pFile, aData, nData, iOff); Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); return TCL_OK;}/*** Usage: sqlite3_register_cksumvfs
||
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].

10111213141516171819202122232425262728
***************************************************************************** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <ctype.h>extern const char *sqlite3ErrName(int);/*
<<<|<
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].

11121314151617181920212223242526272829
*************************************************************************** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>extern const char *sqlite3ErrName(int);/*** A bogus sqlite3 connection structure for use in the btree
<<<|<
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
619620621622623624625626627628629630631632633634635636637638639640641642643644645646
 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; x.pData = (void*)Tcl_GetByteArrayFromObj(objv[3], &x.nData); }else{ x.pKey = (void*)Tcl_GetByteArrayFromObj(objv[2], &rc); x.nKey = rc; } 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);
>|>||
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].

891011121314151617181920212223242526
** 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 defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#if SQLITE_OS_UNIX && SQLITE_THREADSAFE#include <stdlib.h>#include <string.h>#include <pthread.h>#include <sched.h>#include <ctype.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].

13141516171819202122232425262728293031323334353637383940414243444546
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#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[]){ int len; 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);
<<<|<|
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);
129130131132133134135136137138139140141142143
 Tcl_Obj *CONST objv[]){ u8 enc_from; u8 enc_to; sqlite3_value *pVal; char *z; int len; 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 );
|
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 );
160161162163164165166167168169170171172173174
 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; z = sqlite3_malloc(len); 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);
|
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].

12131415161718192021222324252627282930
**** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#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;
<<<|<
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;
747748749750751752753754755756757758759760761
 int i; int iDc = 0; int iSectorSize = 0; int setSectorsize = 0; int setDeviceChar = 0; for(i=0; i<objc; i+=2){ int nOpt; 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,
|
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,
772773774775776777778779780781782783784785786787788789790
 if( Tcl_GetIntFromObj(interp, objv[i+1], &iSectorSize) ){ return TCL_ERROR; } setSectorsize = 1; }else{ int j; Tcl_Obj **apObj; int nObj; if( Tcl_ListObjGetElements(interp, objv[i+1], &nObj, &apObj) ){ return TCL_ERROR; } for(j=0; j<nObj; j++){ int rc; int iChoice; Tcl_Obj *pFlag = Tcl_DuplicateObj(apObj[j]); Tcl_IncrRefCount(pFlag); Tcl_UtfToLower(Tcl_GetString(pFlag)); rc = Tcl_GetIndexFromObjStruct(
||
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(
921922923924925926927928929930931932933934935
 void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int iDelay; const char *zCrashFile; int nCrashFile, iDc, iSectorSize; iDc = -1; iSectorSize = -1; if( objc<3 ){ Tcl_WrongNumArgs(interp, 1, objv, "?OPTIONS? DELAY CRASHFILE"); goto error;
>|
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].

10111213141516171819202122232425262728
***************************************************************************** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct echo_vtab echo_vtab;typedef struct echo_cursor echo_cursor;
<<<|<
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].

11121314151617181920212223242526272829
***************************************************************************** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>/*** c_collation_test*/static int SQLITE_TCLAPI c_collation_test(
<<<|<
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].

1011121314151617181920212223242526272829303132
******************************************************************************* This file contains a binding of the asynchronous IO extension interface** (defined in ext/async/sqlite3async.h) to Tcl.*/#define TCL_THREADS #if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#ifdef SQLITE_ENABLE_ASYNCIO#include "sqlite3async.h"#include "sqlite3.h"#include <assert.h>
|<<<|<<<<
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].

12345678910111213141516171819202122232425262728
/*** 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.*/#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#include "sqlite3ext.h"#ifndef SQLITE_OMIT_LOAD_EXTENSIONSQLITE_EXTENSION_INIT1/*** The sqr() SQL function returns the square of its input value.
<<<|<<<<
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].

9101112131415161718192021222324252627282930
** May you share freely, never taking more than you give.***************************************************************************** This file contains test logic for the sqlite3_backup() interface.***/#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#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. */
<<<|<<<<
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].

8990919293949596979899100101102103104105106107
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#ifndef SQLITE_OMIT_VIRTUALTABLEtypedef struct tcl_vtab tcl_vtab;typedef struct tcl_cursor tcl_cursor;typedef struct TestFindFunction TestFindFunction;
<<<|<
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;
348349350351352353354355356357358359360361362363364365366367368369
 ** 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; int nElem; 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{ for(ii=0; rc==SQLITE_OK && ii<nElem; ii+=2){ 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);
||
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);
660661662663664665666667668669670671672673674675676677678679680681682683
 ** "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; int nElem; 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; for(ii=0; rc==SQLITE_OK && ii<nElem; ii+=2){ 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);
||
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].

891011121314151617181920212223242526
** May you find forgiveness for yourself and forgive others.** May you share freely, never taking more than you give.******************************************************************************/#include "sqliteInt.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#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);
<<<|<
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);
545556575859606162636465666768
*/static int blobHandleFromObj( Tcl_Interp *interp, Tcl_Obj *pObj, sqlite3_blob **ppBlob){ char *z; int n; z = Tcl_GetStringFromObj(pObj, &n); if( n==0 ){ *ppBlob = 0; }else if( n>9 && 0==memcmp("incrblob_", z, 9) ){ int notUsed; Tcl_Channel channel;
|
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;
848586878889909192939495969798
}/*** Like Tcl_GetString(), except that if the string is 0 bytes in size, a** NULL Pointer is returned.*/static char *blobStringFromObj(Tcl_Obj *pObj){ int n; char *z; z = Tcl_GetStringFromObj(pObj, &n); return (n ? z : 0);}/*** sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME
|
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
108109110111112113114115116117118119120121122
 sqlite3 *db; const char *zDb; const char *zTable; const char *zColumn; Tcl_WideInt iRowid; int flags; const char *zVarname; int nVarname; 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);
|
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);
277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
 Tcl_Obj *CONST objv[] /* Command arguments */){ sqlite3_blob *pBlob; int iOffset; int rc; unsigned char *zBuf; int nBuf; 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); if( objc==5 && Tcl_GetIntFromObj(interp, objv[4], &nBuf) ){ return TCL_ERROR; } rc = sqlite3_blob_write(pBlob, zBuf, nBuf, iOffset); if( rc!=SQLITE_OK ){ Tcl_SetResult(interp, (char *)sqlite3ErrName(rc), TCL_VOLATILE); } return (rc==SQLITE_OK ? TCL_OK : TCL_ERROR);}#endif /* SQLITE_OMIT_INCRBLOB */
>|>||
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].

10111213141516171819202122232425262728
***************************************************************************** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif/*** Usage: sqlite3_shared_cache_report**** Return a list of file that are shared and the number of** references to each file.*/
<<<|<
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].

20212223242526272829303132333435363738
#include "sqliteLimit.h"#include "sqliteInt.h"#if SQLITE_OS_WIN# include "os_win.h"#endif#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.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".*/
<<<|<
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].

641642643644645646647648649650651652653654655656657658659660661662
}#endif /* !defined(SQLITE_TEST) || SQLITE_OS_UNIX */#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif#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 */
<<<|<<<<
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].

5859606162636465666768697071727374757677
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#if SQLITE_OS_UNIX || defined(__MINGW_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].

9101112131415161718192021222324252627
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <assert.h>#include "sqliteInt.h"#include "vdbeInt.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].

14151617181920212223242526272829303132
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <assert.h>/*** Convert binary to hex. The input zBuf[] contains N bytes of
<<<|<
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
151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
static int SQLITE_TCLAPI hexio_write( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int offset; int nIn, nOut, written; 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); aOut = sqlite3_malloc( 1 + nIn/2 ); if( aOut==0 ){ return TCL_ERROR; } nOut = sqlite3TestHexToBin(zIn, nIn, aOut); 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;
>|||
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;
199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
static int SQLITE_TCLAPI hexio_get_int( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int val; int nIn, nOut; 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); aOut = sqlite3_malloc( 1 + nIn/2 ); if( aOut==0 ){ return TCL_ERROR; } nOut = sqlite3TestHexToBin(zIn, nIn, aOut); if( nOut>=4 ){ memcpy(aNum, aOut, 4); }else{ memset(aNum, 0, sizeof(aNum)); memcpy(&aNum[4-nOut], aOut, nOut); } sqlite3_free(aOut);
>|||
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);
296297298299300301302303304305306307308309310311312313314315316317318319320
static int SQLITE_TCLAPI utf8_to_utf8( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){#ifdef SQLITE_DEBUG int n; 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 = sqlite3_malloc( n+4 ); n = sqlite3TestHexToBin(zOrig, n, z); z[n] = 0; nOut = sqlite3Utf8To8(z); sqlite3TestBinToHex(z,nOut); Tcl_AppendResult(interp, (char*)z, 0); sqlite3_free(z); return TCL_OK;#else
|||
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
357358359360361362363364365366367368369370371
*/static int SQLITE_TCLAPI read_fts3varint( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ int nBlob; unsigned char *zBlob; sqlite3_int64 iVal; int nVal; if( objc!=3 ){ Tcl_WrongNumArgs(interp, 1, objv, "BLOB VARNAME"); return TCL_ERROR;
|
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;
384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
static int SQLITE_TCLAPI make_fts3record( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ Tcl_Obj **aArg = 0; int nArg = 0; unsigned char *aOut = 0; int nOut = 0; int nAlloc = 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; } for(i=0; i<nArg; i++){ 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{ int nVal = 0; char *zVal = Tcl_GetStringFromObj(aArg[i], &nVal); while( (nOut + nVal)>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; }
|||||||
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].

23242526272829303132333435363738394041
** 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>#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endifstatic struct Wrapped { sqlite3_pcache_methods2 pcache; sqlite3_mem_methods mem; sqlite3_mutex_methods mutex; int mem_init; /* True if mem subsystem is initialized */
<<<|<
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].

275276277278279280281282283284285286287288289290291292293294295296
}/******************************************************************************* Everything below is interface for testing this module.*/#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif/*** 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*);
<<<|<<<<
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].

10111213141516171819202122232425262728
******************************************************************************* This file contains code used to implement test interfaces to the** memory allocation subsystem.*/#include "sqliteInt.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <assert.h>/*** This structure is used to encapsulate the global state variables used ** by malloc() fault simulation.
<<<|<
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.
383384385386387388389390391392393394395396397
static int SQLITE_TCLAPI test_memset( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ void *p; int size, n, i; char *zHex; char *zOut; char zBin[100]; if( objc!=4 ){ Tcl_WrongNumArgs(interp, 1, objv, "ADDRESS SIZE HEX"); return TCL_ERROR;
|>
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;
405406407408409410411412413414415416417418419
 } 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; n = sqlite3TestHexToBin(zHex, n, zBin); 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];
|
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];
620621622623624625626627628629630631632633634
 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){ int nOption; 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{
|
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].

12131415161718192021222324252627282930313233
**** This file contains code to implement an MD5 extension to TCL.*/#include "sqlite3.h"#include <stdlib.h>#include <string.h>#include "sqlite3.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif/* * 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. *
<<<|<<<<
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].

1215121612171218121912201221122212231224122512261227122812291230123112321233123412351236
 sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endifextern const char *sqlite3ErrName(int);/*** tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT*/static int SQLITE_TCLAPI test_multiplex_initialize(
<<<|<<<<
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].

1234567891011121314151617181920212223242526
/*** 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.*/#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include "sqlite3.h"#include "sqliteInt.h"#include <stdlib.h>#include <assert.h>#include <string.h>#define MAX_MUTEXES (SQLITE_MUTEX_STATIC_VFS3+1)
<<<<|<
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].

1105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
/******************************************************************************************************************************************************* Tcl interface starts here.*/#if defined(SQLITE_TEST) || defined(TCLSH)#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endifstatic int SQLITE_TCLAPI test_vfslog( void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){
<<<|<<<<
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].

1274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
 quotaLeave(); sqlite3_free(zFull); return rc;}/***************************** Test Code ***********************************/#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif/*** 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 */
<<<|<<<<
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 */
141614171418141914201421142214231424142514261427142814291430
 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 */ int nScript;  /* Length of callback script */ 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;
|
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].

10111213141516171819202122232425262728
***************************************************************************** Code for testing all sorts of SQLite interfaces. This code** is not included in the SQLite library. */#include "sqlite3.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif/* 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
<<<|<
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
353354355356357358359360361362363364365366367368369370371
}/* END of implementation of "circle" geometry callback.***************************************************************************************************************************************************/#include <assert.h>#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endiftypedef struct Cube Cube;struct Cube { double x; double y; double z; double width;
<<<|<
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].

32333435363738394041424344454647484950
/* 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"# if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"# else#  include "tcl.h"# endif#else# include "sqlite3ext.h" SQLITE_EXTENSION_INIT1#endif#include <stdlib.h>#include <string.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].

252253254255256257258259260261262263264265266267268269270271272273
*****************************************************************************************************************************************************************************************************************************/#ifdef SQLITE_TEST#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endifstruct InterpAndScript { Tcl_Interp *interp; Tcl_Obj *pScript;};typedef struct InterpAndScript InterpAndScript;
<<<|<<<<
252253254255256257258260261262263264265266
*****************************************************************************************************************************************************************************************************************************/#ifdef SQLITE_TESTstruct InterpAndScript { Tcl_Interp *interp; Tcl_Obj *pScript;};typedef struct InterpAndScript InterpAndScript;

Modified src/test_syscall.cfrom [9fdb13b1]to [9ad7ab39].

72737475767778798081828384858687888990
** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#include <assert.h>#if SQLITE_OS_UNIX/* From main.c */
<<<|<
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 */
193194195196197198199200201202203204205206207
**** 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; int nFunc = strlen(zFunc); 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);
|
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);
425426427428429430431432433434435436437438439440441442443444445446447448449450451452
static int SQLITE_TCLAPI test_syscall_install( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ sqlite3_vfs *pVfs;  int nElem; 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); for(i=0; i<nElem; i++){ 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);
||
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);
498499500501502503504505506507508509510511512
 } 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{ int nFunc; 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; }
|
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].

16171819202122232425262728293031323334353637
** "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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"# ifndef SQLITE_TCLAPI# define SQLITE_TCLAPI# endif#endif/* Needed for the setrlimit() system call on unix */#if defined(unix)#include <sys/resource.h>#endif/* Forward declaration */
<<<|<<<<
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].

32333435363738394041424344454647484950
**** 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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#include <stdlib.h>#include <string.h>#ifndef SQLITE_OMIT_VIRTUALTABLE/*** Characters that make up the idxStr created by xBestIndex for xFilter.
<<<|<
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.
146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
 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{ int n = 0; pCur->i2++; Tcl_ListObjLength(0, pCur->pList2, &n); if( pCur->i2>=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 n = 0; int ok = 0; tclvar_cursor *pCur = (tclvar_cursor *)cur; Tcl_Interp *interp = ((tclvar_vtab *)(cur->pVtab))->interp; Tcl_ListObjLength(0, pCur->pList1, &n); while( !ok && pCur->i1<n ){ Tcl_ListObjIndex(0, pCur->pList1, pCur->i1, &pObj); ok = next2(interp, pCur, pObj); if( !ok ){ pCur->i1++; } }
||||
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].

12131415161718192021222324252627282930
**** 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 defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#if SQLITE_THREADSAFE#include <errno.h>#if !defined(_MSC_VER)#include <unistd.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>
90919293949596979899100101102103104
/*** 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; int nMsg; 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);
|
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);
177178179180181182183184185186187188189190191192
 int objc, Tcl_Obj *CONST objv[]){ Tcl_ThreadId x; SqlThread *pNew; int rc; int nVarname; char *zVarname; int nScript; char *zScript; /* Parameters for thread creation */ const int nStack = TCL_THREAD_STACK_DEFAULT; const int flags = TCL_THREAD_NOFLAGS; assert(objc==4); UNUSED_PARAMETER(clientData);
||
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);
228229230231232233234235236237238239240241242
 ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){ EvalEvent *pEvent; char *zMsg; int nMsg; SqlThread *p = (SqlThread *)clientData; assert(objc==3); UNUSED_PARAMETER(objc); if( p==0 ){ Tcl_AppendResult(interp, "no parent thread", 0);
|
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].

11121314151617181920212223242526272829
*********************************************************************************/#if SQLITE_TEST /* This file is used for testing only */#include "sqlite3.h"#include "sqliteInt.h"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endif#ifdef SQLITE_VDBE_COVERAGEstatic u8 aBranchArray[200000];static void test_vdbe_branch( void *pCtx, 
<<<|<
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].

24252627282930313233343536373839404142
** -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"#if defined(INCLUDE_SQLITE_TCL_H)# include "sqlite_tcl.h"#else# include "tcl.h"#endiftypedef struct Testvfs Testvfs;typedef struct TestvfsShm TestvfsShm;typedef struct TestvfsBuffer TestvfsBuffer;typedef struct TestvfsFile TestvfsFile;typedef struct TestvfsFd TestvfsFd;
<<<|<
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;
11461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
 } ckfree(zName); if( !pBuffer ){ Tcl_AppendResult(interp, "no such file: ", Tcl_GetString(objv[2]), 0); return TCL_ERROR; } if( objc==4 ){ int n; u8 *a = Tcl_GetByteArrayFromObj(objv[3], &n); int pgsz = pBuffer->pgsz; if( pgsz==0 ) pgsz = 65536; for(i=0; i*pgsz<n; i++){ int nByte = pgsz; tvfsAllocPage(pBuffer, i, pgsz); if( n-i*pgsz<pgsz ){ nByte = n; } memcpy(pBuffer->aPage[i], &a[i*pgsz], nByte); } } pObj = Tcl_NewObj(); for(i=0; pBuffer->aPage[i]; i++){
|||
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++){
1199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
 { "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 nElem = 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); for(i=0; i<nElem; i++){ 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; }
||
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; }
123512361237123812391240124112421243124412451246124712481249
 ** TESTVFS script ?SCRIPT? ** ** Query or set the script to be run when filtered VFS events ** occur. */ case CMD_SCRIPT: { if( objc==3 ){ int nByte; if( p->pScript ){ Tcl_DecrRefCount(p->pScript); p->pScript = 0; } Tcl_GetStringFromObj(objv[2], &nByte); if( nByte>0 ){ p->pScript = Tcl_DuplicateObj(objv[2]);
|
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]);
133313341335133613371338133913401341134213431344134513461347134813491350135113521353
 Tcl_WrongNumArgs(interp, 2, objv, "?ATTR-LIST?"); return TCL_ERROR; } if( objc==3 ){ int j; int iNew = 0; Tcl_Obj **flags = 0; int nFlags = 0; if( Tcl_ListObjGetElements(interp, objv[2], &nFlags, &flags) ){ return TCL_ERROR; } for(j=0; j<nFlags; j++){ 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 ){
||
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 ){
148714881489149014911492149314941495149614971498149915001501
 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){ int nSwitch; 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; }
|
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].

121314151617181920212223242526
*/#include "sqlite3.h"#ifdef SQLITE_TEST#include "sqliteInt.h"#include <tcl.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;
|
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].

1920212223242526272829303132333435363738394041
 if {[file exists $toFileName]} { error "output file \"$toFileName\" already exists" }}proc readFile { fileName } { set file_id [open $fileName RDONLY] fconfigure $file_id -encoding binary -translation binary set result [read $file_id] close $file_id return $result}proc writeFile { fileName data } { set file_id [open $fileName {WRONLY CREAT TRUNC}] fconfigure $file_id -encoding binary -translation binary puts -nonewline $file_id $data close $file_id return ""}proc escapeSubSpec { data } { regsub -all -- {&} $data {\\\&} data
||
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].

152153154155156157158159160161162163164165166167168169170171172173174175176177178
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] fconfigure $file_id -encoding binary -translation binary 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}] fconfigure $file_id -encoding binary -translation binary puts -nonewline $file_id $data close $file_id return ""}## TODO: Modify this procedure when a new version of Visual Studio is released.
||
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].

123456789101112131415
#!/usr/bin/tcl## Replace string with another string -OR- include# only lines successfully modified with a regular# expression.#fconfigure stdout -translation binary -encoding binaryfconfigure stderr -translation binary -encoding binaryset 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]
||
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].

119120121122123124125126127128129130131132133
 $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] fconfigure $fid -translation binary -encoding binary 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]] 
|
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]] 
226227228229230231232233
# 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
SQLite: Check-in [6e5bb48a] (2024)
Top Articles
Cosa fare se il Viagra non funziona?
Salve, vorrei provare a prendere il viagra perche per via dell eta la mia libido è calata fortemente
Omega Pizza-Roast Beef -Seafood Middleton Menu
Lowe's Garden Fence Roll
Week 2 Defense (DEF) Streamers, Starters & Rankings: 2024 Fantasy Tiers, Rankings
Ret Paladin Phase 2 Bis Wotlk
Costco in Hawthorne (14501 Hindry Ave)
Mylife Cvs Login
Citi Card Thomas Rhett Presale
Corporate Homepage | Publix Super Markets
Strange World Showtimes Near Cmx Downtown At The Gardens 16
Does Publix Have Sephora Gift Cards
Lenscrafters Huebner Oaks
Marion County Wv Tax Maps
The fabulous trio of the Miller sisters
Suffix With Pent Crossword Clue
Telegram Scat
Dark Chocolate Cherry Vegan Cinnamon Rolls
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
How pharmacies can help
Army Oubs
Officialmilarosee
Qhc Learning
Craigs List Tallahassee
PCM.daily - Discussion Forum: Classique du Grand Duché
Regal Amc Near Me
Hdmovie2 Sbs
Hannaford Weekly Flyer Manchester Nh
What Individuals Need to Know When Raising Money for a Charitable Cause
Ou Football Brainiacs
Hrconnect Kp Login
Obituaries, 2001 | El Paso County, TXGenWeb
Stouffville Tribune (Stouffville, ON), March 27, 1947, p. 1
Otis Inmate Locator
Wheeling Matinee Results
3473372961
Dtlr On 87Th Cottage Grove
Springfield.craigslist
Litter-Robot 3 Pinch Contact & DFI Kit
PA lawmakers push to restore Medicaid dental benefits for adults
House Of Budz Michigan
Petsmart Northridge Photos
Tillman Funeral Home Tallahassee
WorldAccount | Data Protection
Ehome America Coupon Code
Rocket Lab hiring Integration &amp; Test Engineer I/II in Long Beach, CA | LinkedIn
26 Best & Fun Things to Do in Saginaw (MI)
Meet Robert Oppenheimer, the destroyer of worlds
Craigslist Monterrey Ca
Vt Craiglist
Kindlerso
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 5697

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.