=nCol ) break;
}
return -1;
}
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 38edc9704f..17c3a009bc 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -1989,13 +1989,16 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_CONFIG_LOOKASIDE]] SQLITE_CONFIG_LOOKASIDE
** ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
-** the default size of lookaside memory on each [database connection].
+** the default size of [lookaside memory] on each [database connection].
** The first argument is the
-** size of each lookaside buffer slot and the second is the number of
-** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
-** sets the default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
-** option to [sqlite3_db_config()] can be used to change the lookaside
-** configuration on individual connections.)^
+** size of each lookaside buffer slot ("sz") and the second is the number of
+** slots allocated to each database connection ("cnt").)^
+** ^(SQLITE_CONFIG_LOOKASIDE sets the default lookaside size.
+** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
+** be used to change the lookaside configuration on individual connections.)^
+** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
+** default lookaside configuration at compile-time.
+**
**
** [[SQLITE_CONFIG_PCACHE2]] SQLITE_CONFIG_PCACHE2
** ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
@@ -2232,31 +2235,50 @@ struct sqlite3_mem_methods {
** [[SQLITE_DBCONFIG_LOOKASIDE]]
** SQLITE_DBCONFIG_LOOKASIDE
** The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
-** configuration of the lookaside memory allocator within a database
+** configuration of the [lookaside memory allocator] within a database
** connection.
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are not
** in the [DBCONFIG arguments|usual format].
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
** should have a total of five parameters.
-** ^The first argument (the third parameter to [sqlite3_db_config()] is a
+**
+** The first argument ("buf") is a
** pointer to a memory buffer to use for lookaside memory.
-** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
-** may be NULL in which case SQLite will allocate the
-** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
-** size of each lookaside buffer slot. ^The third argument is the number of
-** slots. The size of the buffer in the first argument must be greater than
-** or equal to the product of the second and third arguments. The buffer
-** must be aligned to an 8-byte boundary. ^If the second argument to
-** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
-** rounded down to the next smaller multiple of 8. ^(The lookaside memory
+** The first argument may be NULL in which case SQLite will allocate the
+** lookaside buffer itself using [sqlite3_malloc()].
+**
The second argument ("sz") is the
+** size of each lookaside buffer slot. Lookaside is disabled if "sz"
+** is less than 8. The "sz" argument should be a multiple of 8 less than
+** 65536. If "sz" does not meet this constraint, it is reduced in size until
+** it does.
+**
The third argument ("cnt") is the number of slots. Lookaside is disabled
+** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
+** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
+** parameter is usually chosen so that the product of "sz" and "cnt" is less
+** than 1,000,000.
+**
+** If the "buf" argument is not NULL, then it must
+** point to a memory buffer with a size that is greater than
+** or equal to the product of "sz" and "cnt".
+** The buffer must be aligned to an 8-byte boundary.
+** The lookaside memory
** configuration for a database connection can only be changed when that
** connection is not currently using lookaside memory, or in other words
-** when the "current value" returned by
-** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
+** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
** Any attempt to change the lookaside memory configuration when lookaside
** memory is in use leaves the configuration unchanged and returns
-** [SQLITE_BUSY].)^
+** [SQLITE_BUSY].
+** If the "buf" argument is NULL and an attempt
+** to allocate memory based on "sz" and "cnt" fails, then
+** lookaside is silently disabled.
+**
+** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
+** default lookaside configuration at initialization. The
+** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
+** configuration at compile-time. Typical values for lookaside are 1200 for
+** "sz" and 40 to 100 for "cnt".
+**
**
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
**
SQLITE_DBCONFIG_ENABLE_FKEY
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 8c07c9840c..6d88b811c0 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -843,6 +843,11 @@ typedef INT16_TYPE i16; /* 2-byte signed integer */
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */
typedef INT8_TYPE i8; /* 1-byte signed integer */
+/* A bitfield type for use inside of structures. Always follow with :N where
+** N is the number of bits.
+*/
+typedef unsigned bft; /* Bit Field Type */
+
/*
** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
** that can be stored in a u32 without loss of data. The value
@@ -1011,6 +1016,14 @@ typedef INT16_TYPE LogEst;
#define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32))
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
+/*
+** Macro SMXV(n) return the maximum value that can be held in variable n,
+** assuming n is a signed integer type. UMXV(n) is similar for unsigned
+** integer types.
+*/
+#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1)
+#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1)
+
/*
** Round up a number to the next larger multiple of 8. This is used
** to force 8-byte alignment on 64-bit architectures.
@@ -2454,6 +2467,7 @@ struct Table {
} u;
Trigger *pTrigger; /* List of triggers on this object */
Schema *pSchema; /* Schema that contains this table */
+ u8 aHx[16]; /* Column aHt[K%sizeof(aHt)] might have hash K */
};
/*
@@ -3851,25 +3865,32 @@ struct Parse {
char *zErrMsg; /* An error message */
Vdbe *pVdbe; /* An engine for executing database bytecode */
int rc; /* Return code from execution */
- u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
- u8 checkSchema; /* Causes schema cookie check after an error */
+ LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u8 nested; /* Number of nested calls to the parser/code generator */
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
u8 mayAbort; /* True if statement may throw an ABORT exception */
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
- u8 okConstFactor; /* OK to factor out constants */
u8 disableLookaside; /* Number of times lookaside has been disabled */
u8 prepFlags; /* SQLITE_PREPARE_* flags */
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
- u8 bHasWith; /* True if statement contains WITH */
u8 mSubrtnSig; /* mini Bloom filter on available SubrtnSig.selId */
+ u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
+ u8 bReturning; /* Coding a RETURNING trigger */
+ u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
+ u8 disableTriggers; /* True to disable triggers */
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
#endif
#ifdef SQLITE_DEBUG
u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
+ u8 isCreate; /* CREATE TABLE, INDEX, or VIEW (but not TRIGGER)
+ ** and ALTER TABLE ADD COLUMN. */
#endif
+ bft colNamesSet :1; /* TRUE after OP_ColumnName has been issued to pVdbe */
+ bft bHasWith :1; /* True if statement contains WITH */
+ bft okConstFactor :1; /* OK to factor out constants */
+ bft checkSchema :1; /* Causes schema cookie check after an error */
int nRangeReg; /* Size of the temporary register block */
int iRangeReg; /* First register in temporary register block */
int nErr; /* Number of errors seen */
@@ -3884,12 +3905,9 @@ struct Parse {
ExprList *pConstExpr;/* Constant expressions */
IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */
IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */
- Token constraintName;/* Name of the constraint currently being parsed */
yDbMask writeMask; /* Start a write transaction on these databases */
yDbMask cookieMask; /* Bitmask of schema verified databases */
- int regRowid; /* Register holding rowid of CREATE TABLE entry */
- int regRoot; /* Register holding root page number for new objects */
- int nMaxArg; /* Max args passed to user function by sub-program */
+ int nMaxArg; /* Max args to xUpdate and xFilter vtab methods */
int nSelect; /* Number of SELECT stmts. Counter for Select.selId */
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
u32 nProgressSteps; /* xProgress steps taken during sqlite3_prepare() */
@@ -3903,17 +3921,6 @@ struct Parse {
Table *pTriggerTab; /* Table triggers are being coded for */
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
- union {
- int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
- Returning *pReturning; /* The RETURNING clause */
- } u1;
- u32 oldmask; /* Mask of old.* columns referenced */
- u32 newmask; /* Mask of new.* columns referenced */
- LogEst nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
- u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
- u8 bReturning; /* Coding a RETURNING trigger */
- u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
- u8 disableTriggers; /* True to disable triggers */
/**************************************************************************
** Fields above must be initialized to zero. The fields that follow,
@@ -3925,6 +3932,19 @@ struct Parse {
int aTempReg[8]; /* Holding area for temporary registers */
Parse *pOuterParse; /* Outer Parse object when nested */
Token sNameToken; /* Token with unqualified schema object name */
+ u32 oldmask; /* Mask of old.* columns referenced */
+ u32 newmask; /* Mask of new.* columns referenced */
+ union {
+ struct { /* These fields available when isCreate is true */
+ int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
+ int regRowid; /* Register holding rowid of CREATE TABLE entry */
+ int regRoot; /* Register holding root page for new objects */
+ Token constraintName; /* Name of the constraint currently being parsed */
+ } cr;
+ struct { /* These fields available to all other statements */
+ Returning *pReturning; /* The RETURNING clause */
+ } d;
+ } u1;
/************************************************************************
** Above is constant between recursions. Below is reset before and after
diff --git a/src/trigger.c b/src/trigger.c
index e306a2e664..604c3ab42f 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -70,7 +70,8 @@ Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
assert( pParse->db->pVtabCtx==0 );
#endif
assert( pParse->bReturning );
- assert( &(pParse->u1.pReturning->retTrig) == pTrig );
+ assert( !pParse->isCreate );
+ assert( &(pParse->u1.d.pReturning->retTrig) == pTrig );
pTrig->table = pTab->zName;
pTrig->pTabSchema = pTab->pSchema;
pTrig->pNext = pList;
@@ -1047,7 +1048,8 @@ static void codeReturningTrigger(
return;
}
assert( db->pParse==pParse );
- pReturning = pParse->u1.pReturning;
+ assert( !pParse->isCreate );
+ pReturning = pParse->u1.d.pReturning;
if( pTrigger != &(pReturning->retTrig) ){
/* This RETURNING trigger is for a different statement */
return;
@@ -1277,6 +1279,8 @@ static TriggerPrg *codeRowTrigger(
sSubParse.eTriggerOp = pTrigger->op;
sSubParse.nQueryLoop = pParse->nQueryLoop;
sSubParse.prepFlags = pParse->prepFlags;
+ sSubParse.oldmask = 0;
+ sSubParse.newmask = 0;
v = sqlite3GetVdbe(&sSubParse);
if( v ){
diff --git a/src/update.c b/src/update.c
index e8efce900f..998e1f7df3 100644
--- a/src/update.c
+++ b/src/update.c
@@ -476,38 +476,32 @@ void sqlite3Update(
if( db->mallocFailed ) goto update_cleanup;
}
#endif
- u8 hCol = sqlite3StrIHash(pChanges->a[i].zEName);
/* If this is an UPDATE with a FROM clause, do not resolve expressions
** here. The call to sqlite3Select() below will do that. */
if( nChangeFrom==0 && sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){
goto update_cleanup;
}
- for(j=0; jnCol; j++){
- if( pTab->aCol[j].hName==hCol
- && sqlite3StrICmp(pTab->aCol[j].zCnName, pChanges->a[i].zEName)==0
- ){
- if( j==pTab->iPKey ){
- chngRowid = 1;
- pRowidExpr = pChanges->a[i].pExpr;
- iRowidExpr = i;
- }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
- chngPk = 1;
- }
-#ifndef SQLITE_OMIT_GENERATED_COLUMNS
- else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){
- testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL );
- testcase( pTab->aCol[j].colFlags & COLFLAG_STORED );
- sqlite3ErrorMsg(pParse,
- "cannot UPDATE generated column \"%s\"",
- pTab->aCol[j].zCnName);
- goto update_cleanup;
- }
-#endif
- aXRef[j] = i;
- break;
+ j = sqlite3ColumnIndex(pTab, pChanges->a[i].zEName);
+ if( j>=0 ){
+ if( j==pTab->iPKey ){
+ chngRowid = 1;
+ pRowidExpr = pChanges->a[i].pExpr;
+ iRowidExpr = i;
+ }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
+ chngPk = 1;
}
- }
- if( j>=pTab->nCol ){
+#ifndef SQLITE_OMIT_GENERATED_COLUMNS
+ else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){
+ testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL );
+ testcase( pTab->aCol[j].colFlags & COLFLAG_STORED );
+ sqlite3ErrorMsg(pParse,
+ "cannot UPDATE generated column \"%s\"",
+ pTab->aCol[j].zCnName);
+ goto update_cleanup;
+ }
+#endif
+ aXRef[j] = i;
+ }else{
if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zEName) ){
j = -1;
chngRowid = 1;
diff --git a/src/util.c b/src/util.c
index ecce460e01..703ef0a23a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1130,7 +1130,11 @@ void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRound){
}
p->z = &p->zBuf[i+1];
assert( i+p->n < sizeof(p->zBuf) );
- while( ALWAYS(p->n>0) && p->z[p->n-1]=='0' ){ p->n--; }
+ assert( p->n>0 );
+ while( p->z[p->n-1]=='0' ){
+ p->n--;
+ assert( p->n>0 );
+ }
}
/*
diff --git a/src/vdbe.c b/src/vdbe.c
index 3c9f86bd7a..2cf4b6f607 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -276,7 +276,7 @@ static VdbeCursor *allocateCursor(
*/
Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem;
- int nByte;
+ i64 nByte;
VdbeCursor *pCx = 0;
nByte =
ROUND8P(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField +
@@ -304,7 +304,7 @@ static VdbeCursor *allocateCursor(
pMem->szMalloc = 0;
return 0;
}
- pMem->szMalloc = nByte;
+ pMem->szMalloc = (int)nByte;
}
p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
@@ -7361,7 +7361,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */
*/
case OP_Program: { /* jump0 */
int nMem; /* Number of memory registers for sub-program */
- int nByte; /* Bytes of runtime space required for sub-program */
+ i64 nByte; /* Bytes of runtime space required for sub-program */
Mem *pRt; /* Register to allocate runtime space */
Mem *pMem; /* Used to iterate through memory cells */
Mem *pEnd; /* Last memory cell in new array */
@@ -7412,7 +7412,7 @@ case OP_Program: { /* jump0 */
nByte = ROUND8(sizeof(VdbeFrame))
+ nMem * sizeof(Mem)
+ pProgram->nCsr * sizeof(VdbeCursor*)
- + (pProgram->nOp + 7)/8;
+ + (7 + (i64)pProgram->nOp)/8;
pFrame = sqlite3DbMallocZero(db, nByte);
if( !pFrame ){
goto no_mem;
@@ -7420,7 +7420,7 @@ case OP_Program: { /* jump0 */
sqlite3VdbeMemRelease(pRt);
pRt->flags = MEM_Blob|MEM_Dyn;
pRt->z = (char*)pFrame;
- pRt->n = nByte;
+ pRt->n = (int)nByte;
pRt->xDel = sqlite3VdbeFrameMemDel;
pFrame->v = p;
@@ -7519,12 +7519,14 @@ case OP_Param: { /* out2 */
** statement counter is incremented (immediate foreign key constraints).
*/
case OP_FkCounter: {
- if( db->flags & SQLITE_DeferFKs ){
- db->nDeferredImmCons += pOp->p2;
- }else if( pOp->p1 ){
+ if( pOp->p1 ){
db->nDeferredCons += pOp->p2;
}else{
- p->nFkConstraint += pOp->p2;
+ if( db->flags & SQLITE_DeferFKs ){
+ db->nDeferredImmCons += pOp->p2;
+ }else{
+ p->nFkConstraint += pOp->p2;
+ }
}
break;
}
@@ -8417,6 +8419,7 @@ case OP_VFilter: { /* jump, ncycle */
/* Invoke the xFilter method */
apArg = p->apArg;
+ assert( nArg<=p->napArg );
for(i = 0; ivtabOnConflict;
apArg = p->apArg;
pX = &aMem[pOp->p3];
+ assert( nArg<=p->napArg );
for(i=0; ipTab->aCol[iIdx];
if( pCol->iDflt>0 ){
if( p->apDflt==0 ){
- int nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
+ int nByte;
+ assert( sizeof(sqlite3_value*)*UMXV(p->pTab->nCol) < 0x7fffffff );
+ nByte = sizeof(sqlite3_value*)*p->pTab->nCol;
p->apDflt = (sqlite3_value**)sqlite3DbMallocZero(db, nByte);
if( p->apDflt==0 ) goto preupdate_old_out;
}
@@ -2383,7 +2385,8 @@ int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
*/
assert( p->op==SQLITE_UPDATE );
if( !p->aNew ){
- p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField);
+ assert( sizeof(Mem)*UMXV(p->pCsr->nField) < 0x7fffffff );
+ p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem)*p->pCsr->nField);
if( !p->aNew ){
rc = SQLITE_NOMEM;
goto preupdate_new_out;
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index a972132f2c..ac15fe4dc2 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -726,7 +726,7 @@ static Op *opIterNext(VdbeOpIter *p){
}
if( pRet->p4type==P4_SUBPROGRAM ){
- int nByte = (p->nSub+1)*sizeof(SubProgram*);
+ i64 nByte = (1+(u64)p->nSub)*sizeof(SubProgram*);
int j;
for(j=0; jnSub; j++){
if( p->apSub[j]==pRet->p4.pProgram ) break;
@@ -856,8 +856,8 @@ void sqlite3VdbeAssertAbortable(Vdbe *p){
** (1) For each jump instruction with a negative P2 value (a label)
** resolve the P2 value to an actual address.
**
-** (2) Compute the maximum number of arguments used by any SQL function
-** and store that value in *pMaxFuncArgs.
+** (2) Compute the maximum number of arguments used by the xUpdate/xFilter
+** methods of any virtual table and store that value in *pMaxVtabArgs.
**
** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately
** indicate what the prepared statement actually does.
@@ -870,8 +870,8 @@ void sqlite3VdbeAssertAbortable(Vdbe *p){
** script numbers the opcodes correctly. Changes to this routine must be
** coordinated with changes to mkopcodeh.tcl.
*/
-static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
- int nMaxArgs = *pMaxFuncArgs;
+static void resolveP2Values(Vdbe *p, int *pMaxVtabArgs){
+ int nMaxVtabArgs = *pMaxVtabArgs;
Op *pOp;
Parse *pParse = p->pParse;
int *aLabel = pParse->aLabel;
@@ -916,15 +916,19 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
}
#ifndef SQLITE_OMIT_VIRTUALTABLE
case OP_VUpdate: {
- if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
+ if( pOp->p2>nMaxVtabArgs ) nMaxVtabArgs = pOp->p2;
break;
}
case OP_VFilter: {
int n;
+ /* The instruction immediately prior to VFilter will be an
+ ** OP_Integer that sets the "argc" value for the VFilter. See
+ ** the code where OP_VFilter is generated at tag-20250207a. */
assert( (pOp - p->aOp) >= 3 );
assert( pOp[-1].opcode==OP_Integer );
+ assert( pOp[-1].p2==pOp->p3+1 );
n = pOp[-1].p1;
- if( n>nMaxArgs ) nMaxArgs = n;
+ if( n>nMaxVtabArgs ) nMaxVtabArgs = n;
/* Fall through into the default case */
/* no break */ deliberate_fall_through
}
@@ -965,7 +969,7 @@ resolve_p2_values_loop_exit:
pParse->aLabel = 0;
}
pParse->nLabel = 0;
- *pMaxFuncArgs = nMaxArgs;
+ *pMaxVtabArgs = nMaxVtabArgs;
assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
}
@@ -1194,7 +1198,7 @@ void sqlite3VdbeScanStatus(
const char *zName /* Name of table or index being scanned */
){
if( IS_STMT_SCANSTATUS(p->db) ){
- sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
+ i64 nByte = (1+(i64)p->nScan) * sizeof(ScanStatus);
ScanStatus *aNew;
aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
if( aNew ){
@@ -2643,7 +2647,7 @@ void sqlite3VdbeMakeReady(
int nVar; /* Number of parameters */
int nMem; /* Number of VM memory registers */
int nCursor; /* Number of cursors required */
- int nArg; /* Number of arguments in subprograms */
+ int nArg; /* Max number args to xFilter or xUpdate */
int n; /* Loop counter */
struct ReusableSpace x; /* Reusable bulk memory */
@@ -2715,6 +2719,9 @@ void sqlite3VdbeMakeReady(
p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
}
}
+#ifdef SQLITE_DEBUG
+ p->napArg = nArg;
+#endif
if( db->mallocFailed ){
p->nVar = 0;
@@ -4233,6 +4240,7 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
){
UnpackedRecord *p; /* Unpacked record to return */
int nByte; /* Number of bytes required for *p */
+ assert( sizeof(UnpackedRecord) + sizeof(Mem)*65536 < 0x7fffffff );
nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1);
p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
if( !p ) return 0;
diff --git a/src/vdbeblob.c b/src/vdbeblob.c
index 6cb36da37a..79698d0af4 100644
--- a/src/vdbeblob.c
+++ b/src/vdbeblob.c
@@ -192,12 +192,8 @@ int sqlite3_blob_open(
pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;
/* Now search pTab for the exact column. */
- for(iCol=0; iColnCol; iCol++) {
- if( sqlite3StrICmp(pTab->aCol[iCol].zCnName, zColumn)==0 ){
- break;
- }
- }
- if( iCol==pTab->nCol ){
+ iCol = sqlite3ColumnIndex(pTab, zColumn);
+ if( iCol<0 ){
sqlite3DbFree(db, zErr);
zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn);
rc = SQLITE_ERROR;
diff --git a/src/vdbemem.c b/src/vdbemem.c
index 38ba5abe80..8534849432 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -327,7 +327,7 @@ void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){
return;
}
if( pMem->enc!=SQLITE_UTF8 ) return;
- if( NEVER(pMem->z==0) ) return;
+ assert( pMem->z!=0 );
if( pMem->flags & MEM_Dyn ){
if( pMem->xDel==sqlite3_free
&& sqlite3_msize(pMem->z) >= (u64)(pMem->n+1)
@@ -1440,7 +1440,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
if( pRec==0 ){
Index *pIdx = p->pIdx; /* Index being probed */
- int nByte; /* Bytes of space to allocate */
+ i64 nByte; /* Bytes of space to allocate */
int i; /* Counter variable */
int nCol = pIdx->nColumn; /* Number of index columns including rowid */
@@ -1506,7 +1506,7 @@ static int valueFromFunction(
){
sqlite3_context ctx; /* Context object for function invocation */
sqlite3_value **apVal = 0; /* Function arguments */
- int nVal = 0; /* Size of apVal[] array */
+ int nVal = 0; /* Number of function arguments */
FuncDef *pFunc = 0; /* Function definition */
sqlite3_value *pVal = 0; /* New value */
int rc = SQLITE_OK; /* Return code */
diff --git a/src/vdbesort.c b/src/vdbesort.c
index 239c0a0f36..5774537b81 100644
--- a/src/vdbesort.c
+++ b/src/vdbesort.c
@@ -936,7 +936,7 @@ int sqlite3VdbeSorterInit(
VdbeSorter *pSorter; /* The new sorter */
KeyInfo *pKeyInfo; /* Copy of pCsr->pKeyInfo with db==0 */
int szKeyInfo; /* Size of pCsr->pKeyInfo in bytes */
- int sz; /* Size of pSorter in bytes */
+ i64 sz; /* Size of pSorter in bytes */
int rc = SQLITE_OK;
#if SQLITE_MAX_WORKER_THREADS==0
# define nWorker 0
@@ -964,6 +964,8 @@ int sqlite3VdbeSorterInit(
assert( pCsr->pKeyInfo );
assert( !pCsr->isEphemeral );
assert( pCsr->eCurType==CURTYPE_SORTER );
+ assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*)
+ < 0x7fffffff );
szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
@@ -1177,7 +1179,7 @@ static int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){
*/
static MergeEngine *vdbeMergeEngineNew(int nReader){
int N = 2; /* Smallest power of two >= nReader */
- int nByte; /* Total bytes of space to allocate */
+ i64 nByte; /* Total bytes of space to allocate */
MergeEngine *pNew; /* Pointer to allocated object to return */
assert( nReader<=SORTER_MAX_MERGE_COUNT );
diff --git a/src/vtab.c b/src/vtab.c
index 09f0c2d7f1..e40f60873a 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -479,11 +479,12 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
** schema table. We just need to update that slot with all
** the information we've collected.
**
- ** The VM register number pParse->regRowid holds the rowid of an
+ ** The VM register number pParse->u1.cr.regRowid holds the rowid of an
** entry in the sqlite_schema table that was created for this vtab
** by sqlite3StartTable().
*/
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
+ assert( pParse->isCreate );
sqlite3NestedParse(pParse,
"UPDATE %Q." LEGACY_SCHEMA_TABLE " "
"SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "
@@ -492,7 +493,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
pTab->zName,
pTab->zName,
zStmt,
- pParse->regRowid
+ pParse->u1.cr.regRowid
);
v = sqlite3GetVdbe(pParse);
sqlite3ChangeCookie(pParse, iDb);
diff --git a/src/wal.c b/src/wal.c
index dc463f0569..e7f8b036d8 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1046,7 +1046,7 @@ static SQLITE_NOINLINE int walIndexPageRealloc(
/* Enlarge the pWal->apWiData[] array if required */
if( pWal->nWiData<=iPage ){
- sqlite3_int64 nByte = sizeof(u32*)*(iPage+1);
+ sqlite3_int64 nByte = sizeof(u32*)*(1+(i64)iPage);
volatile u32 **apNew;
apNew = (volatile u32 **)sqlite3Realloc((void *)pWal->apWiData, nByte);
if( !apNew ){
diff --git a/src/wherecode.c b/src/wherecode.c
index 045653aac8..1a0cdc6d71 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -1608,6 +1608,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
}
sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg);
sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1);
+ /* The instruction immediately prior to OP_VFilter must be an OP_Integer
+ ** that sets the "argc" value for xVFilter. This is necessary for
+ ** resolveP2() to work correctly. See tag-20250207a. */
sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg,
pLoop->u.vtab.idxStr,
pLoop->u.vtab.needFree ? P4_DYNAMIC : P4_STATIC);
diff --git a/test/fkey6.test b/test/fkey6.test
index 72de926b52..415daeaf3e 100644
--- a/test/fkey6.test
+++ b/test/fkey6.test
@@ -267,5 +267,40 @@ do_execsql_test 5.1 {
COMMIT;
}
+#-------------------------------------------------------------------------
+#
+reset_db
+
+ifcapable fts5 {
+if {[permutation]!="inmemory_journal"} {
+ do_execsql_test 6.1 {
+ PRAGMA auto_vacuum = 0;
+ PRAGMA writable_schema = 1;
+ INSERT INTO sqlite_schema
+ VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)');
+ }
+ db close
+ sqlite3 db test.db
+ do_execsql_test 6.1 {
+ PRAGMA foreign_keys = 1;
+ PRAGMA writable_schema = 1;
+ }
+ do_execsql_test 6.2 {
+ CREATE TABLE t2(
+ y INTEGER PRIMARY KEY,
+ z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED
+ );
+ }
+ do_execsql_test 6.3 {
+ BEGIN;
+ INSERT INTO t2 VALUES(1,0),(2,1);
+ CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1);
+ INSERT INTO t3 VALUES(3,3);
+ PRAGMA defer_foreign_keys=ON;
+ DELETE FROM t2;
+ COMMIT;
+ }
+}
+}
finish_test
diff --git a/test/like3.test b/test/like3.test
index 0b28574376..01d19a54f6 100644
--- a/test/like3.test
+++ b/test/like3.test
@@ -304,11 +304,19 @@ ifcapable utf16 {
#-------------------------------------------------------------------------
reset_db
+# See forum thread https://sqlite.org/forum/info/d7b90d92ffbfc61f
foreach enc {
UTF-8
UTF-16le
UTF-16be
} {
+ ifcapable icu {
+ if {$enc=="UTF-8"} {
+ # The invalid UTF8 used in these tests is incompatible with ICU
+ # https://sqlite.org/forum/forumpost/2ca8a09a7e
+ continue
+ }
+ }
foreach {tn expr} {
1 "CAST (X'FF' AS TEXT)"
2 "CAST (X'FFBF' AS TEXT)"
diff --git a/test/skipscan6.test b/test/skipscan6.test
index 4f592bc0e0..a97f440eef 100644
--- a/test/skipscan6.test
+++ b/test/skipscan6.test
@@ -167,10 +167,10 @@ do_execsql_test 3.0 {
INSERT INTO t2 SELECT * FROM t3;
ANALYZE;
- SELECT * FROM sqlite_stat1;
+ SELECT * FROM sqlite_stat1 ORDER BY +idx;
} {
- t2 t2_ba {100 20 1 1}
t2 t2_a {100 1}
+ t2 t2_ba {100 20 1 1}
t3 t3_a {100 1}
t3 t3_ba {100 20 1 1}
}
diff --git a/test/speedtest.tcl b/test/speedtest.tcl
index 93b407c94e..1ad92d9ab0 100755
--- a/test/speedtest.tcl
+++ b/test/speedtest.tcl
@@ -27,6 +27,7 @@ Other options include:
--lookaside N SZ Lookahead uses N slots of SZ bytes each.
--pagesize N Use N as the page size.
--quiet | -q "Quite". Put results in file but don't pop up editor
+ --size N Change the test size. 100 means 100%. Default: 5.
--testset TEST Specify the specific testset to use. The default
is "mix1". Other options include: "main", "json",
"cte", "orm", "fp", "rtree".
@@ -78,6 +79,14 @@ for {set i 0} {$i<[llength $argv]} {incr i} {
incr i
set testset [lindex $argv $i]
}
+ -size -
+ --size {
+ incr i
+ set newsize [lindex $argv $i]
+ if {$newsize<1} {set newsize 1}
+ set speedtestflags \
+ [regsub {.-size \d+} $speedtestflags "-size $newsize"]
+ }
-n -
-dryrun -
--dryrun {
@@ -174,9 +183,14 @@ if {!$dryrun} {
}
lappend speedtestflags --testset $testset
set stcmd [list valgrind --tool=cachegrind ./speedtest1 {*}$speedtestflags]
+lappend stcmd speedtest1.db
lappend stcmd >valgrind-out.txt 2>valgrind-err.txt
puts $stcmd
if {!$dryrun} {
+ foreach file {speedtest1.db speedtest1.db-journal speedtest1.db-wal
+ speedtest1.db-shm} {
+ if {[file exists $file]} {file delete $file}
+ }
exec {*}$stcmd
}
diff --git a/test/speedtest1.c b/test/speedtest1.c
index 9d8ddc4545..b49c70098f 100644
--- a/test/speedtest1.c
+++ b/test/speedtest1.c
@@ -64,10 +64,9 @@ static const char zHelp[] =
" --stats Show statistics at the end\n"
" --stmtscanstatus Activate SQLITE_DBCONFIG_STMT_SCANSTATUS\n"
" --temp N N from 0 to 9. 0: no temp table. 9: all temp tables\n"
- " --testset T Run test-set T (main, cte, rtree, orm, fp, json,"
- " debug)\n"
- " Can be a comma-separated list of values, with /SCALE\n"
- " suffixes or macro \"mix1\"\n"
+ " --testset T Run test-set T (main, cte, rtree, orm, fp, json,\n"
+ " star, app, debug). Can be a comma-separated list\n"
+ " of values, with /SCALE suffixes or macro \"mix1\"\n"
" --trace Turn on SQL tracing\n"
" --threads N Use up to N threads for sorting\n"
" --utf16be Set text encoding to UTF-16BE\n"
@@ -113,6 +112,8 @@ struct HashContext {
/* All global state is held in this structure */
static struct Global {
sqlite3 *db; /* The open database connection */
+ const char *zDbName; /* Name of the database file */
+ const char *zVfs; /* --vfs NAME */
sqlite3_stmt *pStmt; /* Current SQL statement */
sqlite3_int64 iStart; /* Start-time for the current test */
sqlite3_int64 iTotal; /* Total time */
@@ -1458,6 +1459,561 @@ void testset_fp(void){
speedtest1_end_test();
}
+/*
+** A testset for star-schema queries.
+*/
+void testset_star(void){
+ int n;
+ int i;
+ n = g.szTest*50;
+ speedtest1_begin_test(100, "Create a fact table with %d entries", n);
+ speedtest1_exec(
+ "CREATE TABLE facttab("
+ " attr01 INT,"
+ " attr02 INT,"
+ " attr03 INT,"
+ " data01 TEXT,"
+ " attr04 INT,"
+ " attr05 INT,"
+ " attr06 INT,"
+ " attr07 INT,"
+ " attr08 INT,"
+ " factid INTEGER PRIMARY KEY,"
+ " data02 TEXT"
+ ");"
+ );
+ speedtest1_exec(
+ "WITH RECURSIVE counter(nnn) AS"
+ "(VALUES(1) UNION ALL SELECT nnn+1 FROM counter WHERE nnn<%d)"
+ "INSERT INTO facttab(attr01,attr02,attr03,attr04,attr05,"
+ "attr06,attr07,attr08,data01,data02)"
+ "SELECT random()%%12, random()%%13, random()%%14, random()%%15,"
+ "random()%%16, random()%%17, random()%%18, random()%%19,"
+ "concat('data-',nnn), format('%%x',random()) FROM counter;",
+ n
+ );
+ speedtest1_end_test();
+
+ speedtest1_begin_test(110, "Create indexes on all attributes columns");
+ for(i=1; i<=8; i++){
+ speedtest1_exec(
+ "CREATE INDEX fact_attr%02d ON facttab(attr%02d)", i, i
+ );
+ }
+ speedtest1_end_test();
+
+ speedtest1_begin_test(120, "Create dimension tables");
+ for(i=1; i<=8; i++){
+ speedtest1_exec(
+ "CREATE TABLE dimension%02d("
+ "beta%02d INT, "
+ "content%02d TEXT, "
+ "rate%02d REAL)",
+ i, i, i, i
+ );
+ speedtest1_exec(
+ "WITH RECURSIVE ctr(nn) AS"
+ " (VALUES(1) UNION ALL SELECT nn+1 FROM ctr WHERE nn<%d)"
+ " INSERT INTO dimension%02d"
+ " SELECT nn%%(%d), concat('content-%02d-',nn),"
+ " (random()%%10000)*0.125 FROM ctr;",
+ 4*(i+1), i, 2*(i+1), i
+ );
+ if( i&2 ){
+ speedtest1_exec(
+ "CREATE INDEX dim%02d ON dimension%02d(beta%02d);",
+ i, i, i
+ );
+ }else{
+ speedtest1_exec(
+ "CREATE INDEX dim%02d ON dimension%02d(beta%02d,content%02d);",
+ i, i, i, i
+ );
+ }
+ }
+ speedtest1_end_test();
+
+ speedtest1_begin_test(130, "Star query over the entire fact table");
+ speedtest1_exec(
+ "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)"
+ " FROM facttab, dimension01, dimension02, dimension03, dimension04,"
+ " dimension05, dimension06, dimension07, dimension08"
+ " WHERE attr01=beta01"
+ " AND attr02=beta02"
+ " AND attr03=beta03"
+ " AND attr04=beta04"
+ " AND attr05=beta05"
+ " AND attr06=beta06"
+ " AND attr07=beta07"
+ " AND attr08=beta08"
+ ";"
+ );
+ speedtest1_end_test();
+
+ speedtest1_begin_test(130, "Star query with LEFT JOINs");
+ speedtest1_exec(
+ "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)"
+ " FROM facttab LEFT JOIN dimension01 ON attr01=beta01"
+ " LEFT JOIN dimension02 ON attr02=beta02"
+ " JOIN dimension03 ON attr03=beta03"
+ " JOIN dimension04 ON attr04=beta04"
+ " JOIN dimension05 ON attr05=beta05"
+ " LEFT JOIN dimension06 ON attr06=beta06"
+ " JOIN dimension07 ON attr07=beta07"
+ " JOIN dimension08 ON attr08=beta08"
+ " WHERE facttab.data01 LIKE 'data-9%%'"
+ ";"
+ );
+ speedtest1_end_test();
+}
+
+/*
+** Tests that simulate an application opening and closing an SQLite database
+** frequently. Fossil is used as the model. The focus here is on rapidly
+** parsing the database schema and rapidly generating prepared statements,
+** in other words, rapid start-up of Fossil-like applications.
+**
+** The same database has no data, so the performance of sqlite3_step() is
+** not significant to this testset.
+*/
+static void testset_app(void){
+ int i, n;
+ speedtest1_begin_test(100, "Generate a Fossil-like database schema");
+ speedtest1_exec(
+ "BEGIN;"
+ "CREATE TABLE blob(\n"
+ " rid INTEGER PRIMARY KEY,\n"
+ " rcvid INTEGER,\n"
+ " size INTEGER,\n"
+ " uuid TEXT UNIQUE NOT NULL,\n"
+ " content BLOB,\n"
+ " CHECK( length(uuid)>=40 AND rid>0 )\n"
+ ");\n"
+ "CREATE TABLE delta(\n"
+ " rid INTEGER PRIMARY KEY,\n"
+ " srcid INTEGER NOT NULL REFERENCES blob\n"
+ ");\n"
+ "CREATE TABLE rcvfrom(\n"
+ " rcvid INTEGER PRIMARY KEY,\n"
+ " uid INTEGER REFERENCES user,\n"
+ " mtime DATETIME,\n"
+ " nonce TEXT UNIQUE,\n"
+ " ipaddr TEXT\n"
+ ");\n"
+ "CREATE TABLE private(rid INTEGER PRIMARY KEY);\n"
+ "CREATE TABLE accesslog(\n"
+ " uname TEXT,\n"
+ " ipaddr TEXT,\n"
+ " success BOOLEAN,\n"
+ " mtime TIMESTAMP\n"
+ ");\n"
+ "CREATE TABLE user(\n"
+ " uid INTEGER PRIMARY KEY,\n"
+ " login TEXT UNIQUE,\n"
+ " pw TEXT,\n"
+ " cap TEXT,\n"
+ " cookie TEXT,\n"
+ " ipaddr TEXT,\n"
+ " cexpire DATETIME,\n"
+ " info TEXT,\n"
+ " mtime DATE,\n"
+ " photo BLOB\n"
+ ", jx TEXT DEFAULT '{}');\n"
+ "CREATE TABLE reportfmt(\n"
+ " rn INTEGER PRIMARY KEY,\n"
+ " owner TEXT,\n"
+ " title TEXT UNIQUE,\n"
+ " mtime INTEGER,\n"
+ " cols TEXT,\n"
+ " sqlcode TEXT\n"
+ ", jx TEXT DEFAULT '{}');\n"
+ "CREATE TABLE config(\n"
+ " name TEXT PRIMARY KEY NOT NULL,\n"
+ " value CLOB, mtime INTEGER,\n"
+ " CHECK( typeof(name)='text' AND length(name)>=1 )\n"
+ ") WITHOUT ROWID;\n"
+ "CREATE TABLE shun(uuid PRIMARY KEY, mtime INTEGER, scom TEXT)\n"
+ " WITHOUT ROWID;\n"
+ "CREATE TABLE concealed(\n"
+ " hash TEXT PRIMARY KEY,\n"
+ " content TEXT\n"
+ ", mtime INTEGER) WITHOUT ROWID;\n"
+ "CREATE TABLE admin_log(\n"
+ " id INTEGER PRIMARY KEY,\n"
+ " time INTEGER, -- Seconds since 1970\n"
+ " page TEXT, -- path of page\n"
+ " who TEXT, -- User who made the change\n"
+ " what TEXT -- What changed\n"
+ ");\n"
+ "CREATE TABLE unversioned(\n"
+ " name TEXT PRIMARY KEY,\n"
+ " rcvid INTEGER,\n"
+ " mtime DATETIME,\n"
+ " hash TEXT,\n"
+ " sz INTEGER,\n"
+ " encoding INT,\n"
+ " content BLOB\n"
+ ") WITHOUT ROWID;\n"
+ "CREATE TABLE subscriber(\n"
+ " subscriberId INTEGER PRIMARY KEY,\n"
+ " subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE,\n"
+ " semail TEXT UNIQUE COLLATE nocase,\n"
+ " suname TEXT,\n"
+ " sverified BOOLEAN DEFAULT true,\n"
+ " sdonotcall BOOLEAN,\n"
+ " sdigest BOOLEAN,\n"
+ " ssub TEXT,\n"
+ " sctime INTDATE,\n"
+ " mtime INTDATE,\n"
+ " smip TEXT\n"
+ ", lastContact INT);\n"
+ "CREATE TABLE pending_alert(\n"
+ " eventid TEXT PRIMARY KEY,\n"
+ " sentSep BOOLEAN DEFAULT false,\n"
+ " sentDigest BOOLEAN DEFAULT false\n"
+ ", sentMod BOOLEAN DEFAULT false) WITHOUT ROWID;\n"
+ "CREATE TABLE filename(\n"
+ " fnid INTEGER PRIMARY KEY,\n"
+ " name TEXT UNIQUE\n"
+ ") STRICT;\n"
+ "CREATE TABLE mlink(\n"
+ " mid INTEGER,\n"
+ " fid INTEGER,\n"
+ " pmid INTEGER,\n"
+ " pid INTEGER,\n"
+ " fnid INTEGER REFERENCES filename,\n"
+ " pfnid INTEGER,\n"
+ " mperm INTEGER,\n"
+ " isaux INT DEFAULT 0\n"
+ ") STRICT;\n"
+ "CREATE TABLE plink(\n"
+ " pid INTEGER REFERENCES blob,\n"
+ " cid INTEGER REFERENCES blob,\n"
+ " isprim INT,\n"
+ " mtime REAL,\n"
+ " baseid INTEGER REFERENCES blob,\n"
+ " UNIQUE(pid, cid)\n"
+ ") STRICT;\n"
+ "CREATE TABLE leaf(rid INTEGER PRIMARY KEY);\n"
+ "CREATE TABLE event(\n"
+ " type TEXT,\n"
+ " mtime REAL,\n"
+ " objid INTEGER PRIMARY KEY,\n"
+ " tagid INTEGER,\n"
+ " uid INTEGER REFERENCES user,\n"
+ " bgcolor TEXT,\n"
+ " euser TEXT,\n"
+ " user TEXT,\n"
+ " ecomment TEXT,\n"
+ " comment TEXT,\n"
+ " brief TEXT,\n"
+ " omtime REAL\n"
+ ") STRICT;\n"
+ "CREATE TABLE phantom(\n"
+ " rid INTEGER PRIMARY KEY\n"
+ ");\n"
+ "CREATE TABLE orphan(\n"
+ " rid INTEGER PRIMARY KEY,\n"
+ " baseline INTEGER\n"
+ ") STRICT;\n"
+ "CREATE TABLE unclustered(\n"
+ " rid INTEGER PRIMARY KEY\n"
+ ");\n"
+ "CREATE TABLE unsent(\n"
+ " rid INTEGER PRIMARY KEY\n"
+ ");\n"
+ "CREATE TABLE tag(\n"
+ " tagid INTEGER PRIMARY KEY,\n"
+ " tagname TEXT UNIQUE\n"
+ ") STRICT;\n"
+ "CREATE TABLE tagxref(\n"
+ " tagid INTEGER REFERENCES tag,\n"
+ " tagtype INTEGER,\n"
+ " srcid INTEGER REFERENCES blob,\n"
+ " origid INTEGER REFERENCES blob,\n"
+ " value TEXT,\n"
+ " mtime REAL,\n"
+ " rid INTEGER REFERENCES blob,\n"
+ " UNIQUE(rid, tagid)\n"
+ ") STRICT;\n"
+ "CREATE TABLE backlink(\n"
+ " target TEXT,\n"
+ " srctype INT,\n"
+ " srcid INT,\n"
+ " mtime REAL,\n"
+ " UNIQUE(target, srctype, srcid)\n"
+ ") STRICT;\n"
+ "CREATE TABLE attachment(\n"
+ " attachid INTEGER PRIMARY KEY,\n"
+ " isLatest INT DEFAULT 0,\n"
+ " mtime REAL,\n"
+ " src TEXT,\n"
+ " target TEXT,\n"
+ " filename TEXT,\n"
+ " comment TEXT,\n"
+ " user TEXT\n"
+ ") STRICT;\n"
+ "CREATE TABLE cherrypick(\n"
+ " parentid INT,\n"
+ " childid INT,\n"
+ " isExclude INT DEFAULT false,\n"
+ " PRIMARY KEY(parentid, childid)\n"
+ ") WITHOUT ROWID, STRICT;\n"
+ "CREATE TABLE vcache(\n"
+ " vid INTEGER, -- check-in ID\n"
+ " fname TEXT, -- filename\n"
+ " rid INTEGER, -- artifact ID\n"
+ " PRIMARY KEY(vid,fname)\n"
+ ") WITHOUT ROWID;\n"
+ "CREATE TABLE synclog(\n"
+ " sfrom TEXT,\n"
+ " sto TEXT,\n"
+ " stime INT NOT NULL,\n"
+ " stype TEXT,\n"
+ " PRIMARY KEY(sfrom,sto)\n"
+ ") WITHOUT ROWID;\n"
+ "CREATE TABLE chat(\n"
+ " msgid INTEGER PRIMARY KEY AUTOINCREMENT,\n"
+ " mtime JULIANDAY,\n"
+ " lmtime TEXT,\n"
+ " xfrom TEXT,\n"
+ " xmsg TEXT,\n"
+ " fname TEXT,\n"
+ " fmime TEXT,\n"
+ " mdel INT,\n"
+ " file BLOB\n"
+ ");\n"
+ "CREATE TABLE ftsdocs(\n"
+ " rowid INTEGER PRIMARY KEY,\n"
+ " type CHAR(1),\n"
+ " rid INTEGER,\n"
+ " name TEXT,\n"
+ " idxed BOOLEAN,\n"
+ " label TEXT,\n"
+ " url TEXT,\n"
+ " mtime DATE,\n"
+ " bx TEXT,\n"
+ " UNIQUE(type,rid)\n"
+ ");\n"
+ "CREATE TABLE ticket(\n"
+ " -- Do not change any column that begins with tkt_\n"
+ " tkt_id INTEGER PRIMARY KEY,\n"
+ " tkt_uuid TEXT UNIQUE,\n"
+ " tkt_mtime DATE,\n"
+ " tkt_ctime DATE,\n"
+ " -- Add as many fields as required below this line\n"
+ " type TEXT,\n"
+ " status TEXT,\n"
+ " subsystem TEXT,\n"
+ " priority TEXT,\n"
+ " severity TEXT,\n"
+ " foundin TEXT,\n"
+ " private_contact TEXT,\n"
+ " resolution TEXT,\n"
+ " title TEXT,\n"
+ " comment TEXT\n"
+ ");\n"
+ "CREATE TABLE ticketchng(\n"
+ " -- Do not change any column that begins with tkt_\n"
+ " tkt_id INTEGER REFERENCES ticket,\n"
+ " tkt_rid INTEGER REFERENCES blob,\n"
+ " tkt_mtime DATE,\n"
+ " tkt_user TEXT,\n"
+ " -- Add as many fields as required below this line\n"
+ " login TEXT,\n"
+ " username TEXT,\n"
+ " mimetype TEXT,\n"
+ " icomment TEXT\n"
+ ");\n"
+ "CREATE TABLE forumpost(\n"
+ " fpid INTEGER PRIMARY KEY,\n"
+ " froot INT,\n"
+ " fprev INT,\n"
+ " firt INT,\n"
+ " fmtime REAL\n"
+ ");\n"
+ "CREATE INDEX delta_i1 ON delta(srcid);\n"
+ "CREATE INDEX blob_rcvid ON blob(rcvid);\n"
+ "CREATE INDEX subscriberUname\n"
+ " ON subscriber(suname) WHERE suname IS NOT NULL;\n"
+ "CREATE INDEX mlink_i1 ON mlink(mid);\n"
+ "CREATE INDEX mlink_i2 ON mlink(fnid);\n"
+ "CREATE INDEX mlink_i3 ON mlink(fid);\n"
+ "CREATE INDEX mlink_i4 ON mlink(pid);\n"
+ "CREATE INDEX plink_i2 ON plink(cid,pid);\n"
+ "CREATE INDEX event_i1 ON event(mtime);\n"
+ "CREATE INDEX orphan_baseline ON orphan(baseline);\n"
+ "CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);\n"
+ "CREATE INDEX backlink_src ON backlink(srcid, srctype);\n"
+ "CREATE INDEX attachment_idx1 ON attachment(target, filename, mtime);\n"
+ "CREATE INDEX attachment_idx2 ON attachment(src);\n"
+ "CREATE INDEX cherrypick_cid ON cherrypick(childid);\n"
+ "CREATE INDEX ftsdocIdxed ON ftsdocs(type,rid,name) WHERE idxed==0;\n"
+ "CREATE INDEX ftsdocName ON ftsdocs(name) WHERE type='w';\n"
+ "CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime);\n"
+ "CREATE INDEX forumthread ON forumpost(froot,fmtime);\n"
+ "CREATE VIEW artifact(rid,rcvid,size,atype,srcid,hash,content) AS\n"
+ " SELECT blob.rid,rcvid,size,1,srcid,uuid,content\n"
+ " FROM blob LEFT JOIN delta ON (blob.rid=delta.rid);\n"
+ "CREATE VIEW ftscontent AS\n"
+ " SELECT rowid, type, rid, name, idxed, label, url, mtime,\n"
+ " title(type,rid,name) AS 'title', body(type,rid,name) AS 'body'\n"
+ " FROM ftsdocs;\n"
+ );
+ if( sqlite3_compileoption_used("ENABLE_FTS5") ){
+ speedtest1_exec(
+ "CREATE VIRTUAL TABLE ftsidx\n"
+ " USING fts5(content=\"ftscontent\", title, body);\n"
+ "CREATE VIRTUAL TABLE chatfts1 USING fts5(\n"
+ " xmsg, content=chat, content_rowid=msgid,tokenize=porter);\n"
+ );
+ }else{
+ speedtest1_exec(
+ "CREATE TABLE ftsidx_data(id INTEGER PRIMARY KEY, block BLOB);\n"
+ "CREATE TABLE ftsidx_idx(segid, term, pgno, PRIMARY KEY(segid, term))\n"
+ " WITHOUT ROWID;\n"
+ "CREATE TABLE ftsidx_docsize(id INTEGER PRIMARY KEY, sz BLOB);\n"
+ "CREATE TABLE ftsidx_config(k PRIMARY KEY, v) WITHOUT ROWID;\n"
+ "CREATE TABLE chatfts1_data(id INTEGER PRIMARY KEY, block BLOB);\n"
+ "CREATE TABLE chatfts1_idx(segid, term, pgno, PRIMARY KEY(segid, term))\n"
+ " WITHOUT ROWID;\n"
+ "CREATE TABLE chatfts1_docsize(id INTEGER PRIMARY KEY, sz BLOB);\n"
+ "CREATE TABLE chatfts1_config(k PRIMARY KEY, v) WITHOUT ROWID;\n"
+ );
+ }
+ speedtest1_exec(
+ "ANALYZE sqlite_schema;\n"
+ "INSERT INTO sqlite_stat1(tbl,idx,stat) VALUES\n"
+ " ('ftsidx_config','ftsidx_config','1 1'),\n"
+ " ('ftsidx_idx','ftsidx_idx','4215 401 1'),\n"
+ " ('user','sqlite_autoindex_user_1','25 1'),\n"
+ " ('phantom',NULL,'26'),\n"
+ " ('reportfmt','sqlite_autoindex_reportfmt_1','9 1'),\n"
+ " ('rcvfrom','sqlite_autoindex_rcvfrom_1','18445 401'),\n"
+ " ('private',NULL,'99'),\n"
+ " ('mlink','mlink_i4','116678 401'),\n"
+ " ('mlink','mlink_i3','121212 2'),\n"
+ " ('mlink','mlink_i2','106372 401'),\n"
+ " ('mlink','mlink_i1','99298 5'),\n"
+ " ('ftsidx_data',NULL,'3795'),\n"
+ " ('leaf',NULL,'1559'),\n"
+ " ('delta','delta_i1','66340 1'),\n"
+ " ('unversioned','unversioned','3 1'),\n"
+ " ('pending_alert','pending_alert','3 1'),\n"
+ " ('cherrypick','cherrypick_cid','680 2'),\n"
+ " ('cherrypick','cherrypick','628 1 1'),\n"
+ " ('config','config','128 1'),\n"
+ " ('ftsidx_docsize',NULL,'33848'),\n"
+ " ('event','event_i1','36096 1'),\n"
+ " ('plink','plink_i2','38236 1 1'),\n"
+ " ('plink','sqlite_autoindex_plink_1','38357 1 1'),\n"
+ " ('shun','shun','10 1'),\n"
+ " ('concealed','concealed','110 1'),\n"
+ " ('vcache','vcache','1888 401 1'),\n"
+ " ('ftsdocs','ftsdocName','19 1'),\n"
+ " ('ftsdocs','ftsdocIdxed','168 84 1 1'),\n"
+ " ('ftsdocs','sqlite_autoindex_ftsdocs_1','37312 401 1'),\n"
+ " ('subscriber','subscriberUname','5 1'),\n"
+ " ('subscriber','sqlite_autoindex_subscriber_2','37 1'),\n"
+ " ('subscriber','sqlite_autoindex_subscriber_1','37 1'),\n"
+ " ('tag','sqlite_autoindex_tag_1','2990 1'),\n"
+ " ('filename','sqlite_autoindex_filename_1','3168 1'),\n"
+ " ('chat',NULL,'56124'),\n"
+ " ('tagxref','tagxref_i1','40992 401 2'),\n"
+ " ('tagxref','sqlite_autoindex_tagxref_1','79233 3 1'),\n"
+ " ('attachment','attachment_idx2','11 1'),\n"
+ " ('attachment','attachment_idx1','11 2 2 1'),\n"
+ " ('blob','blob_rcvid','128240 201'),\n"
+ " ('blob','sqlite_autoindex_blob_1','126480 1'),\n"
+ " ('synclog','synclog','12 3 1'),\n"
+ " ('backlink','backlink_src','2160 2 2'),\n"
+ " ('backlink','sqlite_autoindex_backlink_1','2340 2 2 1'),\n"
+ " ('accesslog',NULL,'38'),\n"
+ " ('chatfts1_config','chatfts1_config','1 1'),\n"
+ " ('chatfts1_idx','chatfts1_idx','688 230 1'),\n"
+ " ('ticket','sqlite_autoindex_ticket_1','794 1'),\n"
+ " ('ticketchng','ticketchng_idx1','2089 3 1'),\n"
+ " ('forumpost','forumthread','4 4 1'),\n"
+ " ('unclustered',NULL,'12');\n"
+ "COMMIT;"
+ );
+ speedtest1_end_test();
+
+ n = g.szTest*3;
+ speedtest1_begin_test(110, "Open and use the database %d times", n);
+ for(i=0; i=$date OR parent.pid=$pid)\n"
+ " ORDER BY mtime DESC LIMIT 10\n"
+ " )\n"
+ " INSERT OR IGNORE INTO ok SELECT rid FROM ancestor;"
+ );
+ sqlite3_close(dbAux);
+ g.db = dbMain;
+ }
+ speedtest1_end_test();
+}
+
#ifdef SQLITE_ENABLE_RTREE
/* Generate two numbers between 1 and mx. The first number is less than
** the second. Usually the numbers are near each other but can sometimes
@@ -2404,11 +2960,9 @@ int main(int argc, char **argv){
int memDb = 0; /* --memdb. Use an in-memory database */
int openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
; /* SQLITE_OPEN_xxx flags. */
- char *zTSet = "main"; /* Which --testset torun */
- const char * zVfs = 0; /* --vfs NAME */
+ char *zTSet = "mix1"; /* Which --testset torun */
int doTrace = 0; /* True for --trace */
const char *zEncoding = 0; /* --utf16be or --utf16le */
- const char *zDbName = 0; /* Name of the test database */
void *pHeap = 0; /* Allocated heap space */
void *pLook = 0; /* Allocated lookaside space */
@@ -2417,6 +2971,10 @@ int main(int argc, char **argv){
int i; /* Loop counter */
int rc; /* API return code */
+ /* "mix1" is a macro testset: */
+ static char zMix1Tests[] =
+ "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star,app";
+
#ifdef SQLITE_SPEEDTEST1_WASM
/* Resetting all state is important for the WASM build, which may
** call main() multiple times. */
@@ -2435,6 +2993,8 @@ int main(int argc, char **argv){
sqlite3_libversion(), sqlite3_sourceid());
/* Process command-line arguments */
+ g.zDbName = 0;
+ g.zVfs = 0;
g.zWR = "";
g.zNN = "";
g.zPK = "UNIQUE";
@@ -2560,10 +3120,8 @@ int main(int argc, char **argv){
}
g.eTemp = argv[i][0] - '0';
}else if( strcmp(z,"testset")==0 ){
- static char zMix1Tests[] = "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10";
ARGC_VALUE_CHECK(1);
zTSet = argv[++i];
- if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests;
}else if( strcmp(z,"trace")==0 ){
doTrace = 1;
}else if( strcmp(z,"threads")==0 ){
@@ -2580,7 +3138,7 @@ int main(int argc, char **argv){
#endif
}else if( strcmp(z,"vfs")==0 ){
ARGC_VALUE_CHECK(1);
- zVfs = argv[++i];
+ g.zVfs = argv[++i];
}else if( strcmp(z,"reserve")==0 ){
ARGC_VALUE_CHECK(1);
g.nReserve = atoi(argv[++i]);
@@ -2610,8 +3168,8 @@ int main(int argc, char **argv){
fatal_error("unknown option: %s\nUse \"%s -?\" for help\n",
argv[i], argv[0]);
}
- }else if( zDbName==0 ){
- zDbName = argv[i];
+ }else if( g.zDbName==0 ){
+ g.zDbName = argv[i];
}else{
fatal_error("surplus argument: %s\nUse \"%s -?\" for help\n",
argv[i], argv[0]);
@@ -2640,8 +3198,8 @@ int main(int argc, char **argv){
#endif
sqlite3_initialize();
- if( zDbName!=0 ){
- sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
+ if( g.zDbName!=0 ){
+ sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfs);
/* For some VFSes, e.g. opfs, unlink() is not sufficient. Use the
** selected (or default) VFS's xDelete method to delete the
** database. This is specifically important for the "opfs" VFS
@@ -2649,15 +3207,15 @@ int main(int argc, char **argv){
** can be cleaned up properly. For historical compatibility, we'll
** also simply unlink(). */
if( pVfs!=0 ){
- pVfs->xDelete(pVfs, zDbName, 1);
+ pVfs->xDelete(pVfs, g.zDbName, 1);
}
- unlink(zDbName);
+ unlink(g.zDbName);
}
/* Open the database and the input file */
- if( sqlite3_open_v2(memDb ? ":memory:" : zDbName, &g.db,
- openFlags, zVfs) ){
- fatal_error("Cannot open database file: %s\n", zDbName);
+ if( sqlite3_open_v2(memDb ? ":memory:" : g.zDbName, &g.db,
+ openFlags, g.zVfs) ){
+ fatal_error("Cannot open database file: %s\n", g.zDbName);
}
#if SQLITE_VERSION_NUMBER>=3006001
if( nLook>0 && szLook>0 ){
@@ -2715,6 +3273,7 @@ int main(int argc, char **argv){
}
if( g.bExplain ) printf(".explain\n.echo on\n");
+ if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests;
do{
char *zThisTest = zTSet;
char *zSep;
@@ -2749,6 +3308,10 @@ int main(int argc, char **argv){
testset_orm();
}else if( strcmp(zThisTest,"cte")==0 ){
testset_cte();
+ }else if( strcmp(zThisTest,"star")==0 ){
+ testset_star();
+ }else if( strcmp(zThisTest,"app")==0 ){
+ testset_app();
}else if( strcmp(zThisTest,"fp")==0 ){
testset_fp();
}else if( strcmp(zThisTest,"json")==0 ){
diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh
index c26ca47bf1..c26ac8c73c 100644
--- a/tool/mkautoconfamal.sh
+++ b/tool/mkautoconfamal.sh
@@ -25,10 +25,14 @@ VERSION=`cat $TOP/VERSION`
HASH=`cut -c1-10 $TOP/manifest.uuid`
DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12`
-# Verify that the version number in the TEA autoconf file is correct.
-# Fail with an error if not.
+# Inject the current version into the TEA autoconf file.
#
-if grep $VERSION $TOP/autoconf/tea/configure.ac
+sed -e "s/@VERSION@/$VERSION/" \
+ < $TOP/autoconf/tea/configure.ac.in \
+ > $TOP/autoconf/tea/configure.ac
+# And then verify that that worked...
+#
+if grep $VERSION $TOP/autoconf/tea/configure.ac > /dev/null
then echo "TEA version number ok"
else echo "TEA version number mismatch. Should be $VERSION"; exit 1
fi
@@ -91,10 +95,8 @@ cat < tea/generic/tclsqlite3.c
EOF
cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
-sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" tea/configure.ac > tmp
-mv tmp tea/configure.ac
-
cd tea
+rm -f configure.ac.in
autoconf
rm -rf autom4te.cache
diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl
index d7b498b68b..0577437c99 100755
--- a/tool/mkctimec.tcl
+++ b/tool/mkctimec.tcl
@@ -4,13 +4,13 @@
#
# const char **azCompileOpt[]
#
-# definition used in src/ctime.c, run this script from
-# the checkout root. It generates src/ctime.c .
+# definition used in ctime.c, run this script from
+# the checkout root. It generates ctime.c .
#
-# Results are normally written into src/ctime.c. But if an argument is
+# Results are normally written into ctime.c. But if an argument is
# provided, results are written there instead. Examples:
#
-# tclsh tool/mkctimec.tcl ;# <-- results to src/ctime.c
+# tclsh tool/mkctimec.tcl ;# <-- ctime.c
#
# tclsh tool/mkctimec.tcl /dev/tty ;# <-- results to the terminal
#
@@ -442,7 +442,7 @@ foreach v $value2_options {
if {$argc>0} {
set destfile [lindex $argv 0]
} else {
- set destfile "[file dir [file dir [file normal $argv0]]]/src/ctime.c"
+ set destfile ctime.c
puts "Overwriting $destfile..."
}
diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl
index dd22c19b95..d38572f359 100644
--- a/tool/mkpragmatab.tcl
+++ b/tool/mkpragmatab.tcl
@@ -4,16 +4,16 @@
#
# To add new pragmas, first add the name and other relevant attributes
# of the pragma to the "pragma_def" object below. Then run this script
-# to generate the ../src/pragma.h header file that contains macros and
+# to generate the pragma.h header file that contains macros and
# the lookup table needed for pragma name lookup in the pragma.c module.
# Then add the extra "case PragTyp_XXXXX:" and subsequent code for the
# new pragma in ../src/pragma.c.
#
-# The results are normally written into the ../src/pragma.h file. However,
+# The results are normally written into the pragma.h file. However,
# if an alternative output file name is provided as an argument, then
# results are written into the alternative. For example:
#
-# tclsh tool/mkpragmatab.tcl ;# <--- Results to src/pragma.h
+# tclsh tool/mkpragmatab.tcl ;# <--- Results to pragma.h
#
# tclsh tool/mkpragmatab.tcl /dev/tty ;# <-- results to terminal
#
@@ -419,7 +419,7 @@ set pragma_def {
if {$argc>0} {
set destfile [lindex $argv 0]
} else {
- set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h"
+ set destfile "pragma.h"
puts "Overwriting $destfile with new pragma table..."
}
set fd [open $destfile wb]
diff --git a/tool/showdb.c b/tool/showdb.c
index 12c2e271b7..f0bd9737cf 100644
--- a/tool/showdb.c
+++ b/tool/showdb.c
@@ -27,7 +27,7 @@ typedef sqlite3_uint64 u64; /* unsigned 64-bit */
static struct GlobalData {
- u32 pagesize; /* Size of a database page */
+ i64 pagesize; /* Size of a database page */
int dbfd; /* File descriptor for reading the DB */
u32 mxPage; /* Last page number */
int perLine; /* HEX elements to print per line */
@@ -1178,7 +1178,7 @@ int main(int argc, char **argv){
if( g.pagesize==0 ) g.pagesize = 1024;
sqlite3_free(zPgSz);
- printf("Pagesize: %d\n", g.pagesize);
+ printf("Pagesize: %d\n", (int)g.pagesize);
g.mxPage = (u32)((szFile+g.pagesize-1)/g.pagesize);
printf("Available pages: 1..%u\n", g.mxPage);
@@ -1218,7 +1218,8 @@ int main(int argc, char **argv){
iEnd = strtol(&zLeft[2], 0, 0);
checkPageValidity(iEnd);
}else if( zLeft && zLeft[0]=='b' ){
- int ofst, nByte, hdrSize;
+ i64 ofst;
+ int nByte, hdrSize;
unsigned char *a;
if( iStart==1 ){
ofst = hdrSize = 100;
diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl
index b65e223db9..921bb0976e 100644
--- a/tool/srctree-check.tcl
+++ b/tool/srctree-check.tcl
@@ -4,9 +4,7 @@
# various aspects of the source tree are up-to-date. Items checked include:
#
# * Makefile.msc and autoconf/Makefile.msc agree
-# * src/ctime.tcl is consistent with tool/mkctimec.tcl
# * VERSION agrees with autoconf/tea/configure.ac
-# * src/pragma.h agrees with tool/mkpragmatab.tcl
#
# Other tests might be added later.
#
@@ -36,21 +34,6 @@ set TCLSH [info nameofexe]
#
set NERR 0
-######################### autoconf/tea/configure.ac ###########################
-
-set confac [readfile $ROOT/autoconf/tea/configure.ac]
-set vers [readfile $ROOT/VERSION]
-set pattern {AC_INIT([sqlite],[}
-append pattern [string trim $vers]
-append pattern {])}
-if {[string first $pattern $confac]<=0} {
- puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION"
- puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the"
- puts "...... correct version number in AC_INIT()"
- incr NERR
-}
-unset confac
-
######################### autoconf/Makefile.msc ###############################
set f1 [readfile $ROOT/autoconf/Makefile.msc]
@@ -62,31 +45,3 @@ if {$f1 != $f2} {
puts "...... Fix: tclsh tool/mkmsvcmin.tcl"
incr NERR
}
-
-######################### src/pragma.h ########################################
-
-set f1 [readfile $ROOT/src/pragma.h]
-exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt
-set f2 [readfile tmp2.txt]
-file delete tmp2.txt
-if {$f1 != $f2} {
- puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl"
- puts "...... Fix: tclsh tool/mkpragmatab.tcl"
- incr NERR
-}
-
-######################### src/ctime.c ########################################
-
-set f1 [readfile $ROOT/src/ctime.c]
-exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt
-set f2 [readfile tmp3.txt]
-file delete tmp3.txt
-if {$f1 != $f2} {
- puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl"
- puts "..... Fix: tclsh tool/mkctimec.tcl"
- incr NERR
-}
-
-# If any errors are seen, exit 1 so that the build will fail.
-#
-if {$NERR>0} {exit 1}