Fossil SCM

Update the built-in SQLite to the latest 3.15.0 beta for testing. Add new performance-enhancing compile-time options to the SQLite build.

drh 2016-10-02 00:45 trunk
Commit dfe32f53acc2c1dfe5a07983d9308133d8c7c233
--- src/main.mk
+++ src/main.mk
@@ -498,10 +498,12 @@
498498
-DSQLITE_OMIT_DECLTYPE \
499499
-DSQLITE_OMIT_DEPRECATED \
500500
-DSQLITE_OMIT_PROGRESS_CALLBACK \
501501
-DSQLITE_OMIT_SHARED_CACHE \
502502
-DSQLITE_OMIT_LOAD_EXTENSION \
503
+ -DSQLITE_MAX_EXPR_DEPTH=0 \
504
+ -DSQLITE_USE_ALLOCA \
503505
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
504506
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
505507
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
506508
-DSQLITE_ENABLE_FTS4 \
507509
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
508510
--- src/main.mk
+++ src/main.mk
@@ -498,10 +498,12 @@
498 -DSQLITE_OMIT_DECLTYPE \
499 -DSQLITE_OMIT_DEPRECATED \
500 -DSQLITE_OMIT_PROGRESS_CALLBACK \
501 -DSQLITE_OMIT_SHARED_CACHE \
502 -DSQLITE_OMIT_LOAD_EXTENSION \
 
 
503 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
504 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
505 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
506 -DSQLITE_ENABLE_FTS4 \
507 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
508
--- src/main.mk
+++ src/main.mk
@@ -498,10 +498,12 @@
498 -DSQLITE_OMIT_DECLTYPE \
499 -DSQLITE_OMIT_DEPRECATED \
500 -DSQLITE_OMIT_PROGRESS_CALLBACK \
501 -DSQLITE_OMIT_SHARED_CACHE \
502 -DSQLITE_OMIT_LOAD_EXTENSION \
503 -DSQLITE_MAX_EXPR_DEPTH=0 \
504 -DSQLITE_USE_ALLOCA \
505 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
506 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
507 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
508 -DSQLITE_ENABLE_FTS4 \
509 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
510
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -164,10 +164,12 @@
164164
-DSQLITE_OMIT_DECLTYPE
165165
-DSQLITE_OMIT_DEPRECATED
166166
-DSQLITE_OMIT_PROGRESS_CALLBACK
167167
-DSQLITE_OMIT_SHARED_CACHE
168168
-DSQLITE_OMIT_LOAD_EXTENSION
169
+ -DSQLITE_MAX_EXPR_DEPTH=0
170
+ -DSQLITE_USE_ALLOCA
169171
-DSQLITE_ENABLE_LOCKING_STYLE=0
170172
-DSQLITE_DEFAULT_FILE_FORMAT=4
171173
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
172174
-DSQLITE_ENABLE_FTS4
173175
-DSQLITE_ENABLE_FTS3_PARENTHESIS
174176
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -164,10 +164,12 @@
164 -DSQLITE_OMIT_DECLTYPE
165 -DSQLITE_OMIT_DEPRECATED
166 -DSQLITE_OMIT_PROGRESS_CALLBACK
167 -DSQLITE_OMIT_SHARED_CACHE
168 -DSQLITE_OMIT_LOAD_EXTENSION
 
 
169 -DSQLITE_ENABLE_LOCKING_STYLE=0
170 -DSQLITE_DEFAULT_FILE_FORMAT=4
171 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
172 -DSQLITE_ENABLE_FTS4
173 -DSQLITE_ENABLE_FTS3_PARENTHESIS
174
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -164,10 +164,12 @@
164 -DSQLITE_OMIT_DECLTYPE
165 -DSQLITE_OMIT_DEPRECATED
166 -DSQLITE_OMIT_PROGRESS_CALLBACK
167 -DSQLITE_OMIT_SHARED_CACHE
168 -DSQLITE_OMIT_LOAD_EXTENSION
169 -DSQLITE_MAX_EXPR_DEPTH=0
170 -DSQLITE_USE_ALLOCA
171 -DSQLITE_ENABLE_LOCKING_STYLE=0
172 -DSQLITE_DEFAULT_FILE_FORMAT=4
173 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
174 -DSQLITE_ENABLE_FTS4
175 -DSQLITE_ENABLE_FTS3_PARENTHESIS
176
+201 -221
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381381
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382382
** [sqlite_version()] and [sqlite_source_id()].
383383
*/
384384
#define SQLITE_VERSION "3.15.0"
385385
#define SQLITE_VERSION_NUMBER 3015000
386
-#define SQLITE_SOURCE_ID "2016-09-28 16:05:53 40c0fb0af678797c39a99853f9f4102464c16f4b"
386
+#define SQLITE_SOURCE_ID "2016-10-01 23:55:23 fe07609efc31c4639c40fbda501c55f443756ad2"
387387
388388
/*
389389
** CAPI3REF: Run-Time Library Version Numbers
390390
** KEYWORDS: sqlite3_version, sqlite3_sourceid
391391
**
@@ -15515,39 +15515,27 @@
1551515515
u8 mayAbort; /* True if statement may throw an ABORT exception */
1551615516
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
1551715517
u8 okConstFactor; /* OK to factor out constants */
1551815518
u8 disableLookaside; /* Number of times lookaside has been disabled */
1551915519
u8 nColCache; /* Number of entries in aColCache[] */
15520
- int aTempReg[8]; /* Holding area for temporary registers */
1552115520
int nRangeReg; /* Size of the temporary register block */
1552215521
int iRangeReg; /* First register in temporary register block */
1552315522
int nErr; /* Number of errors seen */
1552415523
int nTab; /* Number of previously allocated VDBE cursors */
1552515524
int nMem; /* Number of memory cells used so far */
15526
- int nSet; /* Number of sets used so far */
1552715525
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
1552815526
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
15529
- int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
1553015527
int ckBase; /* Base register of data during check constraints */
1553115528
int iSelfTab; /* Table of an index whose exprs are being coded */
1553215529
int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
1553315530
int iCacheCnt; /* Counter used to generate aColCache[].lru values */
1553415531
int nLabel; /* Number of labels used */
1553515532
int *aLabel; /* Space to hold the labels */
15536
- struct yColCache {
15537
- int iTable; /* Table cursor number */
15538
- i16 iColumn; /* Table column number */
15539
- u8 tempReg; /* iReg is a temp register that needs to be freed */
15540
- int iLevel; /* Nesting level */
15541
- int iReg; /* Reg with value of this column. 0 means none. */
15542
- int lru; /* Least recently used entry has the smallest value */
15543
- } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
1554415533
ExprList *pConstExpr;/* Constant expressions */
1554515534
Token constraintName;/* Name of the constraint currently being parsed */
1554615535
yDbMask writeMask; /* Start a write transaction on these databases */
1554715536
yDbMask cookieMask; /* Bitmask of schema verified databases */
15548
- int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
1554915537
int regRowid; /* Register holding rowid of CREATE TABLE entry */
1555015538
int regRoot; /* Register holding root page number for new objects */
1555115539
int nMaxArg; /* Max args passed to user function by sub-program */
1555215540
#if SELECTTRACE_ENABLED
1555315541
int nSelect; /* Number of SELECT statements seen */
@@ -15556,21 +15544,38 @@
1555615544
#ifndef SQLITE_OMIT_SHARED_CACHE
1555715545
int nTableLock; /* Number of locks in aTableLock */
1555815546
TableLock *aTableLock; /* Required table locks for shared-cache mode */
1555915547
#endif
1556015548
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
15561
-
15562
- /* Information used while coding trigger programs. */
1556315549
Parse *pToplevel; /* Parse structure for main program (or NULL) */
1556415550
Table *pTriggerTab; /* Table triggers are being coded for */
1556515551
int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */
1556615552
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
1556715553
u32 oldmask; /* Mask of old.* columns referenced */
1556815554
u32 newmask; /* Mask of new.* columns referenced */
1556915555
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
1557015556
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
1557115557
u8 disableTriggers; /* True to disable triggers */
15558
+
15559
+ /**************************************************************************
15560
+ ** Fields above must be initialized to zero. The fields that follow,
15561
+ ** down to the beginning of the recursive section, do not need to be
15562
+ ** initialized as they will be set before being used. The boundary is
15563
+ ** determined by offsetof(Parse,aColCache).
15564
+ **************************************************************************/
15565
+
15566
+ struct yColCache {
15567
+ int iTable; /* Table cursor number */
15568
+ i16 iColumn; /* Table column number */
15569
+ u8 tempReg; /* iReg is a temp register that needs to be freed */
15570
+ int iLevel; /* Nesting level */
15571
+ int iReg; /* Reg with value of this column. 0 means none. */
15572
+ int lru; /* Least recently used entry has the smallest value */
15573
+ } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
15574
+ int aTempReg[8]; /* Holding area for temporary registers */
15575
+ Token sNameToken; /* Token with unqualified schema object name */
15576
+ Token sLastToken; /* The last token parsed */
1557215577
1557315578
/************************************************************************
1557415579
** Above is constant between recursions. Below is reset before and after
1557515580
** each recursion. The boundary between these two regions is determined
1557615581
** using offsetof(Parse,nVar) so the nVar field must be the first field
@@ -15583,11 +15588,10 @@
1558315588
u8 explain; /* True if the EXPLAIN flag is found on the query */
1558415589
#ifndef SQLITE_OMIT_VIRTUALTABLE
1558515590
u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
1558615591
int nVtabLock; /* Number of virtual tables to lock */
1558715592
#endif
15588
- int nAlias; /* Number of aliased result set columns */
1558915593
int nHeight; /* Expression tree height of current sub-select */
1559015594
#ifndef SQLITE_OMIT_EXPLAIN
1559115595
int iSelectId; /* ID of current select for EXPLAIN output */
1559215596
int iNextSelectId; /* Next available select ID for EXPLAIN output */
1559315597
#endif
@@ -15595,12 +15599,10 @@
1559515599
Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
1559615600
const char *zTail; /* All SQL text past the last semicolon parsed */
1559715601
Table *pNewTable; /* A table being constructed by CREATE TABLE */
1559815602
Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
1559915603
const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
15600
- Token sNameToken; /* Token with unqualified schema object name */
15601
- Token sLastToken; /* The last token parsed */
1560215604
#ifndef SQLITE_OMIT_VIRTUALTABLE
1560315605
Token sArg; /* Complete text of a module argument */
1560415606
Table **apVtabLock; /* Pointer to virtual tables needing locking */
1560515607
#endif
1560615608
Table *pZombieTab; /* List of Table objects to delete after code gen */
@@ -15607,10 +15609,18 @@
1560715609
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
1560815610
With *pWith; /* Current WITH clause, or NULL */
1560915611
With *pWithToFree; /* Free this WITH object at the end of the parse */
1561015612
};
1561115613
15614
+/*
15615
+** Sizes and pointers of various parts of the Parse object.
15616
+*/
15617
+#define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
15618
+#define PARSE_RECURSE_SZ offsetof(Parse,nVar) /* Recursive part */
15619
+#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
15620
+#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
15621
+
1561215622
/*
1561315623
** Return true if currently inside an sqlite3_declare_vtab() call.
1561415624
*/
1561515625
#ifdef SQLITE_OMIT_VIRTUALTABLE
1561615626
#define IN_DECLARE_VTAB 0
@@ -16990,20 +17000,17 @@
1699017000
** If x is a lower-case ASCII character, then its upper-case equivalent
1699117001
** is (x - 0x20). Therefore toupper() can be implemented as:
1699217002
**
1699317003
** (x & ~(map[x]&0x20))
1699417004
**
16995
-** Standard function tolower() is implemented using the sqlite3UpperToLower[]
17005
+** The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
1699617006
** array. tolower() is used more often than toupper() by SQLite.
1699717007
**
16998
-** Bit 0x40 is set if the character non-alphanumeric and can be used in an
17008
+** Bit 0x40 is set if the character is non-alphanumeric and can be used in an
1699917009
** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any
1700017010
** non-ASCII UTF character. Hence the test for whether or not a character is
1700117011
** part of an identifier is 0x46.
17002
-**
17003
-** SQLite's versions are identical to the standard versions assuming a
17004
-** locale of "C". They are implemented as macros in sqliteInt.h.
1700517012
*/
1700617013
#ifdef SQLITE_ASCII
1700717014
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {
1700817015
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */
1700917016
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */
@@ -17072,11 +17079,11 @@
1707217079
#ifndef SQLITE_SORTER_PMASZ
1707317080
# define SQLITE_SORTER_PMASZ 250
1707417081
#endif
1707517082
1707617083
/* Statement journals spill to disk when their size exceeds the following
17077
-** threashold (in bytes). 0 means that statement journals are created and
17084
+** threshold (in bytes). 0 means that statement journals are created and
1707817085
** written to disk immediately (the default behavior for SQLite versions
1707917086
** before 3.12.0). -1 means always keep the entire statement journal in
1708017087
** memory. (The statement journal is also always held entirely in memory
1708117088
** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
1708217089
** setting.)
@@ -17160,11 +17167,11 @@
1716017167
1716117168
/*
1716217169
** The value of the "pending" byte must be 0x40000000 (1 byte past the
1716317170
** 1-gibabyte boundary) in a compatible database. SQLite never uses
1716417171
** the database page that contains the pending byte. It never attempts
17165
-** to read or write that page. The pending byte page is set assign
17172
+** to read or write that page. The pending byte page is set aside
1716617173
** for use by the VFS layers as space for managing file locks.
1716717174
**
1716817175
** During testing, it is often desirable to move the pending byte to
1716917176
** a different position in the file. This allows code that has to
1717017177
** deal with the pending byte to run on files that are much smaller
@@ -17720,13 +17727,10 @@
1772017727
typedef unsigned Bool;
1772117728
1772217729
/* Opaque type used by code in vdbesort.c */
1772317730
typedef struct VdbeSorter VdbeSorter;
1772417731
17725
-/* Opaque type used by the explainer */
17726
-typedef struct Explain Explain;
17727
-
1772817732
/* Elements of the linked list at Vdbe.pAuxData */
1772917733
typedef struct AuxData AuxData;
1773017734
1773117735
/* Types of VDBE cursors */
1773217736
#define CURTYPE_BTREE 0
@@ -17797,10 +17801,16 @@
1779717801
/* 2*nField extra array elements allocated for aType[], beyond the one
1779817802
** static element declared in the structure. nField total array slots for
1779917803
** aType[] and nField+1 array slots for aOffset[] */
1780017804
};
1780117805
17806
+
17807
+/*
17808
+** A value for VdbeCursor.cacheStatus that means the cache is always invalid.
17809
+*/
17810
+#define CACHE_STALE 0
17811
+
1780217812
/*
1780317813
** When a sub-program is executed (OP_Program), a structure of this type
1780417814
** is allocated to store the current value of the program counter, as
1780517815
** well as the current memory cell array and various other frame specific
1780617816
** values stored in the Vdbe struct. When the sub-program is finished,
@@ -17841,15 +17851,10 @@
1784117851
int nDbChange; /* Value of db->nChange */
1784217852
};
1784317853
1784417854
#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
1784517855
17846
-/*
17847
-** A value for VdbeCursor.cacheValid that means the cache is always invalid.
17848
-*/
17849
-#define CACHE_STALE 0
17850
-
1785117856
/*
1785217857
** Internally, the vdbe manipulates nearly all SQL values as Mem
1785317858
** structures. Each Mem struct may cache multiple representations (string,
1785417859
** integer etc.) of the same value.
1785517860
*/
@@ -17986,22 +17991,10 @@
1798617991
u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */
1798717992
u8 argc; /* Number of arguments */
1798817993
sqlite3_value *argv[1]; /* Argument set */
1798917994
};
1799017995
17991
-/*
17992
-** An Explain object accumulates indented output which is helpful
17993
-** in describing recursive data structures.
17994
-*/
17995
-struct Explain {
17996
- Vdbe *pVdbe; /* Attach the explanation to this Vdbe */
17997
- StrAccum str; /* The string being accumulated */
17998
- int nIndent; /* Number of elements in aIndent */
17999
- u16 aIndent[100]; /* Levels of indentation */
18000
- char zBase[100]; /* Initial space */
18001
-};
18002
-
1800317996
/* A bitfield type for use inside of structures. Always follow with :N where
1800417997
** N is the number of bits.
1800517998
*/
1800617999
typedef unsigned bft; /* Bit Field Type */
1800718000
@@ -18022,57 +18015,61 @@
1802218015
** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
1802318016
** is really a pointer to an instance of this structure.
1802418017
*/
1802518018
struct Vdbe {
1802618019
sqlite3 *db; /* The database connection that owns this statement */
18020
+ Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
18021
+ Parse *pParse; /* Parsing context used to create this Vdbe */
18022
+ ynVar nVar; /* Number of entries in aVar[] */
18023
+ ynVar nzVar; /* Number of entries in azVar[] */
18024
+ u32 magic; /* Magic number for sanity checking */
18025
+ int nMem; /* Number of memory locations currently allocated */
18026
+ int nCursor; /* Number of slots in apCsr[] */
18027
+ u32 cacheCtr; /* VdbeCursor row cache generation counter */
18028
+ int pc; /* The program counter */
18029
+ int rc; /* Value to return */
18030
+ int nChange; /* Number of db changes made since last reset */
18031
+ int iStatement; /* Statement number (or 0 if has not opened stmt) */
18032
+ i64 iCurrentTime; /* Value of julianday('now') for this statement */
18033
+ i64 nFkConstraint; /* Number of imm. FK constraints this VM */
18034
+ i64 nStmtDefCons; /* Number of def. constraints when stmt started */
18035
+ i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
18036
+
18037
+ /* When allocating a new Vdbe object, all of the fields below should be
18038
+ ** initialized to zero or NULL */
18039
+
1802718040
Op *aOp; /* Space to hold the virtual machine's program */
1802818041
Mem *aMem; /* The memory locations */
1802918042
Mem **apArg; /* Arguments to currently executing user function */
1803018043
Mem *aColName; /* Column names to return */
1803118044
Mem *pResultSet; /* Pointer to an array of results */
18032
- Parse *pParse; /* Parsing context used to create this Vdbe */
18033
- int nMem; /* Number of memory locations currently allocated */
18034
- int nOp; /* Number of instructions in the program */
18035
- int nCursor; /* Number of slots in apCsr[] */
18036
- u32 magic; /* Magic number for sanity checking */
1803718045
char *zErrMsg; /* Error message written here */
18038
- Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
1803918046
VdbeCursor **apCsr; /* One element of this array for each open cursor */
1804018047
Mem *aVar; /* Values for the OP_Variable opcode. */
1804118048
char **azVar; /* Name of variables */
18042
- ynVar nVar; /* Number of entries in aVar[] */
18043
- ynVar nzVar; /* Number of entries in azVar[] */
18044
- u32 cacheCtr; /* VdbeCursor row cache generation counter */
18045
- int pc; /* The program counter */
18046
- int rc; /* Value to return */
18049
+#ifndef SQLITE_OMIT_TRACE
18050
+ i64 startTime; /* Time when query started - used for profiling */
18051
+#endif
18052
+ int nOp; /* Number of instructions in the program */
1804718053
#ifdef SQLITE_DEBUG
1804818054
int rcApp; /* errcode set by sqlite3_result_error_code() */
1804918055
#endif
1805018056
u16 nResColumn; /* Number of columns in one row of the result set */
1805118057
u8 errorAction; /* Recovery action to do in case of an error */
18058
+ u8 minWriteFileFormat; /* Minimum file format for writable database files */
1805218059
bft expired:1; /* True if the VM needs to be recompiled */
1805318060
bft doingRerun:1; /* True if rerunning after an auto-reprepare */
18054
- u8 minWriteFileFormat; /* Minimum file format for writable database files */
1805518061
bft explain:2; /* True if EXPLAIN present on SQL command */
1805618062
bft changeCntOn:1; /* True to update the change-counter */
1805718063
bft runOnlyOnce:1; /* Automatically expire on reset */
1805818064
bft usesStmtJournal:1; /* True if uses a statement journal */
1805918065
bft readOnly:1; /* True for statements that do not write */
1806018066
bft bIsReader:1; /* True for statements that read */
1806118067
bft isPrepareV2:1; /* True if prepared with prepare_v2() */
18062
- int nChange; /* Number of db changes made since last reset */
1806318068
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
1806418069
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
18065
- int iStatement; /* Statement number (or 0 if has not opened stmt) */
1806618070
u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
18067
-#ifndef SQLITE_OMIT_TRACE
18068
- i64 startTime; /* Time when query started - used for profiling */
18069
-#endif
18070
- i64 iCurrentTime; /* Value of julianday('now') for this statement */
18071
- i64 nFkConstraint; /* Number of imm. FK constraints this VM */
18072
- i64 nStmtDefCons; /* Number of def. constraints when stmt started */
18073
- i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
1807418071
char *zSql; /* Text of the SQL statement that generated this */
1807518072
void *pFree; /* Free this when deleting the vdbe */
1807618073
VdbeFrame *pFrame; /* Parent frame */
1807718074
VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
1807818075
int nFrame; /* Number of frames in pFrame list */
@@ -18087,14 +18084,15 @@
1808718084
};
1808818085
1808918086
/*
1809018087
** The following are allowed values for Vdbe.magic
1809118088
*/
18092
-#define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */
18093
-#define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */
18094
-#define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */
18095
-#define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */
18089
+#define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
18090
+#define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
18091
+#define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
18092
+#define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
18093
+#define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
1809618094
1809718095
/*
1809818096
** Structure used to store the context required by the
1809918097
** sqlite3_preupdate_*() API functions.
1810018098
*/
@@ -28776,11 +28774,15 @@
2877628774
*/
2877728775
static unsigned int strHash(const char *z){
2877828776
unsigned int h = 0;
2877928777
unsigned char c;
2878028778
while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
28781
- h = (h<<3) ^ h ^ sqlite3UpperToLower[c];
28779
+ /* Knuth multiplicative hashing. (Sorting & Searching, p. 510).
28780
+ ** 0x9e3779b1 is 2654435761 which is the closest prime number to
28781
+ ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
28782
+ h += sqlite3UpperToLower[c];
28783
+ h *= 0x9e3779b1;
2878228784
}
2878328785
return h;
2878428786
}
2878528787
2878628788
@@ -44019,11 +44021,11 @@
4401944021
){
4402044022
PgHdr *pPgHdr;
4402144023
assert( pPage!=0 );
4402244024
pPgHdr = (PgHdr*)pPage->pExtra;
4402344025
assert( pPgHdr->pPage==0 );
44024
- memset(pPgHdr, 0, sizeof(PgHdr));
44026
+ memset(&pPgHdr->pDirty, 0, sizeof(PgHdr) - offsetof(PgHdr,pDirty));
4402544027
pPgHdr->pPage = pPage;
4402644028
pPgHdr->pData = pPage->pBuf;
4402744029
pPgHdr->pExtra = (void *)&pPgHdr[1];
4402844030
memset(pPgHdr->pExtra, 0, pCache->szExtra);
4402944031
pPgHdr->pCache = pCache;
@@ -69042,10 +69044,11 @@
6904269044
assert( (pMem->flags&MEM_RowSet)==0 );
6904369045
assert( EIGHT_BYTE_ALIGNMENT(pMem) );
6904469046
6904569047
6904669048
if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
69049
+ pMem->enc = 0;
6904769050
return SQLITE_NOMEM_BKPT;
6904869051
}
6904969052
6905069053
/* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
6905169054
** string representation of the value. Then, if the required encoding
@@ -70018,14 +70021,11 @@
7001870021
sqlite3_value *pVal = 0;
7001970022
int negInt = 1;
7002070023
const char *zNeg = "";
7002170024
int rc = SQLITE_OK;
7002270025
70023
- if( !pExpr ){
70024
- *ppVal = 0;
70025
- return SQLITE_OK;
70026
- }
70026
+ assert( pExpr!=0 );
7002770027
while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
7002870028
if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
7002970029
7003070030
/* Compressed expressions only appear when parsing the DEFAULT clause
7003170031
** on a table column definition, and hence only when pCtx==0. This
@@ -70145,11 +70145,11 @@
7014570145
Expr *pExpr, /* The expression to evaluate */
7014670146
u8 enc, /* Encoding to use */
7014770147
u8 affinity, /* Affinity to use */
7014870148
sqlite3_value **ppVal /* Write the new value here */
7014970149
){
70150
- return valueFromExpr(db, pExpr, enc, affinity, ppVal, 0);
70150
+ return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;
7015170151
}
7015270152
7015370153
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
7015470154
/*
7015570155
** The implementation of the sqlite_record() function. This function accepts
@@ -70488,12 +70488,13 @@
7048870488
** Create a new virtual database engine.
7048970489
*/
7049070490
SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
7049170491
sqlite3 *db = pParse->db;
7049270492
Vdbe *p;
70493
- p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
70493
+ p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
7049470494
if( p==0 ) return 0;
70495
+ memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
7049570496
p->db = db;
7049670497
if( db->pVdbe ){
7049770498
db->pVdbe->pPrev = p;
7049870499
}
7049970500
p->pNext = db->pVdbe;
@@ -70651,13 +70652,12 @@
7065170652
#endif
7065270653
#ifdef SQLITE_DEBUG
7065370654
if( p->db->flags & SQLITE_VdbeAddopTrace ){
7065470655
int jj, kk;
7065570656
Parse *pParse = p->pParse;
70656
- for(jj=kk=0; jj<SQLITE_N_COLCACHE; jj++){
70657
+ for(jj=kk=0; jj<pParse->nColCache; jj++){
7065770658
struct yColCache *x = pParse->aColCache + jj;
70658
- if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue;
7065970659
printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
7066070660
kk++;
7066170661
}
7066270662
if( kk ) printf("\n");
7066370663
sqlite3VdbePrintOp(0, i, &p->aOp[i]);
@@ -70841,11 +70841,10 @@
7084170841
assert( j<p->nLabel );
7084270842
assert( j>=0 );
7084370843
if( p->aLabel ){
7084470844
p->aLabel[j] = v->nOp;
7084570845
}
70846
- p->iFixedOp = v->nOp - 1;
7084770846
}
7084870847
7084970848
/*
7085070849
** Mark the VDBE as one that can only be run one time.
7085170850
*/
@@ -71232,19 +71231,19 @@
7123271231
}
7123371232
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
7123471233
sqlite3VdbeGetOp(p,addr)->p3 = val;
7123571234
}
7123671235
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 p5){
71237
- if( !p->db->mallocFailed ) p->aOp[p->nOp-1].p5 = p5;
71236
+ assert( p->nOp>0 || p->db->mallocFailed );
71237
+ if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
7123871238
}
7123971239
7124071240
/*
7124171241
** Change the P2 operand of instruction addr so that it points to
7124271242
** the address of the next instruction to be coded.
7124371243
*/
7124471244
SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
71245
- p->pParse->iFixedOp = p->nOp - 1;
7124671245
sqlite3VdbeChangeP2(p, addr, p->nOp);
7124771246
}
7124871247
7124971248
7125071249
/*
@@ -71363,11 +71362,11 @@
7136371362
/*
7136471363
** If the last opcode is "op" and it is not a jump destination,
7136571364
** then remove it. Return true if and only if an opcode was removed.
7136671365
*/
7136771366
SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
71368
- if( (p->nOp-1)>(p->pParse->iFixedOp) && p->aOp[p->nOp-1].opcode==op ){
71367
+ if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
7136971368
return sqlite3VdbeChangeToNoop(p, p->nOp-1);
7137071369
}else{
7137171370
return 0;
7137271371
}
7137371372
}
@@ -71925,10 +71924,25 @@
7192571924
zCom
7192671925
);
7192771926
fflush(pOut);
7192871927
}
7192971928
#endif
71929
+
71930
+/*
71931
+** Initialize an array of N Mem element.
71932
+*/
71933
+static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
71934
+ while( (N--)>0 ){
71935
+ p->db = db;
71936
+ p->flags = flags;
71937
+ p->szMalloc = 0;
71938
+#ifdef SQLITE_DEBUG
71939
+ p->pScopyFrom = 0;
71940
+#endif
71941
+ p++;
71942
+ }
71943
+}
7193071944
7193171945
/*
7193271946
** Release an array of N Mem elements
7193371947
*/
7193471948
static void releaseMemArray(Mem *p, int N){
@@ -72137,10 +72151,11 @@
7213772151
return SQLITE_ERROR;
7213872152
}
7213972153
pMem->flags = MEM_Str|MEM_Term;
7214072154
zP4 = displayP4(pOp, pMem->z, pMem->szMalloc);
7214172155
if( zP4!=pMem->z ){
72156
+ pMem->n = 0;
7214272157
sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);
7214372158
}else{
7214472159
assert( pMem->z!=0 );
7214572160
pMem->n = sqlite3Strlen30(pMem->z);
7214672161
pMem->enc = SQLITE_UTF8;
@@ -72279,11 +72294,11 @@
7227972294
SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
7228072295
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
7228172296
int i;
7228272297
#endif
7228372298
assert( p!=0 );
72284
- assert( p->magic==VDBE_MAGIC_INIT );
72299
+ assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );
7228572300
7228672301
/* There should be at least one opcode.
7228772302
*/
7228872303
assert( p->nOp>0 );
7228972304
@@ -72368,14 +72383,11 @@
7236872383
n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
7236972384
x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
7237072385
assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
7237172386
x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
7237272387
assert( x.nFree>=0 );
72373
- if( x.nFree>0 ){
72374
- memset(x.pSpace, 0, x.nFree);
72375
- assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
72376
- }
72388
+ assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
7237772389
7237872390
resolveP2Values(p, &nArg);
7237972391
p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
7238072392
if( pParse->explain && nMem<10 ){
7238172393
nMem = 10;
@@ -72400,34 +72412,34 @@
7240072412
p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
7240172413
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
7240272414
p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
7240372415
#endif
7240472416
if( x.nNeeded==0 ) break;
72405
- x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
72417
+ x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded);
7240672418
x.nFree = x.nNeeded;
7240772419
}while( !db->mallocFailed );
7240872420
72409
- p->nCursor = nCursor;
72410
- if( p->aVar ){
72411
- p->nVar = (ynVar)nVar;
72412
- for(n=0; n<nVar; n++){
72413
- p->aVar[n].flags = MEM_Null;
72414
- p->aVar[n].db = db;
72415
- }
72416
- }
7241772421
p->nzVar = pParse->nzVar;
7241872422
p->azVar = pParse->azVar;
7241972423
pParse->nzVar = 0;
7242072424
pParse->azVar = 0;
72421
- if( p->aMem ){
72422
- p->nMem = nMem;
72423
- for(n=0; n<nMem; n++){
72424
- p->aMem[n].flags = MEM_Undefined;
72425
- p->aMem[n].db = db;
72426
- }
72427
- }
7242872425
p->explain = pParse->explain;
72426
+ if( db->mallocFailed ){
72427
+ p->nVar = 0;
72428
+ p->nCursor = 0;
72429
+ p->nMem = 0;
72430
+ }else{
72431
+ p->nCursor = nCursor;
72432
+ p->nVar = (ynVar)nVar;
72433
+ initMemArray(p->aVar, nVar, db, MEM_Null);
72434
+ p->nMem = nMem;
72435
+ initMemArray(p->aMem, nMem, db, MEM_Undefined);
72436
+ memset(p->apCsr, 0, nCursor*sizeof(VdbeCursor*));
72437
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72438
+ memset(p->anExec, 0, p->nOp*sizeof(i64));
72439
+#endif
72440
+ }
7242972441
sqlite3VdbeRewind(p);
7243072442
}
7243172443
7243272444
/*
7243372445
** Close a VDBE cursor and release all the resources that cursor
@@ -72575,17 +72587,13 @@
7257572587
7257672588
releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
7257772589
sqlite3DbFree(db, p->aColName);
7257872590
n = nResColumn*COLNAME_N;
7257972591
p->nResColumn = (u16)nResColumn;
72580
- p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
72592
+ p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
7258172593
if( p->aColName==0 ) return;
72582
- while( n-- > 0 ){
72583
- pColName->flags = MEM_Null;
72584
- pColName->db = p->db;
72585
- pColName++;
72586
- }
72594
+ initMemArray(p->aColName, n, p->db, MEM_Null);
7258772595
}
7258872596
7258972597
/*
7259072598
** Set the name of the idx'th column to be returned by the SQL statement.
7259172599
** zName must be a pointer to a nul terminated string.
@@ -73343,11 +73351,11 @@
7334373351
fclose(out);
7334473352
}
7334573353
}
7334673354
#endif
7334773355
p->iCurrentTime = 0;
73348
- p->magic = VDBE_MAGIC_INIT;
73356
+ p->magic = VDBE_MAGIC_RESET;
7334973357
return p->rc & db->errMask;
7335073358
}
7335173359
7335273360
/*
7335373361
** Clean up and delete a VDBE after execution. Return an integer which is
@@ -73407,23 +73415,25 @@
7340773415
*/
7340873416
SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
7340973417
SubProgram *pSub, *pNext;
7341073418
int i;
7341173419
assert( p->db==0 || p->db==db );
73412
- releaseMemArray(p->aVar, p->nVar);
7341373420
releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
7341473421
for(pSub=p->pProgram; pSub; pSub=pNext){
7341573422
pNext = pSub->pNext;
7341673423
vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
7341773424
sqlite3DbFree(db, pSub);
7341873425
}
73419
- for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
73420
- sqlite3DbFree(db, p->azVar);
73426
+ if( p->magic!=VDBE_MAGIC_INIT ){
73427
+ releaseMemArray(p->aVar, p->nVar);
73428
+ for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
73429
+ sqlite3DbFree(db, p->azVar);
73430
+ sqlite3DbFree(db, p->pFree);
73431
+ }
7342173432
vdbeFreeOpArray(db, p->aOp, p->nOp);
7342273433
sqlite3DbFree(db, p->aColName);
7342373434
sqlite3DbFree(db, p->zSql);
73424
- sqlite3DbFree(db, p->pFree);
7342573435
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
7342673436
for(i=0; i<p->nScan; i++){
7342773437
sqlite3DbFree(db, p->aScan[i].zName);
7342873438
}
7342973439
sqlite3DbFree(db, p->aScan);
@@ -76665,11 +76675,11 @@
7666576675
/*
7666676676
** Return true if the prepared statement is in need of being reset.
7666776677
*/
7666876678
SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
7666976679
Vdbe *v = (Vdbe*)pStmt;
76670
- return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
76680
+ return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
7667176681
}
7667276682
7667376683
/*
7667476684
** Return a pointer to the next prepared statement after pStmt associated
7667576685
** with database connection pDb. If pStmt is NULL, return the first
@@ -78417,15 +78427,17 @@
7841778427
u16 nullFlag;
7841878428
pOut = out2Prerelease(p, pOp);
7841978429
cnt = pOp->p3-pOp->p2;
7842078430
assert( pOp->p3<=(p->nMem+1 - p->nCursor) );
7842178431
pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
78432
+ pOut->n = 0;
7842278433
while( cnt>0 ){
7842378434
pOut++;
7842478435
memAboutToChange(p, pOut);
7842578436
sqlite3VdbeMemSetNull(pOut);
7842678437
pOut->flags = nullFlag;
78438
+ pOut->n = 0;
7842778439
cnt--;
7842878440
}
7842978441
break;
7843078442
}
7843178443
@@ -92656,36 +92668,23 @@
9265692668
#endif
9265792669
}
9265892670
}
9265992671
}
9266092672
92661
-#if defined(SQLITE_DEBUG)
92662
-/*
92663
-** Verify the consistency of the column cache
92664
-*/
92665
-static int cacheIsValid(Parse *pParse){
92666
- int i, n;
92667
- for(i=n=0; i<SQLITE_N_COLCACHE; i++){
92668
- if( pParse->aColCache[i].iReg>0 ) n++;
92669
- }
92670
- return n==pParse->nColCache;
92671
-}
92672
-#endif
92673
-
92674
-/*
92675
-** Clear a cache entry.
92676
-*/
92677
-static void cacheEntryClear(Parse *pParse, struct yColCache *p){
92678
- if( p->tempReg ){
92673
+/*
92674
+** Erase column-cache entry number i
92675
+*/
92676
+static void cacheEntryClear(Parse *pParse, int i){
92677
+ if( pParse->aColCache[i].tempReg ){
9267992678
if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
92680
- pParse->aTempReg[pParse->nTempReg++] = p->iReg;
92679
+ pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
9268192680
}
92682
- p->tempReg = 0;
9268392681
}
92684
- p->iReg = 0;
9268592682
pParse->nColCache--;
92686
- assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
92683
+ if( i<pParse->nColCache ){
92684
+ pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];
92685
+ }
9268792686
}
9268892687
9268992688
9269092689
/*
9269192690
** Record in the column cache that a particular column from a
@@ -92711,64 +92710,52 @@
9271192710
**
9271292711
** Actually, the way the column cache is currently used, we are guaranteed
9271392712
** that the object will never already be in cache. Verify this guarantee.
9271492713
*/
9271592714
#ifndef NDEBUG
92716
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92717
- assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol );
92715
+ for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92716
+ assert( p->iTable!=iTab || p->iColumn!=iCol );
9271892717
}
9271992718
#endif
9272092719
92721
- /* Find an empty slot and replace it */
92722
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92723
- if( p->iReg==0 ){
92724
- p->iLevel = pParse->iCacheLevel;
92725
- p->iTable = iTab;
92726
- p->iColumn = iCol;
92727
- p->iReg = iReg;
92728
- p->tempReg = 0;
92729
- p->lru = pParse->iCacheCnt++;
92730
- pParse->nColCache++;
92731
- assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
92732
- return;
92733
- }
92734
- }
92735
-
92736
- /* Replace the last recently used */
92737
- minLru = 0x7fffffff;
92738
- idxLru = -1;
92739
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92740
- if( p->lru<minLru ){
92741
- idxLru = i;
92742
- minLru = p->lru;
92743
- }
92744
- }
92745
- if( ALWAYS(idxLru>=0) ){
92720
+ /* If the cache is already full, delete the least recently used entry */
92721
+ if( pParse->nColCache>=SQLITE_N_COLCACHE ){
92722
+ minLru = 0x7fffffff;
92723
+ idxLru = -1;
92724
+ for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92725
+ if( p->lru<minLru ){
92726
+ idxLru = i;
92727
+ minLru = p->lru;
92728
+ }
92729
+ }
9274692730
p = &pParse->aColCache[idxLru];
92747
- p->iLevel = pParse->iCacheLevel;
92748
- p->iTable = iTab;
92749
- p->iColumn = iCol;
92750
- p->iReg = iReg;
92751
- p->tempReg = 0;
92752
- p->lru = pParse->iCacheCnt++;
92753
- assert( cacheIsValid(pParse) );
92754
- return;
92755
- }
92731
+ }else{
92732
+ p = &pParse->aColCache[pParse->nColCache++];
92733
+ }
92734
+
92735
+ /* Add the new entry to the end of the cache */
92736
+ p->iLevel = pParse->iCacheLevel;
92737
+ p->iTable = iTab;
92738
+ p->iColumn = iCol;
92739
+ p->iReg = iReg;
92740
+ p->tempReg = 0;
92741
+ p->lru = pParse->iCacheCnt++;
9275692742
}
9275792743
9275892744
/*
9275992745
** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
9276092746
** Purge the range of registers from the column cache.
9276192747
*/
9276292748
SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
92763
- struct yColCache *p;
92764
- if( iReg<=0 || pParse->nColCache==0 ) return;
92765
- p = &pParse->aColCache[SQLITE_N_COLCACHE-1];
92766
- while(1){
92767
- if( p->iReg >= iReg && p->iReg < iReg+nReg ) cacheEntryClear(pParse, p);
92768
- if( p==pParse->aColCache ) break;
92769
- p--;
92749
+ int i = 0;
92750
+ while( i<pParse->nColCache ){
92751
+ struct yColCache *p = &pParse->aColCache[i];
92752
+ if( p->iReg >= iReg && p->iReg < iReg+nReg ){
92753
+ cacheEntryClear(pParse, i);
92754
+ }else{
92755
+ i++;
92756
+ }
9277092757
}
9277192758
}
9277292759
9277392760
/*
9277492761
** Remember the current column cache context. Any new entries added
@@ -92788,22 +92775,23 @@
9278892775
** Remove from the column cache any entries that were added since the
9278992776
** the previous sqlite3ExprCachePush operation. In other words, restore
9279092777
** the cache to the state it was in prior the most recent Push.
9279192778
*/
9279292779
SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
92793
- int i;
92794
- struct yColCache *p;
92780
+ int i = 0;
9279592781
assert( pParse->iCacheLevel>=1 );
9279692782
pParse->iCacheLevel--;
9279792783
#ifdef SQLITE_DEBUG
9279892784
if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
9279992785
printf("POP to %d\n", pParse->iCacheLevel);
9280092786
}
9280192787
#endif
92802
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92803
- if( p->iReg && p->iLevel>pParse->iCacheLevel ){
92804
- cacheEntryClear(pParse, p);
92788
+ while( i<pParse->nColCache ){
92789
+ if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){
92790
+ cacheEntryClear(pParse, i);
92791
+ }else{
92792
+ i++;
9280592793
}
9280692794
}
9280792795
}
9280892796
9280992797
/*
@@ -92813,11 +92801,11 @@
9281392801
** get them all.
9281492802
*/
9281592803
static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
9281692804
int i;
9281792805
struct yColCache *p;
92818
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92806
+ for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
9281992807
if( p->iReg==iReg ){
9282092808
p->tempReg = 0;
9282192809
}
9282292810
}
9282392811
}
@@ -92891,12 +92879,12 @@
9289192879
){
9289292880
Vdbe *v = pParse->pVdbe;
9289392881
int i;
9289492882
struct yColCache *p;
9289592883
92896
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92897
- if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){
92884
+ for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92885
+ if( p->iTable==iTable && p->iColumn==iColumn ){
9289892886
p->lru = pParse->iCacheCnt++;
9289992887
sqlite3ExprCachePinRegister(pParse, p->iReg);
9290092888
return p->iReg;
9290192889
}
9290292890
}
@@ -92924,22 +92912,24 @@
9292492912
/*
9292592913
** Clear all column cache entries.
9292692914
*/
9292792915
SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
9292892916
int i;
92929
- struct yColCache *p;
9293092917
9293192918
#if SQLITE_DEBUG
9293292919
if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
9293392920
printf("CLEAR\n");
9293492921
}
9293592922
#endif
92936
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92937
- if( p->iReg ){
92938
- cacheEntryClear(pParse, p);
92923
+ for(i=0; i<pParse->nColCache; i++){
92924
+ if( pParse->aColCache[i].tempReg
92925
+ && pParse->nTempReg<ArraySize(pParse->aTempReg)
92926
+ ){
92927
+ pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
9293992928
}
9294092929
}
92930
+ pParse->nColCache = 0;
9294192931
}
9294292932
9294392933
/*
9294492934
** Record the fact that an affinity change has occurred on iCount
9294592935
** registers starting with iStart.
@@ -92967,11 +92957,11 @@
9296792957
** and does not appear in a normal build.
9296892958
*/
9296992959
static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
9297092960
int i;
9297192961
struct yColCache *p;
92972
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92962
+ for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
9297392963
int r = p->iReg;
9297492964
if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/
9297592965
}
9297692966
return 0;
9297792967
}
@@ -94663,11 +94653,11 @@
9466394653
*/
9466494654
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
9466594655
if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
9466694656
int i;
9466794657
struct yColCache *p;
94668
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
94658
+ for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
9466994659
if( p->iReg==iReg ){
9467094660
p->tempReg = 1;
9467194661
return;
9467294662
}
9467394663
}
@@ -98433,11 +98423,10 @@
9843398423
*/
9843498424
v = sqlite3GetVdbe(pParse);
9843598425
assert( !pParse->isMultiWrite
9843698426
|| sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
9843798427
if( v ){
98438
- while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
9843998428
sqlite3VdbeAddOp0(v, OP_Halt);
9844098429
9844198430
#if SQLITE_USER_AUTHENTICATION
9844298431
if( pParse->nTableLock>0 && db->init.busy==0 ){
9844398432
sqlite3UserAuthInit(db);
@@ -98460,18 +98449,20 @@
9846098449
){
9846198450
int iDb, i;
9846298451
assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
9846398452
sqlite3VdbeJumpHere(v, 0);
9846498453
for(iDb=0; iDb<db->nDb; iDb++){
98454
+ Schema *pSchema;
9846598455
if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
9846698456
sqlite3VdbeUsesBtree(v, iDb);
98457
+ pSchema = db->aDb[iDb].pSchema;
9846798458
sqlite3VdbeAddOp4Int(v,
9846898459
OP_Transaction, /* Opcode */
9846998460
iDb, /* P1 */
9847098461
DbMaskTest(pParse->writeMask,iDb), /* P2 */
98471
- pParse->cookieValue[iDb], /* P3 */
98472
- db->aDb[iDb].pSchema->iGeneration /* P4 */
98462
+ pSchema->schema_cookie, /* P3 */
98463
+ pSchema->iGeneration /* P4 */
9847398464
);
9847498465
if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
9847598466
VdbeComment((v,
9847698467
"usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
9847798468
}
@@ -98518,20 +98509,10 @@
9851898509
sqlite3VdbeMakeReady(v, pParse);
9851998510
pParse->rc = SQLITE_DONE;
9852098511
}else{
9852198512
pParse->rc = SQLITE_ERROR;
9852298513
}
98523
-
98524
- /* We are done with this Parse object. There is no need to de-initialize it */
98525
-#if 0
98526
- pParse->colNamesSet = 0;
98527
- pParse->nTab = 0;
98528
- pParse->nMem = 0;
98529
- pParse->nSet = 0;
98530
- pParse->nVar = 0;
98531
- DbMaskZero(pParse->cookieMask);
98532
-#endif
9853398514
}
9853498515
9853598516
/*
9853698517
** Run the parser and code generator recursively in order to generate
9853798518
** code for the SQL statement given onto the end of the pParse context
@@ -98547,12 +98528,11 @@
9854798528
SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
9854898529
va_list ap;
9854998530
char *zSql;
9855098531
char *zErrMsg = 0;
9855198532
sqlite3 *db = pParse->db;
98552
-# define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar))
98553
- char saveBuf[SAVE_SZ];
98533
+ char saveBuf[PARSE_TAIL_SZ];
9855498534
9855598535
if( pParse->nErr ) return;
9855698536
assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
9855798537
va_start(ap, zFormat);
9855898538
zSql = sqlite3VMPrintf(db, zFormat, ap);
@@ -98559,16 +98539,16 @@
9855998539
va_end(ap);
9856098540
if( zSql==0 ){
9856198541
return; /* A malloc must have failed */
9856298542
}
9856398543
pParse->nested++;
98564
- memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
98565
- memset(&pParse->nVar, 0, SAVE_SZ);
98544
+ memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
98545
+ memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
9856698546
sqlite3RunParser(pParse, zSql, &zErrMsg);
9856798547
sqlite3DbFree(db, zErrMsg);
9856898548
sqlite3DbFree(db, zSql);
98569
- memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
98549
+ memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
9857098550
pParse->nested--;
9857198551
}
9857298552
9857398553
#if SQLITE_USER_AUTHENTICATION
9857498554
/*
@@ -102331,19 +102311,17 @@
102331102311
** will occur at the end of the top-level VDBE and will be generated
102332102312
** later, by sqlite3FinishCoding().
102333102313
*/
102334102314
SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
102335102315
Parse *pToplevel = sqlite3ParseToplevel(pParse);
102336
- sqlite3 *db = pToplevel->db;
102337102316
102338
- assert( iDb>=0 && iDb<db->nDb );
102339
- assert( db->aDb[iDb].pBt!=0 || iDb==1 );
102317
+ assert( iDb>=0 && iDb<pParse->db->nDb );
102318
+ assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 );
102340102319
assert( iDb<SQLITE_MAX_ATTACHED+2 );
102341
- assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
102320
+ assert( sqlite3SchemaMutexHeld(pParse->db, iDb, 0) );
102342102321
if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
102343102322
DbMaskSet(pToplevel->cookieMask, iDb);
102344
- pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
102345102323
if( !OMIT_TEMPDB && iDb==1 ){
102346102324
sqlite3OpenTempDatabase(pToplevel);
102347102325
}
102348102326
}
102349102327
}
@@ -114053,15 +114031,17 @@
114053114031
char *zErrMsg = 0; /* Error message */
114054114032
int rc = SQLITE_OK; /* Result code */
114055114033
int i; /* Loop counter */
114056114034
114057114035
/* Allocate the parsing context */
114058
- pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
114036
+ pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));
114059114037
if( pParse==0 ){
114060114038
rc = SQLITE_NOMEM_BKPT;
114061114039
goto end_prepare;
114062114040
}
114041
+ memset(pParse, 0, PARSE_HDR_SZ);
114042
+ memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
114063114043
pParse->pReprepare = pReprepare;
114064114044
assert( ppStmt && *ppStmt==0 );
114065114045
/* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
114066114046
assert( sqlite3_mutex_held(db->mutex) );
114067114047
@@ -115395,11 +115375,11 @@
115395115375
** Allocate a KeyInfo object sufficient for an index of N key columns and
115396115376
** X extra columns.
115397115377
*/
115398115378
SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
115399115379
int nExtra = (N+X)*(sizeof(CollSeq*)+1);
115400
- KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra);
115380
+ KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra);
115401115381
if( p ){
115402115382
p->aSortOrder = (u8*)&p->aColl[N+X];
115403115383
p->nField = (u16)N;
115404115384
p->nXField = (u16)X;
115405115385
p->enc = ENC(db);
115406115386
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.15.0"
385 #define SQLITE_VERSION_NUMBER 3015000
386 #define SQLITE_SOURCE_ID "2016-09-28 16:05:53 40c0fb0af678797c39a99853f9f4102464c16f4b"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
391 **
@@ -15515,39 +15515,27 @@
15515 u8 mayAbort; /* True if statement may throw an ABORT exception */
15516 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
15517 u8 okConstFactor; /* OK to factor out constants */
15518 u8 disableLookaside; /* Number of times lookaside has been disabled */
15519 u8 nColCache; /* Number of entries in aColCache[] */
15520 int aTempReg[8]; /* Holding area for temporary registers */
15521 int nRangeReg; /* Size of the temporary register block */
15522 int iRangeReg; /* First register in temporary register block */
15523 int nErr; /* Number of errors seen */
15524 int nTab; /* Number of previously allocated VDBE cursors */
15525 int nMem; /* Number of memory cells used so far */
15526 int nSet; /* Number of sets used so far */
15527 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
15528 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
15529 int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
15530 int ckBase; /* Base register of data during check constraints */
15531 int iSelfTab; /* Table of an index whose exprs are being coded */
15532 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
15533 int iCacheCnt; /* Counter used to generate aColCache[].lru values */
15534 int nLabel; /* Number of labels used */
15535 int *aLabel; /* Space to hold the labels */
15536 struct yColCache {
15537 int iTable; /* Table cursor number */
15538 i16 iColumn; /* Table column number */
15539 u8 tempReg; /* iReg is a temp register that needs to be freed */
15540 int iLevel; /* Nesting level */
15541 int iReg; /* Reg with value of this column. 0 means none. */
15542 int lru; /* Least recently used entry has the smallest value */
15543 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
15544 ExprList *pConstExpr;/* Constant expressions */
15545 Token constraintName;/* Name of the constraint currently being parsed */
15546 yDbMask writeMask; /* Start a write transaction on these databases */
15547 yDbMask cookieMask; /* Bitmask of schema verified databases */
15548 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
15549 int regRowid; /* Register holding rowid of CREATE TABLE entry */
15550 int regRoot; /* Register holding root page number for new objects */
15551 int nMaxArg; /* Max args passed to user function by sub-program */
15552 #if SELECTTRACE_ENABLED
15553 int nSelect; /* Number of SELECT statements seen */
@@ -15556,21 +15544,38 @@
15556 #ifndef SQLITE_OMIT_SHARED_CACHE
15557 int nTableLock; /* Number of locks in aTableLock */
15558 TableLock *aTableLock; /* Required table locks for shared-cache mode */
15559 #endif
15560 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
15561
15562 /* Information used while coding trigger programs. */
15563 Parse *pToplevel; /* Parse structure for main program (or NULL) */
15564 Table *pTriggerTab; /* Table triggers are being coded for */
15565 int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */
15566 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
15567 u32 oldmask; /* Mask of old.* columns referenced */
15568 u32 newmask; /* Mask of new.* columns referenced */
15569 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
15570 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
15571 u8 disableTriggers; /* True to disable triggers */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15572
15573 /************************************************************************
15574 ** Above is constant between recursions. Below is reset before and after
15575 ** each recursion. The boundary between these two regions is determined
15576 ** using offsetof(Parse,nVar) so the nVar field must be the first field
@@ -15583,11 +15588,10 @@
15583 u8 explain; /* True if the EXPLAIN flag is found on the query */
15584 #ifndef SQLITE_OMIT_VIRTUALTABLE
15585 u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
15586 int nVtabLock; /* Number of virtual tables to lock */
15587 #endif
15588 int nAlias; /* Number of aliased result set columns */
15589 int nHeight; /* Expression tree height of current sub-select */
15590 #ifndef SQLITE_OMIT_EXPLAIN
15591 int iSelectId; /* ID of current select for EXPLAIN output */
15592 int iNextSelectId; /* Next available select ID for EXPLAIN output */
15593 #endif
@@ -15595,12 +15599,10 @@
15595 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
15596 const char *zTail; /* All SQL text past the last semicolon parsed */
15597 Table *pNewTable; /* A table being constructed by CREATE TABLE */
15598 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
15599 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
15600 Token sNameToken; /* Token with unqualified schema object name */
15601 Token sLastToken; /* The last token parsed */
15602 #ifndef SQLITE_OMIT_VIRTUALTABLE
15603 Token sArg; /* Complete text of a module argument */
15604 Table **apVtabLock; /* Pointer to virtual tables needing locking */
15605 #endif
15606 Table *pZombieTab; /* List of Table objects to delete after code gen */
@@ -15607,10 +15609,18 @@
15607 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
15608 With *pWith; /* Current WITH clause, or NULL */
15609 With *pWithToFree; /* Free this WITH object at the end of the parse */
15610 };
15611
 
 
 
 
 
 
 
 
15612 /*
15613 ** Return true if currently inside an sqlite3_declare_vtab() call.
15614 */
15615 #ifdef SQLITE_OMIT_VIRTUALTABLE
15616 #define IN_DECLARE_VTAB 0
@@ -16990,20 +17000,17 @@
16990 ** If x is a lower-case ASCII character, then its upper-case equivalent
16991 ** is (x - 0x20). Therefore toupper() can be implemented as:
16992 **
16993 ** (x & ~(map[x]&0x20))
16994 **
16995 ** Standard function tolower() is implemented using the sqlite3UpperToLower[]
16996 ** array. tolower() is used more often than toupper() by SQLite.
16997 **
16998 ** Bit 0x40 is set if the character non-alphanumeric and can be used in an
16999 ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any
17000 ** non-ASCII UTF character. Hence the test for whether or not a character is
17001 ** part of an identifier is 0x46.
17002 **
17003 ** SQLite's versions are identical to the standard versions assuming a
17004 ** locale of "C". They are implemented as macros in sqliteInt.h.
17005 */
17006 #ifdef SQLITE_ASCII
17007 SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {
17008 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */
17009 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */
@@ -17072,11 +17079,11 @@
17072 #ifndef SQLITE_SORTER_PMASZ
17073 # define SQLITE_SORTER_PMASZ 250
17074 #endif
17075
17076 /* Statement journals spill to disk when their size exceeds the following
17077 ** threashold (in bytes). 0 means that statement journals are created and
17078 ** written to disk immediately (the default behavior for SQLite versions
17079 ** before 3.12.0). -1 means always keep the entire statement journal in
17080 ** memory. (The statement journal is also always held entirely in memory
17081 ** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
17082 ** setting.)
@@ -17160,11 +17167,11 @@
17160
17161 /*
17162 ** The value of the "pending" byte must be 0x40000000 (1 byte past the
17163 ** 1-gibabyte boundary) in a compatible database. SQLite never uses
17164 ** the database page that contains the pending byte. It never attempts
17165 ** to read or write that page. The pending byte page is set assign
17166 ** for use by the VFS layers as space for managing file locks.
17167 **
17168 ** During testing, it is often desirable to move the pending byte to
17169 ** a different position in the file. This allows code that has to
17170 ** deal with the pending byte to run on files that are much smaller
@@ -17720,13 +17727,10 @@
17720 typedef unsigned Bool;
17721
17722 /* Opaque type used by code in vdbesort.c */
17723 typedef struct VdbeSorter VdbeSorter;
17724
17725 /* Opaque type used by the explainer */
17726 typedef struct Explain Explain;
17727
17728 /* Elements of the linked list at Vdbe.pAuxData */
17729 typedef struct AuxData AuxData;
17730
17731 /* Types of VDBE cursors */
17732 #define CURTYPE_BTREE 0
@@ -17797,10 +17801,16 @@
17797 /* 2*nField extra array elements allocated for aType[], beyond the one
17798 ** static element declared in the structure. nField total array slots for
17799 ** aType[] and nField+1 array slots for aOffset[] */
17800 };
17801
 
 
 
 
 
 
17802 /*
17803 ** When a sub-program is executed (OP_Program), a structure of this type
17804 ** is allocated to store the current value of the program counter, as
17805 ** well as the current memory cell array and various other frame specific
17806 ** values stored in the Vdbe struct. When the sub-program is finished,
@@ -17841,15 +17851,10 @@
17841 int nDbChange; /* Value of db->nChange */
17842 };
17843
17844 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
17845
17846 /*
17847 ** A value for VdbeCursor.cacheValid that means the cache is always invalid.
17848 */
17849 #define CACHE_STALE 0
17850
17851 /*
17852 ** Internally, the vdbe manipulates nearly all SQL values as Mem
17853 ** structures. Each Mem struct may cache multiple representations (string,
17854 ** integer etc.) of the same value.
17855 */
@@ -17986,22 +17991,10 @@
17986 u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */
17987 u8 argc; /* Number of arguments */
17988 sqlite3_value *argv[1]; /* Argument set */
17989 };
17990
17991 /*
17992 ** An Explain object accumulates indented output which is helpful
17993 ** in describing recursive data structures.
17994 */
17995 struct Explain {
17996 Vdbe *pVdbe; /* Attach the explanation to this Vdbe */
17997 StrAccum str; /* The string being accumulated */
17998 int nIndent; /* Number of elements in aIndent */
17999 u16 aIndent[100]; /* Levels of indentation */
18000 char zBase[100]; /* Initial space */
18001 };
18002
18003 /* A bitfield type for use inside of structures. Always follow with :N where
18004 ** N is the number of bits.
18005 */
18006 typedef unsigned bft; /* Bit Field Type */
18007
@@ -18022,57 +18015,61 @@
18022 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
18023 ** is really a pointer to an instance of this structure.
18024 */
18025 struct Vdbe {
18026 sqlite3 *db; /* The database connection that owns this statement */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18027 Op *aOp; /* Space to hold the virtual machine's program */
18028 Mem *aMem; /* The memory locations */
18029 Mem **apArg; /* Arguments to currently executing user function */
18030 Mem *aColName; /* Column names to return */
18031 Mem *pResultSet; /* Pointer to an array of results */
18032 Parse *pParse; /* Parsing context used to create this Vdbe */
18033 int nMem; /* Number of memory locations currently allocated */
18034 int nOp; /* Number of instructions in the program */
18035 int nCursor; /* Number of slots in apCsr[] */
18036 u32 magic; /* Magic number for sanity checking */
18037 char *zErrMsg; /* Error message written here */
18038 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
18039 VdbeCursor **apCsr; /* One element of this array for each open cursor */
18040 Mem *aVar; /* Values for the OP_Variable opcode. */
18041 char **azVar; /* Name of variables */
18042 ynVar nVar; /* Number of entries in aVar[] */
18043 ynVar nzVar; /* Number of entries in azVar[] */
18044 u32 cacheCtr; /* VdbeCursor row cache generation counter */
18045 int pc; /* The program counter */
18046 int rc; /* Value to return */
18047 #ifdef SQLITE_DEBUG
18048 int rcApp; /* errcode set by sqlite3_result_error_code() */
18049 #endif
18050 u16 nResColumn; /* Number of columns in one row of the result set */
18051 u8 errorAction; /* Recovery action to do in case of an error */
 
18052 bft expired:1; /* True if the VM needs to be recompiled */
18053 bft doingRerun:1; /* True if rerunning after an auto-reprepare */
18054 u8 minWriteFileFormat; /* Minimum file format for writable database files */
18055 bft explain:2; /* True if EXPLAIN present on SQL command */
18056 bft changeCntOn:1; /* True to update the change-counter */
18057 bft runOnlyOnce:1; /* Automatically expire on reset */
18058 bft usesStmtJournal:1; /* True if uses a statement journal */
18059 bft readOnly:1; /* True for statements that do not write */
18060 bft bIsReader:1; /* True for statements that read */
18061 bft isPrepareV2:1; /* True if prepared with prepare_v2() */
18062 int nChange; /* Number of db changes made since last reset */
18063 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
18064 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
18065 int iStatement; /* Statement number (or 0 if has not opened stmt) */
18066 u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
18067 #ifndef SQLITE_OMIT_TRACE
18068 i64 startTime; /* Time when query started - used for profiling */
18069 #endif
18070 i64 iCurrentTime; /* Value of julianday('now') for this statement */
18071 i64 nFkConstraint; /* Number of imm. FK constraints this VM */
18072 i64 nStmtDefCons; /* Number of def. constraints when stmt started */
18073 i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
18074 char *zSql; /* Text of the SQL statement that generated this */
18075 void *pFree; /* Free this when deleting the vdbe */
18076 VdbeFrame *pFrame; /* Parent frame */
18077 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
18078 int nFrame; /* Number of frames in pFrame list */
@@ -18087,14 +18084,15 @@
18087 };
18088
18089 /*
18090 ** The following are allowed values for Vdbe.magic
18091 */
18092 #define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */
18093 #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */
18094 #define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */
18095 #define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */
 
