Fossil SCM

Update the built-in SQLite to the first 3.13.0 beta for testing.

drh 2016-05-09 22:15 trunk
Commit 45daaced43d792ab390a5304002fcf93350f2db5
2 files changed +90 -60 +10 -8
+90 -60
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363363
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364364
** [sqlite_version()] and [sqlite_source_id()].
365365
*/
366366
#define SQLITE_VERSION "3.13.0"
367367
#define SQLITE_VERSION_NUMBER 3013000
368
-#define SQLITE_SOURCE_ID "2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b"
368
+#define SQLITE_SOURCE_ID "2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea"
369369
370370
/*
371371
** CAPI3REF: Run-Time Library Version Numbers
372372
** KEYWORDS: sqlite3_version, sqlite3_sourceid
373373
**
@@ -8577,11 +8577,11 @@
85778577
#endif /* ifndef _SQLITE3RTREE_H_ */
85788578
85798579
/******** End of sqlite3rtree.h *********/
85808580
/******** Begin file sqlite3session.h *********/
85818581
8582
-#ifndef __SQLITESESSION_H_
8582
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
85838583
#define __SQLITESESSION_H_ 1
85848584
85858585
/*
85868586
** Make sure we can call this stuff from C++.
85878587
*/
@@ -9851,11 +9851,11 @@
98519851
*/
98529852
#if 0
98539853
}
98549854
#endif
98559855
9856
-#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
9856
+#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
98579857
98589858
/******** End of sqlite3session.h *********/
98599859
/******** Begin file fts5.h *********/
98609860
/*
98619861
** 2014 May 31
@@ -9999,15 +9999,17 @@
99999999
** of the current query. Specifically, a query equivalent to:
1000010000
**
1000110001
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
1000210002
**
1000310003
** with $p set to a phrase equivalent to the phrase iPhrase of the
10004
-** current query is executed. For each row visited, the callback function
10005
-** passed as the fourth argument is invoked. The context and API objects
10006
-** passed to the callback function may be used to access the properties of
10007
-** each matched row. Invoking Api.xUserData() returns a copy of the pointer
10008
-** passed as the third argument to pUserData.
10004
+** current query is executed. Any column filter that applies to
10005
+** phrase iPhrase of the current query is included in $p. For each
10006
+** row visited, the callback function passed as the fourth argument
10007
+** is invoked. The context and API objects passed to the callback
10008
+** function may be used to access the properties of each matched row.
10009
+** Invoking Api.xUserData() returns a copy of the pointer passed as
10010
+** the third argument to pUserData.
1000910011
**
1001010012
** If the callback function returns any value other than SQLITE_OK, the
1001110013
** query is abandoned and the xQueryPhrase function returns immediately.
1001210014
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
1001310015
** Otherwise, the error code is propagated upwards.
@@ -14952,10 +14954,11 @@
1495214954
#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */
1495314955
#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */
1495414956
#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */
1495514957
#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */
1495614958
#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */
14959
+#define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */
1495714960
1495814961
/* Allowed return values from sqlite3WhereIsDistinct()
1495914962
*/
1496014963
#define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */
1496114964
#define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */
@@ -15006,10 +15009,11 @@
1500615009
#define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */
1500715010
#define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
1500815011
#define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
1500915012
#define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
1501015013
#define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
15014
+#define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
1501115015
#define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
1501215016
1501315017
/*
1501415018
** An instance of the following structure contains all information
1501515019
** needed to generate code for a single SELECT statement.
@@ -24443,30 +24447,30 @@
2444324447
2444424448
/*
2444524449
** Conversion types fall into various categories as defined by the
2444624450
** following enumeration.
2444724451
*/
24448
-#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */
24449
-#define etFLOAT 2 /* Floating point. %f */
24450
-#define etEXP 3 /* Exponentional notation. %e and %E */
24451
-#define etGENERIC 4 /* Floating or exponential, depending on exponent. %g */
24452
-#define etSIZE 5 /* Return number of characters processed so far. %n */
24453
-#define etSTRING 6 /* Strings. %s */
24454
-#define etDYNSTRING 7 /* Dynamically allocated strings. %z */
24455
-#define etPERCENT 8 /* Percent symbol. %% */
24456
-#define etCHARX 9 /* Characters. %c */
24452
+#define etRADIX 0 /* Integer types. %d, %x, %o, and so forth */
24453
+#define etFLOAT 1 /* Floating point. %f */
24454
+#define etEXP 2 /* Exponentional notation. %e and %E */
24455
+#define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
24456
+#define etSIZE 4 /* Return number of characters processed so far. %n */
24457
+#define etSTRING 5 /* Strings. %s */
24458
+#define etDYNSTRING 6 /* Dynamically allocated strings. %z */
24459
+#define etPERCENT 7 /* Percent symbol. %% */
24460
+#define etCHARX 8 /* Characters. %c */
2445724461
/* The rest are extensions, not normally found in printf() */
24458
-#define etSQLESCAPE 10 /* Strings with '\'' doubled. %q */
24459
-#define etSQLESCAPE2 11 /* Strings with '\'' doubled and enclosed in '',
24462
+#define etSQLESCAPE 9 /* Strings with '\'' doubled. %q */
24463
+#define etSQLESCAPE2 10 /* Strings with '\'' doubled and enclosed in '',
2446024464
NULL pointers replaced by SQL NULL. %Q */
24461
-#define etTOKEN 12 /* a pointer to a Token structure */
24462
-#define etSRCLIST 13 /* a pointer to a SrcList */
24463
-#define etPOINTER 14 /* The %p conversion */
24464
-#define etSQLESCAPE3 15 /* %w -> Strings with '\"' doubled */
24465
-#define etORDINAL 16 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
24465
+#define etTOKEN 11 /* a pointer to a Token structure */
24466
+#define etSRCLIST 12 /* a pointer to a SrcList */
24467
+#define etPOINTER 13 /* The %p conversion */
24468
+#define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
24469
+#define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
2446624470
24467
-#define etINVALID 0 /* Any unrecognized conversion type */
24471
+#define etINVALID 16 /* Any unrecognized conversion type */
2446824472
2446924473
2447024474
/*
2447124475
** An "etByte" is an 8-bit unsigned value.
2447224476
*/
@@ -24617,11 +24621,11 @@
2461724621
etByte flag_altform2; /* True if "!" flag is present */
2461824622
etByte flag_zeropad; /* True if field width constant starts with zero */
2461924623
etByte flag_long; /* True if "l" flag is present */
2462024624
etByte flag_longlong; /* True if the "ll" flag is present */
2462124625
etByte done; /* Loop termination flag */
24622
- etByte xtype = 0; /* Conversion paradigm */
24626
+ etByte xtype = etINVALID; /* Conversion paradigm */
2462324627
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
2462424628
u8 useIntern; /* Ok to use internal conversions (ex: %T) */
2462524629
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
2462624630
sqlite_uint64 longvalue; /* Value for integer types */
2462724631
LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -51713,14 +51717,20 @@
5171351717
** on the given page is unused. The pager marks the page as clean so
5171451718
** that it does not get written to disk.
5171551719
**
5171651720
** Tests show that this optimization can quadruple the speed of large
5171751721
** DELETE operations.
51722
+**
51723
+** This optimization cannot be used with a temp-file, as the page may
51724
+** have been dirty at the start of the transaction. In that case, if
51725
+** memory pressure forces page pPg out of the cache, the data does need
51726
+** to be written out to disk so that it may be read back in if the
51727
+** current transaction is rolled back.
5171851728
*/
5171951729
SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
5172051730
Pager *pPager = pPg->pPager;
51721
- if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
51731
+ if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
5172251732
PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
5172351733
IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
5172451734
pPg->flags |= PGHDR_DONT_WRITE;
5172551735
pPg->flags &= ~PGHDR_WRITEABLE;
5172651736
pager_set_pagehash(pPg);
@@ -88064,10 +88074,11 @@
8806488074
notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
8806588075
sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
8806688076
assert( pNC->nRef>=nRef );
8806788077
if( nRef!=pNC->nRef ){
8806888078
ExprSetProperty(pExpr, EP_VarSelect);
88079
+ pNC->ncFlags |= NC_VarSelect;
8806988080
}
8807088081
}
8807188082
break;
8807288083
}
8807388084
case TK_VARIABLE: {
@@ -97251,20 +97262,14 @@
9725197262
** contains lookaside memory. (Table objects in the schema do not use
9725297263
** lookaside memory, but some ephemeral Table objects do.) Or the
9725397264
** db parameter can be used with db->pnBytesFreed to measure the memory
9725497265
** used by the Table object.
9725597266
*/
97256
-SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
97267
+static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
9725797268
Index *pIndex, *pNext;
9725897269
TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
9725997270
97260
- assert( !pTable || pTable->nRef>0 );
97261
-
97262
- /* Do not delete the table until the reference count reaches zero. */
97263
- if( !pTable ) return;
97264
- if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
97265
-
9726697271
/* Record the number of outstanding lookaside allocations in schema Tables
9726797272
** prior to doing any free() operations. Since schema Tables do not use
9726897273
** lookaside, this number should not change. */
9726997274
TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
9727097275
db->lookaside.nOut : 0 );
@@ -97300,10 +97305,17 @@
9730097305
sqlite3DbFree(db, pTable);
9730197306
9730297307
/* Verify that no lookaside memory was used by schema tables */
9730397308
assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
9730497309
}
97310
+SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
97311
+ /* Do not delete the table until the reference count reaches zero. */
97312
+ if( !pTable ) return;
97313
+ if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
97314
+ deleteTable(db, pTable);
97315
+}
97316
+
9730597317
9730697318
/*
9730797319
** Unlink the given table from the hash tables and the delete the
9730897320
** table structure with all its indices and foreign keys.
9730997321
*/
@@ -98880,11 +98892,11 @@
9888098892
assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
9888198893
}else{
9888298894
pTable->nCol = 0;
9888398895
nErr++;
9888498896
}
98885
- if( pSelTab ) sqlite3DeleteTable(db, pSelTab);
98897
+ sqlite3DeleteTable(db, pSelTab);
9888698898
sqlite3SelectDelete(db, pSel);
9888798899
db->lookaside.bDisable--;
9888898900
} else {
9888998901
nErr++;
9889098902
}
@@ -101807,11 +101819,11 @@
101807101819
int iEphCur = 0; /* Ephemeral table holding all primary key values */
101808101820
int iRowSet = 0; /* Register for rowset of rows to delete */
101809101821
int addrBypass = 0; /* Address of jump over the delete logic */
101810101822
int addrLoop = 0; /* Top of the delete loop */
101811101823
int addrEphOpen = 0; /* Instruction to open the Ephemeral table */
101812
- int bComplex; /* True if there are triggers or FKs or or
101824
+ int bComplex; /* True if there are triggers or FKs or
101813101825
** subqueries in the WHERE clause */
101814101826
101815101827
#ifndef SQLITE_OMIT_TRIGGER
101816101828
int isView; /* True if attempting to delete from a view */
101817101829
Trigger *pTrigger; /* List of table triggers, if required */
@@ -101941,12 +101953,12 @@
101941101953
sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
101942101954
}
101943101955
}else
101944101956
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
101945101957
{
101946
- u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
101947
- if( pWhere && ExprHasProperty(pWhere, EP_Subquery) ) bComplex = 1;
101958
+ u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK|WHERE_SEEK_TABLE;
101959
+ if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
101948101960
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
101949101961
if( HasRowid(pTab) ){
101950101962
/* For a rowid table, initialize the RowSet to an empty set */
101951101963
pPk = 0;
101952101964
nPk = 1;
@@ -120045,11 +120057,12 @@
120045120057
/* Begin the database scan
120046120058
*/
120047120059
if( HasRowid(pTab) ){
120048120060
sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);
120049120061
pWInfo = sqlite3WhereBegin(
120050
- pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED, iIdxCur
120062
+ pParse, pTabList, pWhere, 0, 0,
120063
+ WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur
120051120064
);
120052120065
if( pWInfo==0 ) goto update_cleanup;
120053120066
okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
120054120067
120055120068
/* Remember the rowid of every item to be updated.
@@ -123982,11 +123995,11 @@
123982123995
disableTerm(pLevel, pRangeStart);
123983123996
disableTerm(pLevel, pRangeEnd);
123984123997
if( omitTable ){
123985123998
/* pIdx is a covering index. No need to access the main table. */
123986123999
}else if( HasRowid(pIdx->pTable) ){
123987
- if( pWInfo->eOnePass!=ONEPASS_OFF ){
124000
+ if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){
123988124001
iRowidReg = ++pParse->nMem;
123989124002
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
123990124003
sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
123991124004
sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
123992124005
VdbeCoverage(v);
@@ -124178,11 +124191,12 @@
124178124191
** sub-WHERE clause is to to invoke the main loop body as a subroutine.
124179124192
*/
124180124193
wctrlFlags = WHERE_OMIT_OPEN_CLOSE
124181124194
| WHERE_FORCE_TABLE
124182124195
| WHERE_ONETABLE_ONLY
124183
- | WHERE_NO_AUTOINDEX;
124196
+ | WHERE_NO_AUTOINDEX
124197
+ | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);
124184124198
for(ii=0; ii<pOrWc->nTerm; ii++){
124185124199
WhereTerm *pOrTerm = &pOrWc->a[ii];
124186124200
if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
124187124201
WhereInfo *pSubWInfo; /* Info for single OR-term scan */
124188124202
Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
@@ -126067,11 +126081,14 @@
126067126081
** Initialize a WHERE clause scanner object. Return a pointer to the
126068126082
** first match. Return NULL if there are no matches.
126069126083
**
126070126084
** The scanner will be searching the WHERE clause pWC. It will look
126071126085
** for terms of the form "X <op> <expr>" where X is column iColumn of table
126072
-** iCur. The <op> must be one of the operators described by opMask.
126086
+** iCur. Or if pIdx!=0 then X is column iColumn of index pIdx. pIdx
126087
+** must be one of the indexes of table iCur.
126088
+**
126089
+** The <op> must be one of the operators described by opMask.
126073126090
**
126074126091
** If the search is for X and the WHERE clause contains terms of the
126075126092
** form X=Y then this routine might also return terms of the form
126076126093
** "Y <op> <expr>". The number of levels of transitivity is limited,
126077126094
** but is enough to handle most commonly occurring SQL statements.
@@ -126115,15 +126132,16 @@
126115126132
return whereScanNext(pScan);
126116126133
}
126117126134
126118126135
/*
126119126136
** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
126120
-** where X is a reference to the iColumn of table iCur and <op> is one of
126121
-** the WO_xx operator codes specified by the op parameter.
126122
-** Return a pointer to the term. Return 0 if not found.
126137
+** where X is a reference to the iColumn of table iCur or of index pIdx
126138
+** if pIdx!=0 and <op> is one of the WO_xx operator codes specified by
126139
+** the op parameter. Return a pointer to the term. Return 0 if not found.
126123126140
**
126124
-** If pIdx!=0 then search for terms matching the iColumn-th column of pIdx
126141
+** If pIdx!=0 then it must be one of the indexes of table iCur.
126142
+** Search for terms matching the iColumn-th column of pIdx
126125126143
** rather than the iColumn-th column of table iCur.
126126126144
**
126127126145
** The term returned might by Y=<expr> if there is another constraint in
126128126146
** the WHERE clause that specifies that X=Y. Any such constraints will be
126129126147
** identified by the WO_EQUIV bit in the pTerm->eOperator field. The
@@ -169457,23 +169475,22 @@
169457169475
*/
169458169476
static int sessionVarintGet(u8 *aBuf, int *piVal){
169459169477
return getVarint32(aBuf, *piVal);
169460169478
}
169461169479
169480
+/* Load an unaligned and unsigned 32-bit integer */
169481
+#define SESSION_UINT32(x) (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
169482
+
169462169483
/*
169463169484
** Read a 64-bit big-endian integer value from buffer aRec[]. Return
169464169485
** the value read.
169465169486
*/
169466169487
static sqlite3_int64 sessionGetI64(u8 *aRec){
169467
- return (((sqlite3_int64)aRec[0]) << 56)
169468
- + (((sqlite3_int64)aRec[1]) << 48)
169469
- + (((sqlite3_int64)aRec[2]) << 40)
169470
- + (((sqlite3_int64)aRec[3]) << 32)
169471
- + (((sqlite3_int64)aRec[4]) << 24)
169472
- + (((sqlite3_int64)aRec[5]) << 16)
169473
- + (((sqlite3_int64)aRec[6]) << 8)
169474
- + (((sqlite3_int64)aRec[7]) << 0);
169488
+ u64 x = SESSION_UINT32(aRec);
169489
+ u32 y = SESSION_UINT32(aRec+4);
169490
+ x = (x<<32) + y;
169491
+ return (sqlite3_int64)x;
169475169492
}
169476169493
169477169494
/*
169478169495
** Write a 64-bit big-endian integer value to the buffer aBuf[].
169479169496
*/
@@ -176173,15 +176190,17 @@
176173176190
** of the current query. Specifically, a query equivalent to:
176174176191
**
176175176192
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
176176176193
**
176177176194
** with $p set to a phrase equivalent to the phrase iPhrase of the
176178
-** current query is executed. For each row visited, the callback function
176179
-** passed as the fourth argument is invoked. The context and API objects
176180
-** passed to the callback function may be used to access the properties of
176181
-** each matched row. Invoking Api.xUserData() returns a copy of the pointer
176182
-** passed as the third argument to pUserData.
176195
+** current query is executed. Any column filter that applies to
176196
+** phrase iPhrase of the current query is included in $p. For each
176197
+** row visited, the callback function passed as the fourth argument
176198
+** is invoked. The context and API objects passed to the callback
176199
+** function may be used to access the properties of each matched row.
176200
+** Invoking Api.xUserData() returns a copy of the pointer passed as
176201
+** the third argument to pUserData.
176183176202
**
176184176203
** If the callback function returns any value other than SQLITE_OK, the
176185176204
** query is abandoned and the xQueryPhrase function returns immediately.
176186176205
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
176187176206
** Otherwise, the error code is propagated upwards.
@@ -182211,10 +182230,21 @@
182211182230
sizeof(Fts5ExprNode));
182212182231
}
182213182232
if( rc==SQLITE_OK ){
182214182233
pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
182215182234
sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
182235
+ }
182236
+ if( rc==SQLITE_OK ){
182237
+ Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
182238
+ if( pColsetOrig ){
182239
+ int nByte = sizeof(Fts5Colset) + pColsetOrig->nCol * sizeof(int);
182240
+ Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
182241
+ if( pColset ){
182242
+ memcpy(pColset, pColsetOrig, nByte);
182243
+ }
182244
+ pNew->pRoot->pNear->pColset = pColset;
182245
+ }
182216182246
}
182217182247
182218182248
for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
182219182249
int tflags = 0;
182220182250
Fts5ExprTerm *p;
@@ -192820,11 +192850,11 @@
192820192850
int nArg, /* Number of args */
192821192851
sqlite3_value **apUnused /* Function arguments */
192822192852
){
192823192853
assert( nArg==0 );
192824192854
UNUSED_PARAM2(nArg, apUnused);
192825
- sqlite3_result_text(pCtx, "fts5: 2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b", -1, SQLITE_TRANSIENT);
192855
+ sqlite3_result_text(pCtx, "fts5: 2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea", -1, SQLITE_TRANSIENT);
192826192856
}
192827192857
192828192858
static int fts5Init(sqlite3 *db){
192829192859
static const sqlite3_module fts5Mod = {
192830192860
/* iVersion */ 2,
192831192861
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364 ** [sqlite_version()] and [sqlite_source_id()].
365 */
366 #define SQLITE_VERSION "3.13.0"
367 #define SQLITE_VERSION_NUMBER 3013000
368 #define SQLITE_SOURCE_ID "2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b"
369
370 /*
371 ** CAPI3REF: Run-Time Library Version Numbers
372 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
373 **
@@ -8577,11 +8577,11 @@
8577 #endif /* ifndef _SQLITE3RTREE_H_ */
8578
8579 /******** End of sqlite3rtree.h *********/
8580 /******** Begin file sqlite3session.h *********/
8581
8582 #ifndef __SQLITESESSION_H_
8583 #define __SQLITESESSION_H_ 1
8584
8585 /*
8586 ** Make sure we can call this stuff from C++.
8587 */
@@ -9851,11 +9851,11 @@
9851 */
9852 #if 0
9853 }
9854 #endif
9855
9856 #endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
9857
9858 /******** End of sqlite3session.h *********/
9859 /******** Begin file fts5.h *********/
9860 /*
9861 ** 2014 May 31
@@ -9999,15 +9999,17 @@
9999 ** of the current query. Specifically, a query equivalent to:
10000 **
10001 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
10002 **
10003 ** with $p set to a phrase equivalent to the phrase iPhrase of the
10004 ** current query is executed. For each row visited, the callback function
10005 ** passed as the fourth argument is invoked. The context and API objects
10006 ** passed to the callback function may be used to access the properties of
10007 ** each matched row. Invoking Api.xUserData() returns a copy of the pointer
10008 ** passed as the third argument to pUserData.
 
 
10009 **
10010 ** If the callback function returns any value other than SQLITE_OK, the
10011 ** query is abandoned and the xQueryPhrase function returns immediately.
10012 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
10013 ** Otherwise, the error code is propagated upwards.
@@ -14952,10 +14954,11 @@
14952 #define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */
14953 #define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */
14954 #define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */
14955 #define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */
14956 #define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */
 
14957
14958 /* Allowed return values from sqlite3WhereIsDistinct()
14959 */
14960 #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */
14961 #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */
@@ -15006,10 +15009,11 @@
15006 #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */
15007 #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
15008 #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
15009 #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
15010 #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
 
15011 #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
15012
15013 /*
15014 ** An instance of the following structure contains all information
15015 ** needed to generate code for a single SELECT statement.
@@ -24443,30 +24447,30 @@
24443
24444 /*
24445 ** Conversion types fall into various categories as defined by the
24446 ** following enumeration.
24447 */
24448 #define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */
24449 #define etFLOAT 2 /* Floating point. %f */
24450 #define etEXP 3 /* Exponentional notation. %e and %E */
24451 #define etGENERIC 4 /* Floating or exponential, depending on exponent. %g */
24452 #define etSIZE 5 /* Return number of characters processed so far. %n */
24453 #define etSTRING 6 /* Strings. %s */
24454 #define etDYNSTRING 7 /* Dynamically allocated strings. %z */
24455 #define etPERCENT 8 /* Percent symbol. %% */
24456 #define etCHARX 9 /* Characters. %c */
24457 /* The rest are extensions, not normally found in printf() */
24458 #define etSQLESCAPE 10 /* Strings with '\'' doubled. %q */
24459 #define etSQLESCAPE2 11 /* Strings with '\'' doubled and enclosed in '',
24460 NULL pointers replaced by SQL NULL. %Q */
24461 #define etTOKEN 12 /* a pointer to a Token structure */
24462 #define etSRCLIST 13 /* a pointer to a SrcList */
24463 #define etPOINTER 14 /* The %p conversion */
24464 #define etSQLESCAPE3 15 /* %w -> Strings with '\"' doubled */
24465 #define etORDINAL 16 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
24466
24467 #define etINVALID 0 /* Any unrecognized conversion type */
24468
24469
24470 /*
24471 ** An "etByte" is an 8-bit unsigned value.
24472 */
@@ -24617,11 +24621,11 @@
24617 etByte flag_altform2; /* True if "!" flag is present */
24618 etByte flag_zeropad; /* True if field width constant starts with zero */
24619 etByte flag_long; /* True if "l" flag is present */
24620 etByte flag_longlong; /* True if the "ll" flag is present */
24621 etByte done; /* Loop termination flag */
24622 etByte xtype = 0; /* Conversion paradigm */
24623 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
24624 u8 useIntern; /* Ok to use internal conversions (ex: %T) */
24625 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
24626 sqlite_uint64 longvalue; /* Value for integer types */
24627 LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -51713,14 +51717,20 @@
51713 ** on the given page is unused. The pager marks the page as clean so
51714 ** that it does not get written to disk.
51715 **
51716 ** Tests show that this optimization can quadruple the speed of large
51717 ** DELETE operations.
 
 
 
 
 
 
51718 */
51719 SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
51720 Pager *pPager = pPg->pPager;
51721 if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
51722 PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
51723 IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
51724 pPg->flags |= PGHDR_DONT_WRITE;
51725 pPg->flags &= ~PGHDR_WRITEABLE;
51726 pager_set_pagehash(pPg);
@@ -88064,10 +88074,11 @@
88064 notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
88065 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
88066 assert( pNC->nRef>=nRef );
88067 if( nRef!=pNC->nRef ){
88068 ExprSetProperty(pExpr, EP_VarSelect);
 
88069 }
88070 }
88071 break;
88072 }
88073 case TK_VARIABLE: {
@@ -97251,20 +97262,14 @@
97251 ** contains lookaside memory. (Table objects in the schema do not use
97252 ** lookaside memory, but some ephemeral Table objects do.) Or the
97253 ** db parameter can be used with db->pnBytesFreed to measure the memory
97254 ** used by the Table object.
97255 */
97256 SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
97257 Index *pIndex, *pNext;
97258 TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
97259
97260 assert( !pTable || pTable->nRef>0 );
97261
97262 /* Do not delete the table until the reference count reaches zero. */
97263 if( !pTable ) return;
97264 if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
97265
97266 /* Record the number of outstanding lookaside allocations in schema Tables
97267 ** prior to doing any free() operations. Since schema Tables do not use
97268 ** lookaside, this number should not change. */
97269 TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
97270 db->lookaside.nOut : 0 );
@@ -97300,10 +97305,17 @@
97300 sqlite3DbFree(db, pTable);
97301
97302 /* Verify that no lookaside memory was used by schema tables */
97303 assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
97304 }
 
 
 
 
 
 
 