18096
18097 /*
18098 ** Structure used to store the context required by the
18099 ** sqlite3_preupdate_*() API functions.
18100 */
@@ -28776,11 +28774,15 @@
28776 */
28777 static unsigned int strHash(const char *z){
28778 unsigned int h = 0;
28779 unsigned char c;
28780 while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
28781 h = (h<<3) ^ h ^ sqlite3UpperToLower[c];
 
 
 
 
28782 }
28783 return h;
28784 }
28785
28786
@@ -44019,11 +44021,11 @@
44019 ){
44020 PgHdr *pPgHdr;
44021 assert( pPage!=0 );
44022 pPgHdr = (PgHdr*)pPage->pExtra;
44023 assert( pPgHdr->pPage==0 );
44024 memset(pPgHdr, 0, sizeof(PgHdr));
44025 pPgHdr->pPage = pPage;
44026 pPgHdr->pData = pPage->pBuf;
44027 pPgHdr->pExtra = (void *)&pPgHdr[1];
44028 memset(pPgHdr->pExtra, 0, pCache->szExtra);
44029 pPgHdr->pCache = pCache;
@@ -69042,10 +69044,11 @@
69042 assert( (pMem->flags&MEM_RowSet)==0 );
69043 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
69044
69045
69046 if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
 
69047 return SQLITE_NOMEM_BKPT;
69048 }
69049
69050 /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
69051 ** string representation of the value. Then, if the required encoding
@@ -70018,14 +70021,11 @@
70018 sqlite3_value *pVal = 0;
70019 int negInt = 1;
70020 const char *zNeg = "";
70021 int rc = SQLITE_OK;
70022
70023 if( !pExpr ){
70024 *ppVal = 0;
70025 return SQLITE_OK;
70026 }
70027 while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
70028 if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
70029
70030 /* Compressed expressions only appear when parsing the DEFAULT clause
70031 ** on a table column definition, and hence only when pCtx==0. This
@@ -70145,11 +70145,11 @@
70145 Expr *pExpr, /* The expression to evaluate */
70146 u8 enc, /* Encoding to use */
70147 u8 affinity, /* Affinity to use */
70148 sqlite3_value **ppVal /* Write the new value here */
70149 ){
70150 return valueFromExpr(db, pExpr, enc, affinity, ppVal, 0);
70151 }
70152
70153 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
70154 /*
70155 ** The implementation of the sqlite_record() function. This function accepts
@@ -70488,12 +70488,13 @@
70488 ** Create a new virtual database engine.
70489 */
70490 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
70491 sqlite3 *db = pParse->db;
70492 Vdbe *p;
70493 p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
70494 if( p==0 ) return 0;
 
70495 p->db = db;
70496 if( db->pVdbe ){
70497 db->pVdbe->pPrev = p;
70498 }
70499 p->pNext = db->pVdbe;
@@ -70651,13 +70652,12 @@
70651 #endif
70652 #ifdef SQLITE_DEBUG
70653 if( p->db->flags & SQLITE_VdbeAddopTrace ){
70654 int jj, kk;
70655 Parse *pParse = p->pParse;
70656 for(jj=kk=0; jj<SQLITE_N_COLCACHE; jj++){
70657 struct yColCache *x = pParse->aColCache + jj;
70658 if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue;
70659 printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
70660 kk++;
70661 }
70662 if( kk ) printf("\n");
70663 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
@@ -70841,11 +70841,10 @@
70841 assert( j<p->nLabel );
70842 assert( j>=0 );
70843 if( p->aLabel ){
70844 p->aLabel[j] = v->nOp;
70845 }
70846 p->iFixedOp = v->nOp - 1;
70847 }
70848
70849 /*
70850 ** Mark the VDBE as one that can only be run one time.
70851 */
@@ -71232,19 +71231,19 @@
71232 }
71233 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
71234 sqlite3VdbeGetOp(p,addr)->p3 = val;
71235 }
71236 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 p5){
71237 if( !p->db->mallocFailed ) p->aOp[p->nOp-1].p5 = p5;
 
71238 }
71239
71240 /*
71241 ** Change the P2 operand of instruction addr so that it points to
71242 ** the address of the next instruction to be coded.
71243 */
71244 SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
71245 p->pParse->iFixedOp = p->nOp - 1;
71246 sqlite3VdbeChangeP2(p, addr, p->nOp);
71247 }
71248
71249
71250 /*
@@ -71363,11 +71362,11 @@
71363 /*
71364 ** If the last opcode is "op" and it is not a jump destination,
71365 ** then remove it. Return true if and only if an opcode was removed.
71366 */
71367 SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
71368 if( (p->nOp-1)>(p->pParse->iFixedOp) && p->aOp[p->nOp-1].opcode==op ){
71369 return sqlite3VdbeChangeToNoop(p, p->nOp-1);
71370 }else{
71371 return 0;
71372 }
71373 }
@@ -71925,10 +71924,25 @@
71925 zCom
71926 );
71927 fflush(pOut);
71928 }
71929 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71930
71931 /*
71932 ** Release an array of N Mem elements
71933 */
71934 static void releaseMemArray(Mem *p, int N){
@@ -72137,10 +72151,11 @@
72137 return SQLITE_ERROR;
72138 }
72139 pMem->flags = MEM_Str|MEM_Term;
72140 zP4 = displayP4(pOp, pMem->z, pMem->szMalloc);
72141 if( zP4!=pMem->z ){
 
72142 sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);
72143 }else{
72144 assert( pMem->z!=0 );
72145 pMem->n = sqlite3Strlen30(pMem->z);
72146 pMem->enc = SQLITE_UTF8;
@@ -72279,11 +72294,11 @@
72279 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
72280 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
72281 int i;
72282 #endif
72283 assert( p!=0 );
72284 assert( p->magic==VDBE_MAGIC_INIT );
72285
72286 /* There should be at least one opcode.
72287 */
72288 assert( p->nOp>0 );
72289
@@ -72368,14 +72383,11 @@
72368 n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
72369 x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
72370 assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
72371 x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
72372 assert( x.nFree>=0 );
72373 if( x.nFree>0 ){
72374 memset(x.pSpace, 0, x.nFree);
72375 assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
72376 }
72377
72378 resolveP2Values(p, &nArg);
72379 p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
72380 if( pParse->explain && nMem<10 ){
72381 nMem = 10;
@@ -72400,34 +72412,34 @@
72400 p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
72401 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72402 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
72403 #endif
72404 if( x.nNeeded==0 ) break;
72405 x.pSpace = p->pFree = sqlite3DbMallocZero(db, x.nNeeded);
72406 x.nFree = x.nNeeded;
72407 }while( !db->mallocFailed );
72408
72409 p->nCursor = nCursor;
72410 if( p->aVar ){
72411 p->nVar = (ynVar)nVar;
72412 for(n=0; n<nVar; n++){
72413 p->aVar[n].flags = MEM_Null;
72414 p->aVar[n].db = db;
72415 }
72416 }
72417 p->nzVar = pParse->nzVar;
72418 p->azVar = pParse->azVar;
72419 pParse->nzVar = 0;
72420 pParse->azVar = 0;
72421 if( p->aMem ){
72422 p->nMem = nMem;
72423 for(n=0; n<nMem; n++){
72424 p->aMem[n].flags = MEM_Undefined;
72425 p->aMem[n].db = db;
72426 }
72427 }
72428 p->explain = pParse->explain;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72429 sqlite3VdbeRewind(p);
72430 }
72431
72432 /*
72433 ** Close a VDBE cursor and release all the resources that cursor
@@ -72575,17 +72587,13 @@
72575
72576 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
72577 sqlite3DbFree(db, p->aColName);
72578 n = nResColumn*COLNAME_N;
72579 p->nResColumn = (u16)nResColumn;
72580 p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
72581 if( p->aColName==0 ) return;
72582 while( n-- > 0 ){
72583 pColName->flags = MEM_Null;
72584 pColName->db = p->db;
72585 pColName++;
72586 }
72587 }
72588
72589 /*
72590 ** Set the name of the idx'th column to be returned by the SQL statement.
72591 ** zName must be a pointer to a nul terminated string.
@@ -73343,11 +73351,11 @@
73343 fclose(out);
73344 }
73345 }
73346 #endif
73347 p->iCurrentTime = 0;
73348 p->magic = VDBE_MAGIC_INIT;
73349 return p->rc & db->errMask;
73350 }
73351
73352 /*
73353 ** Clean up and delete a VDBE after execution. Return an integer which is
@@ -73407,23 +73415,25 @@
73407 */
73408 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
73409 SubProgram *pSub, *pNext;
73410 int i;
73411 assert( p->db==0 || p->db==db );
73412 releaseMemArray(p->aVar, p->nVar);
73413 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
73414 for(pSub=p->pProgram; pSub; pSub=pNext){
73415 pNext = pSub->pNext;
73416 vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
73417 sqlite3DbFree(db, pSub);
73418 }
73419 for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
73420 sqlite3DbFree(db, p->azVar);
 
 
 
 
73421 vdbeFreeOpArray(db, p->aOp, p->nOp);
73422 sqlite3DbFree(db, p->aColName);
73423 sqlite3DbFree(db, p->zSql);
73424 sqlite3DbFree(db, p->pFree);
73425 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
73426 for(i=0; i<p->nScan; i++){
73427 sqlite3DbFree(db, p->aScan[i].zName);
73428 }
73429 sqlite3DbFree(db, p->aScan);
@@ -76665,11 +76675,11 @@
76665 /*
76666 ** Return true if the prepared statement is in need of being reset.
76667 */
76668 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
76669 Vdbe *v = (Vdbe*)pStmt;
76670 return v!=0 && v->pc>=0 && v->magic==VDBE_MAGIC_RUN;
76671 }
76672
76673 /*
76674 ** Return a pointer to the next prepared statement after pStmt associated
76675 ** with database connection pDb. If pStmt is NULL, return the first
@@ -78417,15 +78427,17 @@
78417 u16 nullFlag;
78418 pOut = out2Prerelease(p, pOp);
78419 cnt = pOp->p3-pOp->p2;
78420 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );
78421 pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
 
78422 while( cnt>0 ){
78423 pOut++;
78424 memAboutToChange(p, pOut);
78425 sqlite3VdbeMemSetNull(pOut);
78426 pOut->flags = nullFlag;
 
78427 cnt--;
78428 }
78429 break;
78430 }
78431
@@ -92656,36 +92668,23 @@
92656 #endif
92657 }
92658 }
92659 }
92660
92661 #if defined(SQLITE_DEBUG)
92662 /*
92663 ** Verify the consistency of the column cache
92664 */
92665 static int cacheIsValid(Parse *pParse){
92666 int i, n;
92667 for(i=n=0; i<SQLITE_N_COLCACHE; i++){
92668 if( pParse->aColCache[i].iReg>0 ) n++;
92669 }
92670 return n==pParse->nColCache;
92671 }
92672 #endif
92673
92674 /*
92675 ** Clear a cache entry.
92676 */
92677 static void cacheEntryClear(Parse *pParse, struct yColCache *p){
92678 if( p->tempReg ){
92679 if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
92680 pParse->aTempReg[pParse->nTempReg++] = p->iReg;
92681 }
92682 p->tempReg = 0;
92683 }
92684 p->iReg = 0;
92685 pParse->nColCache--;
92686 assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
 
 
92687 }
92688
92689
92690 /*
92691 ** Record in the column cache that a particular column from a
@@ -92711,64 +92710,52 @@
92711 **
92712 ** Actually, the way the column cache is currently used, we are guaranteed
92713 ** that the object will never already be in cache. Verify this guarantee.
92714 */
92715 #ifndef NDEBUG
92716 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92717 assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol );
92718 }
92719 #endif
92720
92721 /* Find an empty slot and replace it */
92722 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92723 if( p->iReg==0 ){
92724 p->iLevel = pParse->iCacheLevel;
92725 p->iTable = iTab;
92726 p->iColumn = iCol;
92727 p->iReg = iReg;
92728 p->tempReg = 0;
92729 p->lru = pParse->iCacheCnt++;
92730 pParse->nColCache++;
92731 assert( pParse->db->mallocFailed || cacheIsValid(pParse) );
92732 return;
92733 }
92734 }
92735
92736 /* Replace the last recently used */
92737 minLru = 0x7fffffff;
92738 idxLru = -1;
92739 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92740 if( p->lru<minLru ){
92741 idxLru = i;
92742 minLru = p->lru;
92743 }
92744 }
92745 if( ALWAYS(idxLru>=0) ){
92746 p = &pParse->aColCache[idxLru];
92747 p->iLevel = pParse->iCacheLevel;
92748 p->iTable = iTab;
92749 p->iColumn = iCol;
92750 p->iReg = iReg;
92751 p->tempReg = 0;
92752 p->lru = pParse->iCacheCnt++;
92753 assert( cacheIsValid(pParse) );
92754 return;
92755 }
 
 
92756 }
92757
92758 /*
92759 ** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
92760 ** Purge the range of registers from the column cache.
92761 */
92762 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
92763 struct yColCache *p;
92764 if( iReg<=0 || pParse->nColCache==0 ) return;
92765 p = &pParse->aColCache[SQLITE_N_COLCACHE-1];
92766 while(1){
92767 if( p->iReg >= iReg && p->iReg < iReg+nReg ) cacheEntryClear(pParse, p);
92768 if( p==pParse->aColCache ) break;
92769 p--;
 
92770 }
92771 }
92772
92773 /*
92774 ** Remember the current column cache context. Any new entries added
@@ -92788,22 +92775,23 @@
92788 ** Remove from the column cache any entries that were added since the
92789 ** the previous sqlite3ExprCachePush operation. In other words, restore
92790 ** the cache to the state it was in prior the most recent Push.
92791 */
92792 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
92793 int i;
92794 struct yColCache *p;
92795 assert( pParse->iCacheLevel>=1 );
92796 pParse->iCacheLevel--;
92797 #ifdef SQLITE_DEBUG
92798 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
92799 printf("POP to %d\n", pParse->iCacheLevel);
92800 }
92801 #endif
92802 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92803 if( p->iReg && p->iLevel>pParse->iCacheLevel ){
92804 cacheEntryClear(pParse, p);
 
 
92805 }
92806 }
92807 }
92808
92809 /*
@@ -92813,11 +92801,11 @@
92813 ** get them all.
92814 */
92815 static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
92816 int i;
92817 struct yColCache *p;
92818 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92819 if( p->iReg==iReg ){
92820 p->tempReg = 0;
92821 }
92822 }
92823 }
@@ -92891,12 +92879,12 @@
92891 ){
92892 Vdbe *v = pParse->pVdbe;
92893 int i;
92894 struct yColCache *p;
92895
92896 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92897 if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){
92898 p->lru = pParse->iCacheCnt++;
92899 sqlite3ExprCachePinRegister(pParse, p->iReg);
92900 return p->iReg;
92901 }
92902 }
@@ -92924,22 +92912,24 @@
92924 /*
92925 ** Clear all column cache entries.
92926 */
92927 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
92928 int i;
92929 struct yColCache *p;
92930
92931 #if SQLITE_DEBUG
92932 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
92933 printf("CLEAR\n");
92934 }
92935 #endif
92936 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92937 if( p->iReg ){
92938 cacheEntryClear(pParse, p);
 
 
92939 }
92940 }
 