97305
97306 /*
97307 ** Unlink the given table from the hash tables and the delete the
97308 ** table structure with all its indices and foreign keys.
97309 */
@@ -98880,11 +98892,11 @@
98880 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
98881 }else{
98882 pTable->nCol = 0;
98883 nErr++;
98884 }
98885 if( pSelTab ) sqlite3DeleteTable(db, pSelTab);
98886 sqlite3SelectDelete(db, pSel);
98887 db->lookaside.bDisable--;
98888 } else {
98889 nErr++;
98890 }
@@ -101807,11 +101819,11 @@
101807 int iEphCur = 0; /* Ephemeral table holding all primary key values */
101808 int iRowSet = 0; /* Register for rowset of rows to delete */
101809 int addrBypass = 0; /* Address of jump over the delete logic */
101810 int addrLoop = 0; /* Top of the delete loop */
101811 int addrEphOpen = 0; /* Instruction to open the Ephemeral table */
101812 int bComplex; /* True if there are triggers or FKs or or
101813 ** subqueries in the WHERE clause */
101814
101815 #ifndef SQLITE_OMIT_TRIGGER
101816 int isView; /* True if attempting to delete from a view */
101817 Trigger *pTrigger; /* List of table triggers, if required */
@@ -101941,12 +101953,12 @@
101941 sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
101942 }
101943 }else
101944 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
101945 {
101946 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
101947 if( pWhere && ExprHasProperty(pWhere, EP_Subquery) ) bComplex = 1;
101948 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
101949 if( HasRowid(pTab) ){
101950 /* For a rowid table, initialize the RowSet to an empty set */
101951 pPk = 0;
101952 nPk = 1;
@@ -120045,11 +120057,12 @@
120045 /* Begin the database scan
120046 */
120047 if( HasRowid(pTab) ){
120048 sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);
120049 pWInfo = sqlite3WhereBegin(
120050 pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED, iIdxCur
 
120051 );
120052 if( pWInfo==0 ) goto update_cleanup;
120053 okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
120054
120055 /* Remember the rowid of every item to be updated.
@@ -123982,11 +123995,11 @@
123982 disableTerm(pLevel, pRangeStart);
123983 disableTerm(pLevel, pRangeEnd);
123984 if( omitTable ){
123985 /* pIdx is a covering index. No need to access the main table. */
123986 }else if( HasRowid(pIdx->pTable) ){
123987 if( pWInfo->eOnePass!=ONEPASS_OFF ){
123988 iRowidReg = ++pParse->nMem;
123989 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
123990 sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
123991 sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
123992 VdbeCoverage(v);
@@ -124178,11 +124191,12 @@
124178 ** sub-WHERE clause is to to invoke the main loop body as a subroutine.
124179 */
124180 wctrlFlags = WHERE_OMIT_OPEN_CLOSE
124181 | WHERE_FORCE_TABLE
124182 | WHERE_ONETABLE_ONLY
124183 | WHERE_NO_AUTOINDEX;
 
124184 for(ii=0; ii<pOrWc->nTerm; ii++){
124185 WhereTerm *pOrTerm = &pOrWc->a[ii];
124186 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
124187 WhereInfo *pSubWInfo; /* Info for single OR-term scan */
124188 Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
@@ -126067,11 +126081,14 @@
126067 ** Initialize a WHERE clause scanner object. Return a pointer to the
126068 ** first match. Return NULL if there are no matches.
126069 **
126070 ** The scanner will be searching the WHERE clause pWC. It will look
126071 ** for terms of the form "X <op> <expr>" where X is column iColumn of table
126072 ** iCur. The <op> must be one of the operators described by opMask.
 
 
 
126073 **
126074 ** If the search is for X and the WHERE clause contains terms of the
126075 ** form X=Y then this routine might also return terms of the form
126076 ** "Y <op> <expr>". The number of levels of transitivity is limited,
126077 ** but is enough to handle most commonly occurring SQL statements.
@@ -126115,15 +126132,16 @@
126115 return whereScanNext(pScan);
126116 }
126117
126118 /*
126119 ** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
126120 ** where X is a reference to the iColumn of table iCur and <op> is one of
126121 ** the WO_xx operator codes specified by the op parameter.
126122 ** Return a pointer to the term. Return 0 if not found.
126123 **
126124 ** If pIdx!=0 then search for terms matching the iColumn-th column of pIdx
 
126125 ** rather than the iColumn-th column of table iCur.
126126 **
126127 ** The term returned might by Y=<expr> if there is another constraint in
126128 ** the WHERE clause that specifies that X=Y. Any such constraints will be
126129 ** identified by the WO_EQUIV bit in the pTerm->eOperator field. The
@@ -169457,23 +169475,22 @@
169457 */
169458 static int sessionVarintGet(u8 *aBuf, int *piVal){
169459 return getVarint32(aBuf, *piVal);
169460 }
169461
 
 
 
169462 /*
169463 ** Read a 64-bit big-endian integer value from buffer aRec[]. Return
169464 ** the value read.
169465 */
169466 static sqlite3_int64 sessionGetI64(u8 *aRec){
169467 return (((sqlite3_int64)aRec[0]) << 56)
169468 + (((sqlite3_int64)aRec[1]) << 48)
169469 + (((sqlite3_int64)aRec[2]) << 40)
169470 + (((sqlite3_int64)aRec[3]) << 32)
169471 + (((sqlite3_int64)aRec[4]) << 24)
169472 + (((sqlite3_int64)aRec[5]) << 16)
169473 + (((sqlite3_int64)aRec[6]) << 8)
169474 + (((sqlite3_int64)aRec[7]) << 0);
169475 }
169476
169477 /*
169478 ** Write a 64-bit big-endian integer value to the buffer aBuf[].
169479 */
@@ -176173,15 +176190,17 @@
176173 ** of the current query. Specifically, a query equivalent to:
176174 **
176175 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
176176 **
176177 ** with $p set to a phrase equivalent to the phrase iPhrase of the
176178 ** current query is executed. For each row visited, the callback function
176179 ** passed as the fourth argument is invoked. The context and API objects
176180 ** passed to the callback function may be used to access the properties of
176181 ** each matched row. Invoking Api.xUserData() returns a copy of the pointer
176182 ** passed as the third argument to pUserData.
 
 
176183 **
176184 ** If the callback function returns any value other than SQLITE_OK, the
176185 ** query is abandoned and the xQueryPhrase function returns immediately.
176186 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
176187 ** Otherwise, the error code is propagated upwards.
@@ -182211,10 +182230,21 @@
182211 sizeof(Fts5ExprNode));
182212 }
182213 if( rc==SQLITE_OK ){
182214 pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
182215 sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
 
 
 
 
 
 
 
 
 
 
 
182216 }
182217
182218 for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
182219 int tflags = 0;
182220 Fts5ExprTerm *p;
@@ -192820,11 +192850,11 @@
192820 int nArg, /* Number of args */
192821 sqlite3_value **apUnused /* Function arguments */
192822 ){
192823 assert( nArg==0 );
192824 UNUSED_PARAM2(nArg, apUnused);
192825 sqlite3_result_text(pCtx, "fts5: 2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b", -1, SQLITE_TRANSIENT);
192826 }
192827
192828 static int fts5Init(sqlite3 *db){
192829 static const sqlite3_module fts5Mod = {
192830 /* iVersion */ 2,
192831
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -363,11 +363,11 @@
363 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
364 ** [sqlite_version()] and [sqlite_source_id()].
365 */
366 #define SQLITE_VERSION "3.13.0"
367 #define SQLITE_VERSION_NUMBER 3013000
368 #define SQLITE_SOURCE_ID "2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea"
369
370 /*
371 ** CAPI3REF: Run-Time Library Version Numbers
372 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
373 **
@@ -8577,11 +8577,11 @@
8577 #endif /* ifndef _SQLITE3RTREE_H_ */
8578
8579 /******** End of sqlite3rtree.h *********/
8580 /******** Begin file sqlite3session.h *********/
8581
8582 #if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
8583 #define __SQLITESESSION_H_ 1
8584
8585 /*
8586 ** Make sure we can call this stuff from C++.
8587 */
@@ -9851,11 +9851,11 @@
9851 */
9852 #if 0
9853 }
9854 #endif
9855
9856 #endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
9857
9858 /******** End of sqlite3session.h *********/
9859 /******** Begin file fts5.h *********/
9860 /*
9861 ** 2014 May 31
@@ -9999,15 +9999,17 @@
9999 ** of the current query. Specifically, a query equivalent to:
10000 **
10001 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
10002 **
10003 ** with $p set to a phrase equivalent to the phrase iPhrase of the
10004 ** current query is executed. Any column filter that applies to
10005 ** phrase iPhrase of the current query is included in $p. For each
10006 ** row visited, the callback function passed as the fourth argument
10007 ** is invoked. The context and API objects passed to the callback
10008 ** function may be used to access the properties of each matched row.
10009 ** Invoking Api.xUserData() returns a copy of the pointer passed as
10010 ** the third argument to pUserData.
10011 **
10012 ** If the callback function returns any value other than SQLITE_OK, the
10013 ** query is abandoned and the xQueryPhrase function returns immediately.
10014 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
10015 ** Otherwise, the error code is propagated upwards.
@@ -14952,10 +14954,11 @@
14954 #define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */
14955 #define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */
14956 #define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */
14957 #define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */
14958 #define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */
14959 #define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */
14960
14961 /* Allowed return values from sqlite3WhereIsDistinct()
14962 */
14963 #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */
14964 #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */
@@ -15006,10 +15009,11 @@
15009 #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */
15010 #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */
15011 #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
15012 #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
15013 #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
15014 #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
15015 #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
15016
15017 /*
15018 ** An instance of the following structure contains all information
15019 ** needed to generate code for a single SELECT statement.
@@ -24443,30 +24447,30 @@
24447
24448 /*
24449 ** Conversion types fall into various categories as defined by the
24450 ** following enumeration.
24451 */
24452 #define etRADIX 0 /* Integer types. %d, %x, %o, and so forth */
24453 #define etFLOAT 1 /* Floating point. %f */
24454 #define etEXP 2 /* Exponentional notation. %e and %E */
24455 #define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
24456 #define etSIZE 4 /* Return number of characters processed so far. %n */
24457 #define etSTRING 5 /* Strings. %s */
24458 #define etDYNSTRING 6 /* Dynamically allocated strings. %z */
24459 #define etPERCENT 7 /* Percent symbol. %% */
24460 #define etCHARX 8 /* Characters. %c */
24461 /* The rest are extensions, not normally found in printf() */
24462 #define etSQLESCAPE 9 /* Strings with '\'' doubled. %q */
24463 #define etSQLESCAPE2 10 /* Strings with '\'' doubled and enclosed in '',
24464 NULL pointers replaced by SQL NULL. %Q */
24465 #define etTOKEN 11 /* a pointer to a Token structure */
24466 #define etSRCLIST 12 /* a pointer to a SrcList */
24467 #define etPOINTER 13 /* The %p conversion */
24468 #define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
24469 #define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
24470
24471 #define etINVALID 16 /* Any unrecognized conversion type */
24472
24473
24474 /*
24475 ** An "etByte" is an 8-bit unsigned value.
24476 */
@@ -24617,11 +24621,11 @@
24621 etByte flag_altform2; /* True if "!" flag is present */
24622 etByte flag_zeropad; /* True if field width constant starts with zero */
24623 etByte flag_long; /* True if "l" flag is present */
24624 etByte flag_longlong; /* True if the "ll" flag is present */
24625 etByte done; /* Loop termination flag */
24626 etByte xtype = etINVALID; /* Conversion paradigm */
24627 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
24628 u8 useIntern; /* Ok to use internal conversions (ex: %T) */
24629 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
24630 sqlite_uint64 longvalue; /* Value for integer types */
24631 LONGDOUBLE_TYPE realvalue; /* Value for real types */
@@ -51713,14 +51717,20 @@
51717 ** on the given page is unused. The pager marks the page as clean so
51718 ** that it does not get written to disk.
51719 **
51720 ** Tests show that this optimization can quadruple the speed of large
51721 ** DELETE operations.
51722 **
51723 ** This optimization cannot be used with a temp-file, as the page may
51724 ** have been dirty at the start of the transaction. In that case, if
51725 ** memory pressure forces page pPg out of the cache, the data does need
51726 ** to be written out to disk so that it may be read back in if the
51727 ** current transaction is rolled back.
51728 */
51729 SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
51730 Pager *pPager = pPg->pPager;
51731 if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
51732 PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
51733 IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
51734 pPg->flags |= PGHDR_DONT_WRITE;
51735 pPg->flags &= ~PGHDR_WRITEABLE;
51736 pager_set_pagehash(pPg);
@@ -88064,10 +88074,11 @@
88074 notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
88075 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
88076 assert( pNC->nRef>=nRef );
88077 if( nRef!=pNC->nRef ){
88078 ExprSetProperty(pExpr, EP_VarSelect);
88079 pNC->ncFlags |= NC_VarSelect;
88080 }
88081 }
88082 break;
88083 }
88084 case TK_VARIABLE: {
@@ -97251,20 +97262,14 @@
97262 ** contains lookaside memory. (Table objects in the schema do not use
97263 ** lookaside memory, but some ephemeral Table objects do.) Or the
97264 ** db parameter can be used with db->pnBytesFreed to measure the memory
97265 ** used by the Table object.
97266 */
97267 static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
97268 Index *pIndex, *pNext;
97269 TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
97270
 
 
 
 
 
 
97271 /* Record the number of outstanding lookaside allocations in schema Tables
97272 ** prior to doing any free() operations. Since schema Tables do not use
97273 ** lookaside, this number should not change. */
97274 TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
97275 db->lookaside.nOut : 0 );
@@ -97300,10 +97305,17 @@
97305 sqlite3DbFree(db, pTable);
97306
97307 /* Verify that no lookaside memory was used by schema tables */
97308 assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
97309 }
97310 SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
97311 /* Do not delete the table until the reference count reaches zero. */
97312 if( !pTable ) return;
97313 if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
97314 deleteTable(db, pTable);
97315 }
97316
97317
97318 /*
97319 ** Unlink the given table from the hash tables and the delete the
97320 ** table structure with all its indices and foreign keys.
97321 */
@@ -98880,11 +98892,11 @@
98892 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
98893 }else{
98894 pTable->nCol = 0;
98895 nErr++;
98896 }
98897 sqlite3DeleteTable(db, pSelTab);
98898 sqlite3SelectDelete(db, pSel);
98899 db->lookaside.bDisable--;
98900 } else {
98901 nErr++;
98902 }
@@ -101807,11 +101819,11 @@
101819 int iEphCur = 0; /* Ephemeral table holding all primary key values */
101820 int iRowSet = 0; /* Register for rowset of rows to delete */
101821 int addrBypass = 0; /* Address of jump over the delete logic */
101822 int addrLoop = 0; /* Top of the delete loop */
101823 int addrEphOpen = 0; /* Instruction to open the Ephemeral table */
101824 int bComplex; /* True if there are triggers or FKs or
101825 ** subqueries in the WHERE clause */
101826
101827 #ifndef SQLITE_OMIT_TRIGGER
101828 int isView; /* True if attempting to delete from a view */
101829 Trigger *pTrigger; /* List of table triggers, if required */
@@ -101941,12 +101953,12 @@
101953 sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
101954 }
101955 }else
101956 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
101957 {
101958 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK|WHERE_SEEK_TABLE;
101959 if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
101960 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
101961 if( HasRowid(pTab) ){
101962 /* For a rowid table, initialize the RowSet to an empty set */
101963 pPk = 0;
101964 nPk = 1;
@@ -120045,11 +120057,12 @@
120057 /* Begin the database scan
120058 */
120059 if( HasRowid(pTab) ){
120060 sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);
120061 pWInfo = sqlite3WhereBegin(
120062 pParse, pTabList, pWhere, 0, 0,
120063 WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur
120064 );
120065 if( pWInfo==0 ) goto update_cleanup;
120066 okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
120067
120068 /* Remember the rowid of every item to be updated.
@@ -123982,11 +123995,11 @@
123995 disableTerm(pLevel, pRangeStart);
123996 disableTerm(pLevel, pRangeEnd);
123997 if( omitTable ){
123998 /* pIdx is a covering index. No need to access the main table. */
123999 }else if( HasRowid(pIdx->pTable) ){
124000 if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){
124001 iRowidReg = ++pParse->nMem;
124002 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
124003 sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
124004 sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
124005 VdbeCoverage(v);
@@ -124178,11 +124191,12 @@
124191 ** sub-WHERE clause is to to invoke the main loop body as a subroutine.
124192 */
124193 wctrlFlags = WHERE_OMIT_OPEN_CLOSE
124194 | WHERE_FORCE_TABLE
124195 | WHERE_ONETABLE_ONLY
124196 | WHERE_NO_AUTOINDEX
124197 | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);
124198 for(ii=0; ii<pOrWc->nTerm; ii++){
124199 WhereTerm *pOrTerm = &pOrWc->a[ii];
124200 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
124201 WhereInfo *pSubWInfo; /* Info for single OR-term scan */
124202 Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */
@@ -126067,11 +126081,14 @@
126081 ** Initialize a WHERE clause scanner object. Return a pointer to the
126082 ** first match. Return NULL if there are no matches.
126083 **
126084 ** The scanner will be searching the WHERE clause pWC. It will look
126085 ** for terms of the form "X <op> <expr>" where X is column iColumn of table
126086 ** iCur. Or if pIdx!=0 then X is column iColumn of index pIdx. pIdx
126087 ** must be one of the indexes of table iCur.
126088 **
126089 ** The <op> must be one of the operators described by opMask.
126090 **
126091 ** If the search is for X and the WHERE clause contains terms of the
126092 ** form X=Y then this routine might also return terms of the form
126093 ** "Y <op> <expr>". The number of levels of transitivity is limited,
126094 ** but is enough to handle most commonly occurring SQL statements.
@@ -126115,15 +126132,16 @@
126132 return whereScanNext(pScan);
126133 }
126134
126135 /*
126136 ** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
126137 ** where X is a reference to the iColumn of table iCur or of index pIdx
126138 ** if pIdx!=0 and <op> is one of the WO_xx operator codes specified by
126139 ** the op parameter. Return a pointer to the term. Return 0 if not found.
126140 **
126141 ** If pIdx!=0 then it must be one of the indexes of table iCur.
126142 ** Search for terms matching the iColumn-th column of pIdx
126143 ** rather than the iColumn-th column of table iCur.
126144 **
126145 ** The term returned might by Y=<expr> if there is another constraint in
126146 ** the WHERE clause that specifies that X=Y. Any such constraints will be
126147 ** identified by the WO_EQUIV bit in the pTerm->eOperator field. The
@@ -169457,23 +169475,22 @@
169475 */
169476 static int sessionVarintGet(u8 *aBuf, int *piVal){
169477 return getVarint32(aBuf, *piVal);
169478 }
169479
169480 /* Load an unaligned and unsigned 32-bit integer */
169481 #define SESSION_UINT32(x) (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
169482
169483 /*
169484 ** Read a 64-bit big-endian integer value from buffer aRec[]. Return
169485 ** the value read.
169486 */
169487 static sqlite3_int64 sessionGetI64(u8 *aRec){
169488 u64 x = SESSION_UINT32(aRec);
169489 u32 y = SESSION_UINT32(aRec+4);
169490 x = (x<<32) + y;
169491 return (sqlite3_int64)x;
 
 
 
 
169492 }
169493
169494 /*
169495 ** Write a 64-bit big-endian integer value to the buffer aBuf[].
169496 */
@@ -176173,15 +176190,17 @@
176190 ** of the current query. Specifically, a query equivalent to:
176191 **
176192 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
176193 **
176194 ** with $p set to a phrase equivalent to the phrase iPhrase of the
176195 ** current query is executed. Any column filter that applies to
176196 ** phrase iPhrase of the current query is included in $p. For each
176197 ** row visited, the callback function passed as the fourth argument
176198 ** is invoked. The context and API objects passed to the callback
176199 ** function may be used to access the properties of each matched row.
176200 ** Invoking Api.xUserData() returns a copy of the pointer passed as
176201 ** the third argument to pUserData.
176202 **
176203 ** If the callback function returns any value other than SQLITE_OK, the
176204 ** query is abandoned and the xQueryPhrase function returns immediately.
176205 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
176206 ** Otherwise, the error code is propagated upwards.
@@ -182211,10 +182230,21 @@
182230 sizeof(Fts5ExprNode));
182231 }
182232 if( rc==SQLITE_OK ){
182233 pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
182234 sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
182235 }
182236 if( rc==SQLITE_OK ){
182237 Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
182238 if( pColsetOrig ){
182239 int nByte = sizeof(Fts5Colset) + pColsetOrig->nCol * sizeof(int);
182240 Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
182241 if( pColset ){
182242 memcpy(pColset, pColsetOrig, nByte);
182243 }
182244 pNew->pRoot->pNear->pColset = pColset;
182245 }
182246 }
182247
182248 for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
182249 int tflags = 0;
182250 Fts5ExprTerm *p;
@@ -192820,11 +192850,11 @@
192850 int nArg, /* Number of args */
192851 sqlite3_value **apUnused /* Function arguments */
192852 ){
192853 assert( nArg==0 );
192854 UNUSED_PARAM2(nArg, apUnused);
192855 sqlite3_result_text(pCtx, "fts5: 2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea", -1, SQLITE_TRANSIENT);
192856 }
192857
192858 static int fts5Init(sqlite3 *db){
192859 static const sqlite3_module fts5Mod = {
192860 /* iVersion */ 2,
192861
+10 -8
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111111
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112112
** [sqlite_version()] and [sqlite_source_id()].
113113
*/
114114
#define SQLITE_VERSION "3.13.0"
115115
#define SQLITE_VERSION_NUMBER 3013000
116
-#define SQLITE_SOURCE_ID "2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b"
116
+#define SQLITE_SOURCE_ID "2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea"
117117
118118
/*
119119
** CAPI3REF: Run-Time Library Version Numbers
120120
** KEYWORDS: sqlite3_version, sqlite3_sourceid
121121
**
@@ -8325,11 +8325,11 @@
83258325
#endif /* ifndef _SQLITE3RTREE_H_ */
83268326
83278327
/******** End of sqlite3rtree.h *********/
83288328
/******** Begin file sqlite3session.h *********/
83298329
8330
-#ifndef __SQLITESESSION_H_
8330
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
83318331
#define __SQLITESESSION_H_ 1
83328332
83338333
/*
83348334
** Make sure we can call this stuff from C++.
83358335
*/
@@ -9599,11 +9599,11 @@
95999599
*/
96009600
#ifdef __cplusplus
96019601
}
96029602
#endif
96039603
9604
-#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
9604
+#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
96059605
96069606
/******** End of sqlite3session.h *********/
96079607
/******** Begin file fts5.h *********/
96089608
/*
96099609
** 2014 May 31
@@ -9747,15 +9747,17 @@
97479747
** of the current query. Specifically, a query equivalent to:
97489748
**
97499749
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
97509750
**
97519751
** with $p set to a phrase equivalent to the phrase iPhrase of the
9752
-** current query is executed. For each row visited, the callback function
9753
-** passed as the fourth argument is invoked. The context and API objects
9754
-** passed to the callback function may be used to access the properties of
9755
-** each matched row. Invoking Api.xUserData() returns a copy of the pointer
9756
-** passed as the third argument to pUserData.
9752
+** current query is executed. Any column filter that applies to
9753
+** phrase iPhrase of the current query is included in $p. For each
9754
+** row visited, the callback function passed as the fourth argument
9755
+** is invoked. The context and API objects passed to the callback
9756
+** function may be used to access the properties of each matched row.
9757
+** Invoking Api.xUserData() returns a copy of the pointer passed as
9758
+** the third argument to pUserData.
97579759
**
97589760
** If the callback function returns any value other than SQLITE_OK, the
97599761
** query is abandoned and the xQueryPhrase function returns immediately.
97609762
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
97619763
** Otherwise, the error code is propagated upwards.
97629764
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.13.0"
115 #define SQLITE_VERSION_NUMBER 3013000
116 #define SQLITE_SOURCE_ID "2016-05-02 13:57:19 e4af967533f290862dfba1d9ef44d4c9ddd8a01b"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
@@ -8325,11 +8325,11 @@
8325 #endif /* ifndef _SQLITE3RTREE_H_ */
8326
8327 /******** End of sqlite3rtree.h *********/
8328 /******** Begin file sqlite3session.h *********/
8329
8330 #ifndef __SQLITESESSION_H_
8331 #define __SQLITESESSION_H_ 1
8332
8333 /*
8334 ** Make sure we can call this stuff from C++.
8335 */
@@ -9599,11 +9599,11 @@
9599 */
9600 #ifdef __cplusplus
9601 }
9602 #endif
9603
9604 #endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
9605
9606 /******** End of sqlite3session.h *********/
9607 /******** Begin file fts5.h *********/
9608 /*
9609 ** 2014 May 31
@@ -9747,15 +9747,17 @@
9747 ** of the current query. Specifically, a query equivalent to:
9748 **
9749 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
9750 **
9751 ** with $p set to a phrase equivalent to the phrase iPhrase of the
9752 ** current query is executed. For each row visited, the callback function
9753 ** passed as the fourth argument is invoked. The context and API objects
9754 ** passed to the callback function may be used to access the properties of
9755 ** each matched row. Invoking Api.xUserData() returns a copy of the pointer
9756 ** passed as the third argument to pUserData.
 
 
9757 **
9758 ** If the callback function returns any value other than SQLITE_OK, the
9759 ** query is abandoned and the xQueryPhrase function returns immediately.
9760 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
9761 ** Otherwise, the error code is propagated upwards.
9762
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -111,11 +111,11 @@
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.13.0"
115 #define SQLITE_VERSION_NUMBER 3013000
116 #define SQLITE_SOURCE_ID "2016-05-09 19:03:42 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
@@ -8325,11 +8325,11 @@
8325 #endif /* ifndef _SQLITE3RTREE_H_ */
8326
8327 /******** End of sqlite3rtree.h *********/
8328 /******** Begin file sqlite3session.h *********/
8329
8330 #if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
8331 #define __SQLITESESSION_H_ 1
8332
8333 /*
8334 ** Make sure we can call this stuff from C++.
8335 */
@@ -9599,11 +9599,11 @@
9599 */
9600 #ifdef __cplusplus
9601 }
9602 #endif
9603
9604 #endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
9605
9606 /******** End of sqlite3session.h *********/
9607 /******** Begin file fts5.h *********/
9608 /*
9609 ** 2014 May 31
@@ -9747,15 +9747,17 @@
9747 ** of the current query. Specifically, a query equivalent to:
9748 **
9749 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
9750 **
9751 ** with $p set to a phrase equivalent to the phrase iPhrase of the
9752 ** current query is executed. Any column filter that applies to
9753 ** phrase iPhrase of the current query is included in $p. For each
9754 ** row visited, the callback function passed as the fourth argument
9755 ** is invoked. The context and API objects passed to the callback
9756 ** function may be used to access the properties of each matched row.
9757 ** Invoking Api.xUserData() returns a copy of the pointer passed as
9758 ** the third argument to pUserData.
9759 **
9760 ** If the callback function returns any value other than SQLITE_OK, the
9761 ** query is abandoned and the xQueryPhrase function returns immediately.
9762 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
9763 ** Otherwise, the error code is propagated upwards.
9764

Keyboard Shortcuts

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