92941 }
92942
92943 /*
92944 ** Record the fact that an affinity change has occurred on iCount
92945 ** registers starting with iStart.
@@ -92967,11 +92957,11 @@
92967 ** and does not appear in a normal build.
92968 */
92969 static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
92970 int i;
92971 struct yColCache *p;
92972 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92973 int r = p->iReg;
92974 if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/
92975 }
92976 return 0;
92977 }
@@ -94663,11 +94653,11 @@
94663 */
94664 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
94665 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
94666 int i;
94667 struct yColCache *p;
94668 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
94669 if( p->iReg==iReg ){
94670 p->tempReg = 1;
94671 return;
94672 }
94673 }
@@ -98433,11 +98423,10 @@
98433 */
98434 v = sqlite3GetVdbe(pParse);
98435 assert( !pParse->isMultiWrite
98436 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
98437 if( v ){
98438 while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){}
98439 sqlite3VdbeAddOp0(v, OP_Halt);
98440
98441 #if SQLITE_USER_AUTHENTICATION
98442 if( pParse->nTableLock>0 && db->init.busy==0 ){
98443 sqlite3UserAuthInit(db);
@@ -98460,18 +98449,20 @@
98460 ){
98461 int iDb, i;
98462 assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
98463 sqlite3VdbeJumpHere(v, 0);
98464 for(iDb=0; iDb<db->nDb; iDb++){
 
98465 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
98466 sqlite3VdbeUsesBtree(v, iDb);
 
98467 sqlite3VdbeAddOp4Int(v,
98468 OP_Transaction, /* Opcode */
98469 iDb, /* P1 */
98470 DbMaskTest(pParse->writeMask,iDb), /* P2 */
98471 pParse->cookieValue[iDb], /* P3 */
98472 db->aDb[iDb].pSchema->iGeneration /* P4 */
98473 );
98474 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
98475 VdbeComment((v,
98476 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
98477 }
@@ -98518,20 +98509,10 @@
98518 sqlite3VdbeMakeReady(v, pParse);
98519 pParse->rc = SQLITE_DONE;
98520 }else{
98521 pParse->rc = SQLITE_ERROR;
98522 }
98523
98524 /* We are done with this Parse object. There is no need to de-initialize it */
98525 #if 0
98526 pParse->colNamesSet = 0;
98527 pParse->nTab = 0;
98528 pParse->nMem = 0;
98529 pParse->nSet = 0;
98530 pParse->nVar = 0;
98531 DbMaskZero(pParse->cookieMask);
98532 #endif
98533 }
98534
98535 /*
98536 ** Run the parser and code generator recursively in order to generate
98537 ** code for the SQL statement given onto the end of the pParse context
@@ -98547,12 +98528,11 @@
98547 SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
98548 va_list ap;
98549 char *zSql;
98550 char *zErrMsg = 0;
98551 sqlite3 *db = pParse->db;
98552 # define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar))
98553 char saveBuf[SAVE_SZ];
98554
98555 if( pParse->nErr ) return;
98556 assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
98557 va_start(ap, zFormat);
98558 zSql = sqlite3VMPrintf(db, zFormat, ap);
@@ -98559,16 +98539,16 @@
98559 va_end(ap);
98560 if( zSql==0 ){
98561 return; /* A malloc must have failed */
98562 }
98563 pParse->nested++;
98564 memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
98565 memset(&pParse->nVar, 0, SAVE_SZ);
98566 sqlite3RunParser(pParse, zSql, &zErrMsg);
98567 sqlite3DbFree(db, zErrMsg);
98568 sqlite3DbFree(db, zSql);
98569 memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
98570 pParse->nested--;
98571 }
98572
98573 #if SQLITE_USER_AUTHENTICATION
98574 /*
@@ -102331,19 +102311,17 @@
102331 ** will occur at the end of the top-level VDBE and will be generated
102332 ** later, by sqlite3FinishCoding().
102333 */
102334 SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
102335 Parse *pToplevel = sqlite3ParseToplevel(pParse);
102336 sqlite3 *db = pToplevel->db;
102337
102338 assert( iDb>=0 && iDb<db->nDb );
102339 assert( db->aDb[iDb].pBt!=0 || iDb==1 );
102340 assert( iDb<SQLITE_MAX_ATTACHED+2 );
102341 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
102342 if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
102343 DbMaskSet(pToplevel->cookieMask, iDb);
102344 pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
102345 if( !OMIT_TEMPDB && iDb==1 ){
102346 sqlite3OpenTempDatabase(pToplevel);
102347 }
102348 }
102349 }
@@ -114053,15 +114031,17 @@
114053 char *zErrMsg = 0; /* Error message */
114054 int rc = SQLITE_OK; /* Result code */
114055 int i; /* Loop counter */
114056
114057 /* Allocate the parsing context */
114058 pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
114059 if( pParse==0 ){
114060 rc = SQLITE_NOMEM_BKPT;
114061 goto end_prepare;
114062 }
 
 
114063 pParse->pReprepare = pReprepare;
114064 assert( ppStmt && *ppStmt==0 );
114065 /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
114066 assert( sqlite3_mutex_held(db->mutex) );
114067
@@ -115395,11 +115375,11 @@
115395 ** Allocate a KeyInfo object sufficient for an index of N key columns and
115396 ** X extra columns.
115397 */
115398 SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
115399 int nExtra = (N+X)*(sizeof(CollSeq*)+1);
115400 KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra);
115401 if( p ){
115402 p->aSortOrder = (u8*)&p->aColl[N+X];
115403 p->nField = (u16)N;
115404 p->nXField = (u16)X;
115405 p->enc = ENC(db);
115406
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -381,11 +381,11 @@
381 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
382 ** [sqlite_version()] and [sqlite_source_id()].
383 */
384 #define SQLITE_VERSION "3.15.0"
385 #define SQLITE_VERSION_NUMBER 3015000
386 #define SQLITE_SOURCE_ID "2016-10-01 23:55:23 fe07609efc31c4639c40fbda501c55f443756ad2"
387
388 /*
389 ** CAPI3REF: Run-Time Library Version Numbers
390 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
391 **
@@ -15515,39 +15515,27 @@
15515 u8 mayAbort; /* True if statement may throw an ABORT exception */
15516 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
15517 u8 okConstFactor; /* OK to factor out constants */
15518 u8 disableLookaside; /* Number of times lookaside has been disabled */
15519 u8 nColCache; /* Number of entries in aColCache[] */
 
15520 int nRangeReg; /* Size of the temporary register block */
15521 int iRangeReg; /* First register in temporary register block */
15522 int nErr; /* Number of errors seen */
15523 int nTab; /* Number of previously allocated VDBE cursors */
15524 int nMem; /* Number of memory cells used so far */
 
15525 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
15526 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
 
15527 int ckBase; /* Base register of data during check constraints */
15528 int iSelfTab; /* Table of an index whose exprs are being coded */
15529 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
15530 int iCacheCnt; /* Counter used to generate aColCache[].lru values */
15531 int nLabel; /* Number of labels used */
15532 int *aLabel; /* Space to hold the labels */
 
 
 
 
 
 
 
 
15533 ExprList *pConstExpr;/* Constant expressions */
15534 Token constraintName;/* Name of the constraint currently being parsed */
15535 yDbMask writeMask; /* Start a write transaction on these databases */
15536 yDbMask cookieMask; /* Bitmask of schema verified databases */
 
15537 int regRowid; /* Register holding rowid of CREATE TABLE entry */
15538 int regRoot; /* Register holding root page number for new objects */
15539 int nMaxArg; /* Max args passed to user function by sub-program */
15540 #if SELECTTRACE_ENABLED
15541 int nSelect; /* Number of SELECT statements seen */
@@ -15556,21 +15544,38 @@
15544 #ifndef SQLITE_OMIT_SHARED_CACHE
15545 int nTableLock; /* Number of locks in aTableLock */
15546 TableLock *aTableLock; /* Required table locks for shared-cache mode */
15547 #endif
15548 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
 
 
15549 Parse *pToplevel; /* Parse structure for main program (or NULL) */
15550 Table *pTriggerTab; /* Table triggers are being coded for */
15551 int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */
15552 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
15553 u32 oldmask; /* Mask of old.* columns referenced */
15554 u32 newmask; /* Mask of new.* columns referenced */
15555 u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
15556 u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
15557 u8 disableTriggers; /* True to disable triggers */
15558
15559 /**************************************************************************
15560 ** Fields above must be initialized to zero. The fields that follow,
15561 ** down to the beginning of the recursive section, do not need to be
15562 ** initialized as they will be set before being used. The boundary is
15563 ** determined by offsetof(Parse,aColCache).
15564 **************************************************************************/
15565
15566 struct yColCache {
15567 int iTable; /* Table cursor number */
15568 i16 iColumn; /* Table column number */
15569 u8 tempReg; /* iReg is a temp register that needs to be freed */
15570 int iLevel; /* Nesting level */
15571 int iReg; /* Reg with value of this column. 0 means none. */
15572 int lru; /* Least recently used entry has the smallest value */
15573 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
15574 int aTempReg[8]; /* Holding area for temporary registers */
15575 Token sNameToken; /* Token with unqualified schema object name */
15576 Token sLastToken; /* The last token parsed */
15577
15578 /************************************************************************
15579 ** Above is constant between recursions. Below is reset before and after
15580 ** each recursion. The boundary between these two regions is determined
15581 ** using offsetof(Parse,nVar) so the nVar field must be the first field
@@ -15583,11 +15588,10 @@
15588 u8 explain; /* True if the EXPLAIN flag is found on the query */
15589 #ifndef SQLITE_OMIT_VIRTUALTABLE
15590 u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
15591 int nVtabLock; /* Number of virtual tables to lock */
15592 #endif
 
15593 int nHeight; /* Expression tree height of current sub-select */
15594 #ifndef SQLITE_OMIT_EXPLAIN
15595 int iSelectId; /* ID of current select for EXPLAIN output */
15596 int iNextSelectId; /* Next available select ID for EXPLAIN output */
15597 #endif
@@ -15595,12 +15599,10 @@
15599 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
15600 const char *zTail; /* All SQL text past the last semicolon parsed */
15601 Table *pNewTable; /* A table being constructed by CREATE TABLE */
15602 Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
15603 const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
 
 
15604 #ifndef SQLITE_OMIT_VIRTUALTABLE
15605 Token sArg; /* Complete text of a module argument */
15606 Table **apVtabLock; /* Pointer to virtual tables needing locking */
15607 #endif
15608 Table *pZombieTab; /* List of Table objects to delete after code gen */
@@ -15607,10 +15609,18 @@
15609 TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
15610 With *pWith; /* Current WITH clause, or NULL */
15611 With *pWithToFree; /* Free this WITH object at the end of the parse */
15612 };
15613
15614 /*
15615 ** Sizes and pointers of various parts of the Parse object.
15616 */
15617 #define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
15618 #define PARSE_RECURSE_SZ offsetof(Parse,nVar) /* Recursive part */
15619 #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
15620 #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
15621
15622 /*
15623 ** Return true if currently inside an sqlite3_declare_vtab() call.
15624 */
15625 #ifdef SQLITE_OMIT_VIRTUALTABLE
15626 #define IN_DECLARE_VTAB 0
@@ -16990,20 +17000,17 @@
17000 ** If x is a lower-case ASCII character, then its upper-case equivalent
17001 ** is (x - 0x20). Therefore toupper() can be implemented as:
17002 **
17003 ** (x & ~(map[x]&0x20))
17004 **
17005 ** The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
17006 ** array. tolower() is used more often than toupper() by SQLite.
17007 **
17008 ** Bit 0x40 is set if the character is non-alphanumeric and can be used in an
17009 ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any
17010 ** non-ASCII UTF character. Hence the test for whether or not a character is
17011 ** part of an identifier is 0x46.
 
 
 
17012 */
17013 #ifdef SQLITE_ASCII
17014 SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = {
17015 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */
17016 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */
@@ -17072,11 +17079,11 @@
17079 #ifndef SQLITE_SORTER_PMASZ
17080 # define SQLITE_SORTER_PMASZ 250
17081 #endif
17082
17083 /* Statement journals spill to disk when their size exceeds the following
17084 ** threshold (in bytes). 0 means that statement journals are created and
17085 ** written to disk immediately (the default behavior for SQLite versions
17086 ** before 3.12.0). -1 means always keep the entire statement journal in
17087 ** memory. (The statement journal is also always held entirely in memory
17088 ** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this
17089 ** setting.)
@@ -17160,11 +17167,11 @@
17167
17168 /*
17169 ** The value of the "pending" byte must be 0x40000000 (1 byte past the
17170 ** 1-gibabyte boundary) in a compatible database. SQLite never uses
17171 ** the database page that contains the pending byte. It never attempts
17172 ** to read or write that page. The pending byte page is set aside
17173 ** for use by the VFS layers as space for managing file locks.
17174 **
17175 ** During testing, it is often desirable to move the pending byte to
17176 ** a different position in the file. This allows code that has to
17177 ** deal with the pending byte to run on files that are much smaller
@@ -17720,13 +17727,10 @@
17727 typedef unsigned Bool;
17728
17729 /* Opaque type used by code in vdbesort.c */
17730 typedef struct VdbeSorter VdbeSorter;
17731
 
 
 
17732 /* Elements of the linked list at Vdbe.pAuxData */
17733 typedef struct AuxData AuxData;
17734
17735 /* Types of VDBE cursors */
17736 #define CURTYPE_BTREE 0
@@ -17797,10 +17801,16 @@
17801 /* 2*nField extra array elements allocated for aType[], beyond the one
17802 ** static element declared in the structure. nField total array slots for
17803 ** aType[] and nField+1 array slots for aOffset[] */
17804 };
17805
17806
17807 /*
17808 ** A value for VdbeCursor.cacheStatus that means the cache is always invalid.
17809 */
17810 #define CACHE_STALE 0
17811
17812 /*
17813 ** When a sub-program is executed (OP_Program), a structure of this type
17814 ** is allocated to store the current value of the program counter, as
17815 ** well as the current memory cell array and various other frame specific
17816 ** values stored in the Vdbe struct. When the sub-program is finished,
@@ -17841,15 +17851,10 @@
17851 int nDbChange; /* Value of db->nChange */
17852 };
17853
17854 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
17855
 
 
 
 
 
17856 /*
17857 ** Internally, the vdbe manipulates nearly all SQL values as Mem
17858 ** structures. Each Mem struct may cache multiple representations (string,
17859 ** integer etc.) of the same value.
17860 */
@@ -17986,22 +17991,10 @@
17991 u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */
17992 u8 argc; /* Number of arguments */
17993 sqlite3_value *argv[1]; /* Argument set */
17994 };
17995
 
 
 
 
 
 
 
 
 
 
 
 
17996 /* A bitfield type for use inside of structures. Always follow with :N where
17997 ** N is the number of bits.
17998 */
17999 typedef unsigned bft; /* Bit Field Type */
18000
@@ -18022,57 +18015,61 @@
18015 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
18016 ** is really a pointer to an instance of this structure.
18017 */
18018 struct Vdbe {
18019 sqlite3 *db; /* The database connection that owns this statement */
18020 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
18021 Parse *pParse; /* Parsing context used to create this Vdbe */
18022 ynVar nVar; /* Number of entries in aVar[] */
18023 ynVar nzVar; /* Number of entries in azVar[] */
18024 u32 magic; /* Magic number for sanity checking */
18025 int nMem; /* Number of memory locations currently allocated */
18026 int nCursor; /* Number of slots in apCsr[] */
18027 u32 cacheCtr; /* VdbeCursor row cache generation counter */
18028 int pc; /* The program counter */
18029 int rc; /* Value to return */
18030 int nChange; /* Number of db changes made since last reset */
18031 int iStatement; /* Statement number (or 0 if has not opened stmt) */
18032 i64 iCurrentTime; /* Value of julianday('now') for this statement */
18033 i64 nFkConstraint; /* Number of imm. FK constraints this VM */
18034 i64 nStmtDefCons; /* Number of def. constraints when stmt started */
18035 i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
18036
18037 /* When allocating a new Vdbe object, all of the fields below should be
18038 ** initialized to zero or NULL */
18039
18040 Op *aOp; /* Space to hold the virtual machine's program */
18041 Mem *aMem; /* The memory locations */
18042 Mem **apArg; /* Arguments to currently executing user function */
18043 Mem *aColName; /* Column names to return */
18044 Mem *pResultSet; /* Pointer to an array of results */
 
 
 
 
 
18045 char *zErrMsg; /* Error message written here */
 
18046 VdbeCursor **apCsr; /* One element of this array for each open cursor */
18047 Mem *aVar; /* Values for the OP_Variable opcode. */
18048 char **azVar; /* Name of variables */
18049 #ifndef SQLITE_OMIT_TRACE
18050 i64 startTime; /* Time when query started - used for profiling */
18051 #endif
18052 int nOp; /* Number of instructions in the program */
 
18053 #ifdef SQLITE_DEBUG
18054 int rcApp; /* errcode set by sqlite3_result_error_code() */
18055 #endif
18056 u16 nResColumn; /* Number of columns in one row of the result set */
18057 u8 errorAction; /* Recovery action to do in case of an error */
18058 u8 minWriteFileFormat; /* Minimum file format for writable database files */
18059 bft expired:1; /* True if the VM needs to be recompiled */
18060 bft doingRerun:1; /* True if rerunning after an auto-reprepare */
 
18061 bft explain:2; /* True if EXPLAIN present on SQL command */
18062 bft changeCntOn:1; /* True to update the change-counter */
18063 bft runOnlyOnce:1; /* Automatically expire on reset */
18064 bft usesStmtJournal:1; /* True if uses a statement journal */
18065 bft readOnly:1; /* True for statements that do not write */
18066 bft bIsReader:1; /* True for statements that read */
18067 bft isPrepareV2:1; /* True if prepared with prepare_v2() */
 
18068 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
18069 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
 
18070 u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
 
 
 
 
 
 
 
18071 char *zSql; /* Text of the SQL statement that generated this */
18072 void *pFree; /* Free this when deleting the vdbe */
18073 VdbeFrame *pFrame; /* Parent frame */
18074 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
18075 int nFrame; /* Number of frames in pFrame list */
@@ -18087,14 +18084,15 @@
18084 };
18085
18086 /*
18087 ** The following are allowed values for Vdbe.magic
18088 */
18089 #define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
18090 #define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
18091 #define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
18092 #define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
18093 #define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
18094
18095 /*
18096 ** Structure used to store the context required by the
18097 ** sqlite3_preupdate_*() API functions.
18098 */
@@ -28776,11 +28774,15 @@
28774 */
28775 static unsigned int strHash(const char *z){
28776 unsigned int h = 0;
28777 unsigned char c;
28778 while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
28779 /* Knuth multiplicative hashing. (Sorting & Searching, p. 510).
28780 ** 0x9e3779b1 is 2654435761 which is the closest prime number to
28781 ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */
28782 h += sqlite3UpperToLower[c];
28783 h *= 0x9e3779b1;
28784 }
28785 return h;
28786 }
28787
28788
@@ -44019,11 +44021,11 @@
44021 ){
44022 PgHdr *pPgHdr;
44023 assert( pPage!=0 );
44024 pPgHdr = (PgHdr*)pPage->pExtra;
44025 assert( pPgHdr->pPage==0 );
44026 memset(&pPgHdr->pDirty, 0, sizeof(PgHdr) - offsetof(PgHdr,pDirty));
44027 pPgHdr->pPage = pPage;
44028 pPgHdr->pData = pPage->pBuf;
44029 pPgHdr->pExtra = (void *)&pPgHdr[1];
44030 memset(pPgHdr->pExtra, 0, pCache->szExtra);
44031 pPgHdr->pCache = pCache;
@@ -69042,10 +69044,11 @@
69044 assert( (pMem->flags&MEM_RowSet)==0 );
69045 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
69046
69047
69048 if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
69049 pMem->enc = 0;
69050 return SQLITE_NOMEM_BKPT;
69051 }
69052
69053 /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
69054 ** string representation of the value. Then, if the required encoding
@@ -70018,14 +70021,11 @@
70021 sqlite3_value *pVal = 0;
70022 int negInt = 1;
70023 const char *zNeg = "";
70024 int rc = SQLITE_OK;
70025
70026 assert( pExpr!=0 );
 
 
 
70027 while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
70028 if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
70029
70030 /* Compressed expressions only appear when parsing the DEFAULT clause
70031 ** on a table column definition, and hence only when pCtx==0. This
@@ -70145,11 +70145,11 @@
70145 Expr *pExpr, /* The expression to evaluate */
70146 u8 enc, /* Encoding to use */
70147 u8 affinity, /* Affinity to use */
70148 sqlite3_value **ppVal /* Write the new value here */
70149 ){
70150 return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;
70151 }
70152
70153 #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
70154 /*
70155 ** The implementation of the sqlite_record() function. This function accepts
@@ -70488,12 +70488,13 @@
70488 ** Create a new virtual database engine.
70489 */
70490 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
70491 sqlite3 *db = pParse->db;
70492 Vdbe *p;
70493 p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
70494 if( p==0 ) return 0;
70495 memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
70496 p->db = db;
70497 if( db->pVdbe ){
70498 db->pVdbe->pPrev = p;
70499 }
70500 p->pNext = db->pVdbe;
@@ -70651,13 +70652,12 @@
70652 #endif
70653 #ifdef SQLITE_DEBUG
70654 if( p->db->flags & SQLITE_VdbeAddopTrace ){
70655 int jj, kk;
70656 Parse *pParse = p->pParse;
70657 for(jj=kk=0; jj<pParse->nColCache; jj++){
70658 struct yColCache *x = pParse->aColCache + jj;
 
70659 printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
70660 kk++;
70661 }
70662 if( kk ) printf("\n");
70663 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
@@ -70841,11 +70841,10 @@
70841 assert( j<p->nLabel );
70842 assert( j>=0 );
70843 if( p->aLabel ){
70844 p->aLabel[j] = v->nOp;
70845 }
 
70846 }
70847
70848 /*
70849 ** Mark the VDBE as one that can only be run one time.
70850 */
@@ -71232,19 +71231,19 @@
71231 }
71232 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
71233 sqlite3VdbeGetOp(p,addr)->p3 = val;
71234 }
71235 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 p5){
71236 assert( p->nOp>0 || p->db->mallocFailed );
71237 if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
71238 }
71239
71240 /*
71241 ** Change the P2 operand of instruction addr so that it points to
71242 ** the address of the next instruction to be coded.
71243 */
71244 SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
 
71245 sqlite3VdbeChangeP2(p, addr, p->nOp);
71246 }
71247
71248
71249 /*
@@ -71363,11 +71362,11 @@
71362 /*
71363 ** If the last opcode is "op" and it is not a jump destination,
71364 ** then remove it. Return true if and only if an opcode was removed.
71365 */
71366 SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
71367 if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
71368 return sqlite3VdbeChangeToNoop(p, p->nOp-1);
71369 }else{
71370 return 0;
71371 }
71372 }
@@ -71925,10 +71924,25 @@
71924 zCom
71925 );
71926 fflush(pOut);
71927 }
71928 #endif
71929
71930 /*
71931 ** Initialize an array of N Mem element.
71932 */
71933 static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
71934 while( (N--)>0 ){
71935 p->db = db;
71936 p->flags = flags;
71937 p->szMalloc = 0;
71938 #ifdef SQLITE_DEBUG
71939 p->pScopyFrom = 0;
71940 #endif
71941 p++;
71942 }
71943 }
71944
71945 /*
71946 ** Release an array of N Mem elements
71947 */
71948 static void releaseMemArray(Mem *p, int N){
@@ -72137,10 +72151,11 @@
72151 return SQLITE_ERROR;
72152 }
72153 pMem->flags = MEM_Str|MEM_Term;
72154 zP4 = displayP4(pOp, pMem->z, pMem->szMalloc);
72155 if( zP4!=pMem->z ){
72156 pMem->n = 0;
72157 sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);
72158 }else{
72159 assert( pMem->z!=0 );
72160 pMem->n = sqlite3Strlen30(pMem->z);
72161 pMem->enc = SQLITE_UTF8;
@@ -72279,11 +72294,11 @@
72294 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
72295 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
72296 int i;
72297 #endif
72298 assert( p!=0 );
72299 assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );
72300
72301 /* There should be at least one opcode.
72302 */
72303 assert( p->nOp>0 );
72304
@@ -72368,14 +72383,11 @@
72383 n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
72384 x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
72385 assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );
72386 x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
72387 assert( x.nFree>=0 );
72388 assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );
 
 
 
72389
72390 resolveP2Values(p, &nArg);
72391 p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
72392 if( pParse->explain && nMem<10 ){
72393 nMem = 10;
@@ -72400,34 +72412,34 @@
72412 p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));
72413 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72414 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
72415 #endif
72416 if( x.nNeeded==0 ) break;
72417 x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded);
72418 x.nFree = x.nNeeded;
72419 }while( !db->mallocFailed );
72420
 
 
 
 
 
 
 
 
72421 p->nzVar = pParse->nzVar;
72422 p->azVar = pParse->azVar;
72423 pParse->nzVar = 0;
72424 pParse->azVar = 0;
 
 
 
 
 
 
 
72425 p->explain = pParse->explain;
72426 if( db->mallocFailed ){
72427 p->nVar = 0;
72428 p->nCursor = 0;
72429 p->nMem = 0;
72430 }else{
72431 p->nCursor = nCursor;
72432 p->nVar = (ynVar)nVar;
72433 initMemArray(p->aVar, nVar, db, MEM_Null);
72434 p->nMem = nMem;
72435 initMemArray(p->aMem, nMem, db, MEM_Undefined);
72436 memset(p->apCsr, 0, nCursor*sizeof(VdbeCursor*));
72437 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
72438 memset(p->anExec, 0, p->nOp*sizeof(i64));
72439 #endif
72440 }
72441 sqlite3VdbeRewind(p);
72442 }
72443
72444 /*
72445 ** Close a VDBE cursor and release all the resources that cursor
@@ -72575,17 +72587,13 @@
72587
72588 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
72589 sqlite3DbFree(db, p->aColName);
72590 n = nResColumn*COLNAME_N;
72591 p->nResColumn = (u16)nResColumn;
72592 p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
72593 if( p->aColName==0 ) return;
72594 initMemArray(p->aColName, n, p->db, MEM_Null);
 
 
 
 
72595 }
72596
72597 /*
72598 ** Set the name of the idx'th column to be returned by the SQL statement.
72599 ** zName must be a pointer to a nul terminated string.
@@ -73343,11 +73351,11 @@
73351 fclose(out);
73352 }
73353 }
73354 #endif
73355 p->iCurrentTime = 0;
73356 p->magic = VDBE_MAGIC_RESET;
73357 return p->rc & db->errMask;
73358 }
73359
73360 /*
73361 ** Clean up and delete a VDBE after execution. Return an integer which is
@@ -73407,23 +73415,25 @@
73415 */
73416 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
73417 SubProgram *pSub, *pNext;
73418 int i;
73419 assert( p->db==0 || p->db==db );
 
73420 releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
73421 for(pSub=p->pProgram; pSub; pSub=pNext){
73422 pNext = pSub->pNext;
73423 vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
73424 sqlite3DbFree(db, pSub);
73425 }
73426 if( p->magic!=VDBE_MAGIC_INIT ){
73427 releaseMemArray(p->aVar, p->nVar);
73428 for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);
73429 sqlite3DbFree(db, p->azVar);
73430 sqlite3DbFree(db, p->pFree);
73431 }
73432 vdbeFreeOpArray(db, p->aOp, p->nOp);
73433 sqlite3DbFree(db, p->aColName);
73434 sqlite3DbFree(db, p->zSql);
 
73435 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
73436 for(i=0; i<p->nScan; i++){
73437 sqlite3DbFree(db, p->aScan[i].zName);
73438 }
73439 sqlite3DbFree(db, p->aScan);
@@ -76665,11 +76675,11 @@
76675 /*
76676 ** Return true if the prepared statement is in need of being reset.
76677 */
76678 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){
76679 Vdbe *v = (Vdbe*)pStmt;
76680 return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
76681 }
76682
76683 /*
76684 ** Return a pointer to the next prepared statement after pStmt associated
76685 ** with database connection pDb. If pStmt is NULL, return the first
@@ -78417,15 +78427,17 @@
78427 u16 nullFlag;
78428 pOut = out2Prerelease(p, pOp);
78429 cnt = pOp->p3-pOp->p2;
78430 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );
78431 pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
78432 pOut->n = 0;
78433 while( cnt>0 ){
78434 pOut++;
78435 memAboutToChange(p, pOut);
78436 sqlite3VdbeMemSetNull(pOut);
78437 pOut->flags = nullFlag;
78438 pOut->n = 0;
78439 cnt--;
78440 }
78441 break;
78442 }
78443
@@ -92656,36 +92668,23 @@
92668 #endif
92669 }
92670 }
92671 }
92672
92673 /*
92674 ** Erase column-cache entry number i
92675 */
92676 static void cacheEntryClear(Parse *pParse, int i){
92677 if( pParse->aColCache[i].tempReg ){
 
 
 
 
 
 
 
 
 
 
 
 
 
92678 if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
92679 pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
92680 }
 
92681 }
 
92682 pParse->nColCache--;
92683 if( i<pParse->nColCache ){
92684 pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];
92685 }
92686 }
92687
92688
92689 /*
92690 ** Record in the column cache that a particular column from a
@@ -92711,64 +92710,52 @@
92710 **
92711 ** Actually, the way the column cache is currently used, we are guaranteed
92712 ** that the object will never already be in cache. Verify this guarantee.
92713 */
92714 #ifndef NDEBUG
92715 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92716 assert( p->iTable!=iTab || p->iColumn!=iCol );
92717 }
92718 #endif
92719
92720 /* If the cache is already full, delete the least recently used entry */
92721 if( pParse->nColCache>=SQLITE_N_COLCACHE ){
92722 minLru = 0x7fffffff;
92723 idxLru = -1;
92724 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
92725 if( p->lru<minLru ){
92726 idxLru = i;
92727 minLru = p->lru;
92728 }
92729 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92730 p = &pParse->aColCache[idxLru];
92731 }else{
92732 p = &pParse->aColCache[pParse->nColCache++];
92733 }
92734
92735 /* Add the new entry to the end of the cache */
92736 p->iLevel = pParse->iCacheLevel;
92737 p->iTable = iTab;
92738 p->iColumn = iCol;
92739 p->iReg = iReg;
92740 p->tempReg = 0;
92741 p->lru = pParse->iCacheCnt++;
92742 }
92743
92744 /*
92745 ** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
92746 ** Purge the range of registers from the column cache.
92747 */
92748 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
92749 int i = 0;
92750 while( i<pParse->nColCache ){
92751 struct yColCache *p = &pParse->aColCache[i];
92752 if( p->iReg >= iReg && p->iReg < iReg+nReg ){
92753 cacheEntryClear(pParse, i);
92754 }else{
92755 i++;
92756 }
92757 }
92758 }
92759
92760 /*
92761 ** Remember the current column cache context. Any new entries added
@@ -92788,22 +92775,23 @@
92775 ** Remove from the column cache any entries that were added since the
92776 ** the previous sqlite3ExprCachePush operation. In other words, restore
92777 ** the cache to the state it was in prior the most recent Push.
92778 */
92779 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
92780 int i = 0;
 
92781 assert( pParse->iCacheLevel>=1 );
92782 pParse->iCacheLevel--;
92783 #ifdef SQLITE_DEBUG
92784 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
92785 printf("POP to %d\n", pParse->iCacheLevel);
92786 }
92787 #endif
92788 while( i<pParse->nColCache ){
92789 if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){
92790 cacheEntryClear(pParse, i);
92791 }else{
92792 i++;
92793 }
92794 }
92795 }
92796
92797 /*
@@ -92813,11 +92801,11 @@
92801 ** get them all.
92802 */
92803 static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
92804 int i;
92805 struct yColCache *p;
92806 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92807 if( p->iReg==iReg ){
92808 p->tempReg = 0;
92809 }
92810 }
92811 }
@@ -92891,12 +92879,12 @@
92879 ){
92880 Vdbe *v = pParse->pVdbe;
92881 int i;
92882 struct yColCache *p;
92883
92884 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92885 if( p->iTable==iTable && p->iColumn==iColumn ){
92886 p->lru = pParse->iCacheCnt++;
92887 sqlite3ExprCachePinRegister(pParse, p->iReg);
92888 return p->iReg;
92889 }
92890 }
@@ -92924,22 +92912,24 @@
92912 /*
92913 ** Clear all column cache entries.
92914 */
92915 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
92916 int i;
 
92917
92918 #if SQLITE_DEBUG
92919 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
92920 printf("CLEAR\n");
92921 }
92922 #endif
92923 for(i=0; i<pParse->nColCache; i++){
92924 if( pParse->aColCache[i].tempReg
92925 && pParse->nTempReg<ArraySize(pParse->aTempReg)
92926 ){
92927 pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
92928 }
92929 }
92930 pParse->nColCache = 0;
92931 }
92932
92933 /*
92934 ** Record the fact that an affinity change has occurred on iCount
92935 ** registers starting with iStart.
@@ -92967,11 +92957,11 @@
92957 ** and does not appear in a normal build.
92958 */
92959 static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
92960 int i;
92961 struct yColCache *p;
92962 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
92963 int r = p->iReg;
92964 if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/
92965 }
92966 return 0;
92967 }
@@ -94663,11 +94653,11 @@
94653 */
94654 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
94655 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
94656 int i;
94657 struct yColCache *p;
94658 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
94659 if( p->iReg==iReg ){
94660 p->tempReg = 1;
94661 return;
94662 }
94663 }
@@ -98433,11 +98423,10 @@
98423 */
98424 v = sqlite3GetVdbe(pParse);
98425 assert( !pParse->isMultiWrite
98426 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
98427 if( v ){
 
98428 sqlite3VdbeAddOp0(v, OP_Halt);
98429
98430 #if SQLITE_USER_AUTHENTICATION
98431 if( pParse->nTableLock>0 && db->init.busy==0 ){
98432 sqlite3UserAuthInit(db);
@@ -98460,18 +98449,20 @@
98449 ){
98450 int iDb, i;
98451 assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
98452 sqlite3VdbeJumpHere(v, 0);
98453 for(iDb=0; iDb<db->nDb; iDb++){
98454 Schema *pSchema;
98455 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
98456 sqlite3VdbeUsesBtree(v, iDb);
98457 pSchema = db->aDb[iDb].pSchema;
98458 sqlite3VdbeAddOp4Int(v,
98459 OP_Transaction, /* Opcode */
98460 iDb, /* P1 */
98461 DbMaskTest(pParse->writeMask,iDb), /* P2 */
98462 pSchema->schema_cookie, /* P3 */
98463 pSchema->iGeneration /* P4 */
98464 );
98465 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
98466 VdbeComment((v,
98467 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
98468 }
@@ -98518,20 +98509,10 @@
98509 sqlite3VdbeMakeReady(v, pParse);
98510 pParse->rc = SQLITE_DONE;
98511 }else{
98512 pParse->rc = SQLITE_ERROR;
98513 }
 
 
 
 
 
 
 
 
 
 
98514 }
98515
98516 /*
98517 ** Run the parser and code generator recursively in order to generate
98518 ** code for the SQL statement given onto the end of the pParse context
@@ -98547,12 +98528,11 @@
98528 SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
98529 va_list ap;
98530 char *zSql;
98531 char *zErrMsg = 0;
98532 sqlite3 *db = pParse->db;
98533 char saveBuf[PARSE_TAIL_SZ];
 
98534
98535 if( pParse->nErr ) return;
98536 assert( pParse->nested<10 ); /* Nesting should only be of limited depth */
98537 va_start(ap, zFormat);
98538 zSql = sqlite3VMPrintf(db, zFormat, ap);
@@ -98559,16 +98539,16 @@
98539 va_end(ap);
98540 if( zSql==0 ){
98541 return; /* A malloc must have failed */
98542 }
98543 pParse->nested++;
98544 memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);
98545 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
98546 sqlite3RunParser(pParse, zSql, &zErrMsg);
98547 sqlite3DbFree(db, zErrMsg);
98548 sqlite3DbFree(db, zSql);
98549 memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);
98550 pParse->nested--;
98551 }
98552
98553 #if SQLITE_USER_AUTHENTICATION
98554 /*
@@ -102331,19 +102311,17 @@
102311 ** will occur at the end of the top-level VDBE and will be generated
102312 ** later, by sqlite3FinishCoding().
102313 */
102314 SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
102315 Parse *pToplevel = sqlite3ParseToplevel(pParse);
 
102316
102317 assert( iDb>=0 && iDb<pParse->db->nDb );
102318 assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 );
102319 assert( iDb<SQLITE_MAX_ATTACHED+2 );
102320 assert( sqlite3SchemaMutexHeld(pParse->db, iDb, 0) );
102321 if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
102322 DbMaskSet(pToplevel->cookieMask, iDb);
 
102323 if( !OMIT_TEMPDB && iDb==1 ){
102324 sqlite3OpenTempDatabase(pToplevel);
102325 }
102326 }
102327 }
@@ -114053,15 +114031,17 @@
114031 char *zErrMsg = 0; /* Error message */
114032 int rc = SQLITE_OK; /* Result code */
114033 int i; /* Loop counter */
114034
114035 /* Allocate the parsing context */
114036 pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));
114037 if( pParse==0 ){
114038 rc = SQLITE_NOMEM_BKPT;
114039 goto end_prepare;
114040 }
114041 memset(pParse, 0, PARSE_HDR_SZ);
114042 memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);
114043 pParse->pReprepare = pReprepare;
114044 assert( ppStmt && *ppStmt==0 );
114045 /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
114046 assert( sqlite3_mutex_held(db->mutex) );
114047
@@ -115395,11 +115375,11 @@
115375 ** Allocate a KeyInfo object sufficient for an index of N key columns and
115376 ** X extra columns.
115377 */
115378 SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
115379 int nExtra = (N+X)*(sizeof(CollSeq*)+1);
115380 KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra);
115381 if( p ){
115382 p->aSortOrder = (u8*)&p->aColl[N+X];
115383 p->nField = (u16)N;
115384 p->nXField = (u16)X;
115385 p->enc = ENC(db);
115386
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124124
#define SQLITE_VERSION "3.15.0"
125125
#define SQLITE_VERSION_NUMBER 3015000
126
-#define SQLITE_SOURCE_ID "2016-09-28 16:05:53 40c0fb0af678797c39a99853f9f4102464c16f4b"
126
+#define SQLITE_SOURCE_ID "2016-10-01 23:55:23 fe07609efc31c4639c40fbda501c55f443756ad2"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version, sqlite3_sourceid
131131
**
132132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.15.0"
125 #define SQLITE_VERSION_NUMBER 3015000
126 #define SQLITE_SOURCE_ID "2016-09-28 16:05:53 40c0fb0af678797c39a99853f9f4102464c16f4b"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
131 **
132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.15.0"
125 #define SQLITE_VERSION_NUMBER 3015000
126 #define SQLITE_SOURCE_ID "2016-10-01 23:55:23 fe07609efc31c4639c40fbda501c55f443756ad2"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
131 **
132
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
8383
8484
# define the SQLite files, which need special flags on compile
8585
SQLITESRC=sqlite3.c
8686
ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
8787
SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88
-SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
88
+SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
8989
9090
# define the SQLite shell files, which need special flags on compile
9191
SQLITESHELLSRC=shell.c
9292
ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
9393
SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
9494
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
83
84 # define the SQLite files, which need special flags on compile
85 SQLITESRC=sqlite3.c
86 ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
87 SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88 SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94
--- win/Makefile.PellesCGMake
+++ win/Makefile.PellesCGMake
@@ -83,11 +83,11 @@
83
84 # define the SQLite files, which need special flags on compile
85 SQLITESRC=sqlite3.c
86 ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf))
87 SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj))
88 SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_WIN32_NO_ANSI
89
90 # define the SQLite shell files, which need special flags on compile
91 SQLITESHELLSRC=shell.c
92 ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf))
93 SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj))
94
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
2424
CFLAGS = -o
2525
BCC = $(DMDIR)\bin\dmc $(CFLAGS)
2626
TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
2727
LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
2828
29
-SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
29
+SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
3030
3131
SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
3232
3333
SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
3434
3535
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
24 CFLAGS = -o
25 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35
--- win/Makefile.dmc
+++ win/Makefile.dmc
@@ -24,11 +24,11 @@
24 CFLAGS = -o
25 BCC = $(DMDIR)\bin\dmc $(CFLAGS)
26 TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL)
27 LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32
28
29 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
30
31 SHELL_OPTIONS = -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=fossil_open -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen
32
33 SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c
34
35
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2174,10 +2174,12 @@
21742174
-DSQLITE_OMIT_DECLTYPE \
21752175
-DSQLITE_OMIT_DEPRECATED \
21762176
-DSQLITE_OMIT_PROGRESS_CALLBACK \
21772177
-DSQLITE_OMIT_SHARED_CACHE \
21782178
-DSQLITE_OMIT_LOAD_EXTENSION \
2179
+ -DSQLITE_MAX_EXPR_DEPTH=0 \
2180
+ -DSQLITE_USE_ALLOCA \
21792181
-DSQLITE_ENABLE_LOCKING_STYLE=0 \
21802182
-DSQLITE_DEFAULT_FILE_FORMAT=4 \
21812183
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
21822184
-DSQLITE_ENABLE_FTS4 \
21832185
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
21842186
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2174,10 +2174,12 @@
2174 -DSQLITE_OMIT_DECLTYPE \
2175 -DSQLITE_OMIT_DEPRECATED \
2176 -DSQLITE_OMIT_PROGRESS_CALLBACK \
2177 -DSQLITE_OMIT_SHARED_CACHE \
2178 -DSQLITE_OMIT_LOAD_EXTENSION \
 
 
2179 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2180 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2181 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2182 -DSQLITE_ENABLE_FTS4 \
2183 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
2184
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -2174,10 +2174,12 @@
2174 -DSQLITE_OMIT_DECLTYPE \
2175 -DSQLITE_OMIT_DEPRECATED \
2176 -DSQLITE_OMIT_PROGRESS_CALLBACK \
2177 -DSQLITE_OMIT_SHARED_CACHE \
2178 -DSQLITE_OMIT_LOAD_EXTENSION \
2179 -DSQLITE_MAX_EXPR_DEPTH=0 \
2180 -DSQLITE_USE_ALLOCA \
2181 -DSQLITE_ENABLE_LOCKING_STYLE=0 \
2182 -DSQLITE_DEFAULT_FILE_FORMAT=4 \
2183 -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
2184 -DSQLITE_ENABLE_FTS4 \
2185 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
2186
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -321,10 +321,12 @@
321321
/DSQLITE_OMIT_DECLTYPE \
322322
/DSQLITE_OMIT_DEPRECATED \
323323
/DSQLITE_OMIT_PROGRESS_CALLBACK \
324324
/DSQLITE_OMIT_SHARED_CACHE \
325325
/DSQLITE_OMIT_LOAD_EXTENSION \
326
+ /DSQLITE_MAX_EXPR_DEPTH=0 \
327
+ /DSQLITE_USE_ALLOCA \
326328
/DSQLITE_ENABLE_LOCKING_STYLE=0 \
327329
/DSQLITE_DEFAULT_FILE_FORMAT=4 \
328330
/DSQLITE_ENABLE_EXPLAIN_COMMENTS \
329331
/DSQLITE_ENABLE_FTS4 \
330332
/DSQLITE_ENABLE_FTS3_PARENTHESIS \
331333
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -321,10 +321,12 @@
321 /DSQLITE_OMIT_DECLTYPE \
322 /DSQLITE_OMIT_DEPRECATED \
323 /DSQLITE_OMIT_PROGRESS_CALLBACK \
324 /DSQLITE_OMIT_SHARED_CACHE \
325 /DSQLITE_OMIT_LOAD_EXTENSION \
 
 
326 /DSQLITE_ENABLE_LOCKING_STYLE=0 \
327 /DSQLITE_DEFAULT_FILE_FORMAT=4 \
328 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
329 /DSQLITE_ENABLE_FTS4 \
330 /DSQLITE_ENABLE_FTS3_PARENTHESIS \
331
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -321,10 +321,12 @@
321 /DSQLITE_OMIT_DECLTYPE \
322 /DSQLITE_OMIT_DEPRECATED \
323 /DSQLITE_OMIT_PROGRESS_CALLBACK \
324 /DSQLITE_OMIT_SHARED_CACHE \
325 /DSQLITE_OMIT_LOAD_EXTENSION \
326 /DSQLITE_MAX_EXPR_DEPTH=0 \
327 /DSQLITE_USE_ALLOCA \
328 /DSQLITE_ENABLE_LOCKING_STYLE=0 \
329 /DSQLITE_DEFAULT_FILE_FORMAT=4 \
330 /DSQLITE_ENABLE_EXPLAIN_COMMENTS \
331 /DSQLITE_ENABLE_FTS4 \
332 /DSQLITE_ENABLE_FTS3_PARENTHESIS \
333

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button