Fossil SCM
Update the built-in SQLite to the first 3.13.0 beta for testing.
Commit
45daaced43d792ab390a5304002fcf93350f2db5
Parent
2fd471dc92cc5de…
2 files changed
+90
-60
+10
-8
+90
-60
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -363,11 +363,11 @@ | ||
| 363 | 363 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 364 | 364 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 365 | 365 | */ |
| 366 | 366 | #define SQLITE_VERSION "3.13.0" |
| 367 | 367 | #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" | |
| 369 | 369 | |
| 370 | 370 | /* |
| 371 | 371 | ** CAPI3REF: Run-Time Library Version Numbers |
| 372 | 372 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 373 | 373 | ** |
| @@ -8577,11 +8577,11 @@ | ||
| 8577 | 8577 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 8578 | 8578 | |
| 8579 | 8579 | /******** End of sqlite3rtree.h *********/ |
| 8580 | 8580 | /******** Begin file sqlite3session.h *********/ |
| 8581 | 8581 | |
| 8582 | -#ifndef __SQLITESESSION_H_ | |
| 8582 | +#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) | |
| 8583 | 8583 | #define __SQLITESESSION_H_ 1 |
| 8584 | 8584 | |
| 8585 | 8585 | /* |
| 8586 | 8586 | ** Make sure we can call this stuff from C++. |
| 8587 | 8587 | */ |
| @@ -9851,11 +9851,11 @@ | ||
| 9851 | 9851 | */ |
| 9852 | 9852 | #if 0 |
| 9853 | 9853 | } |
| 9854 | 9854 | #endif |
| 9855 | 9855 | |
| 9856 | -#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */ | |
| 9856 | +#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */ | |
| 9857 | 9857 | |
| 9858 | 9858 | /******** End of sqlite3session.h *********/ |
| 9859 | 9859 | /******** Begin file fts5.h *********/ |
| 9860 | 9860 | /* |
| 9861 | 9861 | ** 2014 May 31 |
| @@ -9999,15 +9999,17 @@ | ||
| 9999 | 9999 | ** of the current query. Specifically, a query equivalent to: |
| 10000 | 10000 | ** |
| 10001 | 10001 | ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid |
| 10002 | 10002 | ** |
| 10003 | 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. | |
| 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. | |
| 10009 | 10011 | ** |
| 10010 | 10012 | ** If the callback function returns any value other than SQLITE_OK, the |
| 10011 | 10013 | ** query is abandoned and the xQueryPhrase function returns immediately. |
| 10012 | 10014 | ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. |
| 10013 | 10015 | ** Otherwise, the error code is propagated upwards. |
| @@ -14952,10 +14954,11 @@ | ||
| 14952 | 14954 | #define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ |
| 14953 | 14955 | #define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */ |
| 14954 | 14956 | #define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */ |
| 14955 | 14957 | #define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */ |
| 14956 | 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 */ | |
| 14957 | 14960 | |
| 14958 | 14961 | /* Allowed return values from sqlite3WhereIsDistinct() |
| 14959 | 14962 | */ |
| 14960 | 14963 | #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */ |
| 14961 | 14964 | #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */ |
| @@ -15006,10 +15009,11 @@ | ||
| 15006 | 15009 | #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */ |
| 15007 | 15010 | #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */ |
| 15008 | 15011 | #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */ |
| 15009 | 15012 | #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */ |
| 15010 | 15013 | #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */ |
| 15014 | +#define NC_VarSelect 0x0040 /* A correlated subquery has been seen */ | |
| 15011 | 15015 | #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ |
| 15012 | 15016 | |
| 15013 | 15017 | /* |
| 15014 | 15018 | ** An instance of the following structure contains all information |
| 15015 | 15019 | ** needed to generate code for a single SELECT statement. |
| @@ -24443,30 +24447,30 @@ | ||
| 24443 | 24447 | |
| 24444 | 24448 | /* |
| 24445 | 24449 | ** Conversion types fall into various categories as defined by the |
| 24446 | 24450 | ** following enumeration. |
| 24447 | 24451 | */ |
| 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 */ | |
| 24457 | 24461 | /* 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 '', | |
| 24460 | 24464 | 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 */ | |
| 24466 | 24470 | |
| 24467 | -#define etINVALID 0 /* Any unrecognized conversion type */ | |
| 24471 | +#define etINVALID 16 /* Any unrecognized conversion type */ | |
| 24468 | 24472 | |
| 24469 | 24473 | |
| 24470 | 24474 | /* |
| 24471 | 24475 | ** An "etByte" is an 8-bit unsigned value. |
| 24472 | 24476 | */ |
| @@ -24617,11 +24621,11 @@ | ||
| 24617 | 24621 | etByte flag_altform2; /* True if "!" flag is present */ |
| 24618 | 24622 | etByte flag_zeropad; /* True if field width constant starts with zero */ |
| 24619 | 24623 | etByte flag_long; /* True if "l" flag is present */ |
| 24620 | 24624 | etByte flag_longlong; /* True if the "ll" flag is present */ |
| 24621 | 24625 | etByte done; /* Loop termination flag */ |
| 24622 | - etByte xtype = 0; /* Conversion paradigm */ | |
| 24626 | + etByte xtype = etINVALID; /* Conversion paradigm */ | |
| 24623 | 24627 | u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */ |
| 24624 | 24628 | u8 useIntern; /* Ok to use internal conversions (ex: %T) */ |
| 24625 | 24629 | char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ |
| 24626 | 24630 | sqlite_uint64 longvalue; /* Value for integer types */ |
| 24627 | 24631 | LONGDOUBLE_TYPE realvalue; /* Value for real types */ |
| @@ -51713,14 +51717,20 @@ | ||
| 51713 | 51717 | ** on the given page is unused. The pager marks the page as clean so |
| 51714 | 51718 | ** that it does not get written to disk. |
| 51715 | 51719 | ** |
| 51716 | 51720 | ** Tests show that this optimization can quadruple the speed of large |
| 51717 | 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. | |
| 51718 | 51728 | */ |
| 51719 | 51729 | SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){ |
| 51720 | 51730 | Pager *pPager = pPg->pPager; |
| 51721 | - if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){ | |
| 51731 | + if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){ | |
| 51722 | 51732 | PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager))); |
| 51723 | 51733 | IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno)) |
| 51724 | 51734 | pPg->flags |= PGHDR_DONT_WRITE; |
| 51725 | 51735 | pPg->flags &= ~PGHDR_WRITEABLE; |
| 51726 | 51736 | pager_set_pagehash(pPg); |
| @@ -88064,10 +88074,11 @@ | ||
| 88064 | 88074 | notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr); |
| 88065 | 88075 | sqlite3WalkSelect(pWalker, pExpr->x.pSelect); |
| 88066 | 88076 | assert( pNC->nRef>=nRef ); |
| 88067 | 88077 | if( nRef!=pNC->nRef ){ |
| 88068 | 88078 | ExprSetProperty(pExpr, EP_VarSelect); |
| 88079 | + pNC->ncFlags |= NC_VarSelect; | |
| 88069 | 88080 | } |
| 88070 | 88081 | } |
| 88071 | 88082 | break; |
| 88072 | 88083 | } |
| 88073 | 88084 | case TK_VARIABLE: { |
| @@ -97251,20 +97262,14 @@ | ||
| 97251 | 97262 | ** contains lookaside memory. (Table objects in the schema do not use |
| 97252 | 97263 | ** lookaside memory, but some ephemeral Table objects do.) Or the |
| 97253 | 97264 | ** db parameter can be used with db->pnBytesFreed to measure the memory |
| 97254 | 97265 | ** used by the Table object. |
| 97255 | 97266 | */ |
| 97256 | -SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ | |
| 97267 | +static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ | |
| 97257 | 97268 | Index *pIndex, *pNext; |
| 97258 | 97269 | TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */ |
| 97259 | 97270 | |
| 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 | 97271 | /* Record the number of outstanding lookaside allocations in schema Tables |
| 97267 | 97272 | ** prior to doing any free() operations. Since schema Tables do not use |
| 97268 | 97273 | ** lookaside, this number should not change. */ |
| 97269 | 97274 | TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ? |
| 97270 | 97275 | db->lookaside.nOut : 0 ); |
| @@ -97300,10 +97305,17 @@ | ||
| 97300 | 97305 | sqlite3DbFree(db, pTable); |
| 97301 | 97306 | |
| 97302 | 97307 | /* Verify that no lookaside memory was used by schema tables */ |
| 97303 | 97308 | assert( nLookaside==0 || nLookaside==db->lookaside.nOut ); |
| 97304 | 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 | + | |
| 97305 | 97317 | |
| 97306 | 97318 | /* |
| 97307 | 97319 | ** Unlink the given table from the hash tables and the delete the |
| 97308 | 97320 | ** table structure with all its indices and foreign keys. |
| 97309 | 97321 | */ |
| @@ -98880,11 +98892,11 @@ | ||
| 98880 | 98892 | assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) ); |
| 98881 | 98893 | }else{ |
| 98882 | 98894 | pTable->nCol = 0; |
| 98883 | 98895 | nErr++; |
| 98884 | 98896 | } |
| 98885 | - if( pSelTab ) sqlite3DeleteTable(db, pSelTab); | |
| 98897 | + sqlite3DeleteTable(db, pSelTab); | |
| 98886 | 98898 | sqlite3SelectDelete(db, pSel); |
| 98887 | 98899 | db->lookaside.bDisable--; |
| 98888 | 98900 | } else { |
| 98889 | 98901 | nErr++; |
| 98890 | 98902 | } |
| @@ -101807,11 +101819,11 @@ | ||
| 101807 | 101819 | int iEphCur = 0; /* Ephemeral table holding all primary key values */ |
| 101808 | 101820 | int iRowSet = 0; /* Register for rowset of rows to delete */ |
| 101809 | 101821 | int addrBypass = 0; /* Address of jump over the delete logic */ |
| 101810 | 101822 | int addrLoop = 0; /* Top of the delete loop */ |
| 101811 | 101823 | 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 | |
| 101813 | 101825 | ** subqueries in the WHERE clause */ |
| 101814 | 101826 | |
| 101815 | 101827 | #ifndef SQLITE_OMIT_TRIGGER |
| 101816 | 101828 | int isView; /* True if attempting to delete from a view */ |
| 101817 | 101829 | Trigger *pTrigger; /* List of table triggers, if required */ |
| @@ -101941,12 +101953,12 @@ | ||
| 101941 | 101953 | sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb); |
| 101942 | 101954 | } |
| 101943 | 101955 | }else |
| 101944 | 101956 | #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */ |
| 101945 | 101957 | { |
| 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; | |
| 101948 | 101960 | wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW); |
| 101949 | 101961 | if( HasRowid(pTab) ){ |
| 101950 | 101962 | /* For a rowid table, initialize the RowSet to an empty set */ |
| 101951 | 101963 | pPk = 0; |
| 101952 | 101964 | nPk = 1; |
| @@ -120045,11 +120057,12 @@ | ||
| 120045 | 120057 | /* Begin the database scan |
| 120046 | 120058 | */ |
| 120047 | 120059 | if( HasRowid(pTab) ){ |
| 120048 | 120060 | sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); |
| 120049 | 120061 | 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 | |
| 120051 | 120064 | ); |
| 120052 | 120065 | if( pWInfo==0 ) goto update_cleanup; |
| 120053 | 120066 | okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); |
| 120054 | 120067 | |
| 120055 | 120068 | /* Remember the rowid of every item to be updated. |
| @@ -123982,11 +123995,11 @@ | ||
| 123982 | 123995 | disableTerm(pLevel, pRangeStart); |
| 123983 | 123996 | disableTerm(pLevel, pRangeEnd); |
| 123984 | 123997 | if( omitTable ){ |
| 123985 | 123998 | /* pIdx is a covering index. No need to access the main table. */ |
| 123986 | 123999 | }else if( HasRowid(pIdx->pTable) ){ |
| 123987 | - if( pWInfo->eOnePass!=ONEPASS_OFF ){ | |
| 124000 | + if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){ | |
| 123988 | 124001 | iRowidReg = ++pParse->nMem; |
| 123989 | 124002 | sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); |
| 123990 | 124003 | sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); |
| 123991 | 124004 | sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); |
| 123992 | 124005 | VdbeCoverage(v); |
| @@ -124178,11 +124191,12 @@ | ||
| 124178 | 124191 | ** sub-WHERE clause is to to invoke the main loop body as a subroutine. |
| 124179 | 124192 | */ |
| 124180 | 124193 | wctrlFlags = WHERE_OMIT_OPEN_CLOSE |
| 124181 | 124194 | | WHERE_FORCE_TABLE |
| 124182 | 124195 | | WHERE_ONETABLE_ONLY |
| 124183 | - | WHERE_NO_AUTOINDEX; | |
| 124196 | + | WHERE_NO_AUTOINDEX | |
| 124197 | + | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); | |
| 124184 | 124198 | for(ii=0; ii<pOrWc->nTerm; ii++){ |
| 124185 | 124199 | WhereTerm *pOrTerm = &pOrWc->a[ii]; |
| 124186 | 124200 | if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ |
| 124187 | 124201 | WhereInfo *pSubWInfo; /* Info for single OR-term scan */ |
| 124188 | 124202 | Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ |
| @@ -126067,11 +126081,14 @@ | ||
| 126067 | 126081 | ** Initialize a WHERE clause scanner object. Return a pointer to the |
| 126068 | 126082 | ** first match. Return NULL if there are no matches. |
| 126069 | 126083 | ** |
| 126070 | 126084 | ** The scanner will be searching the WHERE clause pWC. It will look |
| 126071 | 126085 | ** 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. | |
| 126073 | 126090 | ** |
| 126074 | 126091 | ** If the search is for X and the WHERE clause contains terms of the |
| 126075 | 126092 | ** form X=Y then this routine might also return terms of the form |
| 126076 | 126093 | ** "Y <op> <expr>". The number of levels of transitivity is limited, |
| 126077 | 126094 | ** but is enough to handle most commonly occurring SQL statements. |
| @@ -126115,15 +126132,16 @@ | ||
| 126115 | 126132 | return whereScanNext(pScan); |
| 126116 | 126133 | } |
| 126117 | 126134 | |
| 126118 | 126135 | /* |
| 126119 | 126136 | ** 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. | |
| 126123 | 126140 | ** |
| 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 | |
| 126125 | 126143 | ** rather than the iColumn-th column of table iCur. |
| 126126 | 126144 | ** |
| 126127 | 126145 | ** The term returned might by Y=<expr> if there is another constraint in |
| 126128 | 126146 | ** the WHERE clause that specifies that X=Y. Any such constraints will be |
| 126129 | 126147 | ** identified by the WO_EQUIV bit in the pTerm->eOperator field. The |
| @@ -169457,23 +169475,22 @@ | ||
| 169457 | 169475 | */ |
| 169458 | 169476 | static int sessionVarintGet(u8 *aBuf, int *piVal){ |
| 169459 | 169477 | return getVarint32(aBuf, *piVal); |
| 169460 | 169478 | } |
| 169461 | 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 | + | |
| 169462 | 169483 | /* |
| 169463 | 169484 | ** Read a 64-bit big-endian integer value from buffer aRec[]. Return |
| 169464 | 169485 | ** the value read. |
| 169465 | 169486 | */ |
| 169466 | 169487 | 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; | |
| 169475 | 169492 | } |
| 169476 | 169493 | |
| 169477 | 169494 | /* |
| 169478 | 169495 | ** Write a 64-bit big-endian integer value to the buffer aBuf[]. |
| 169479 | 169496 | */ |
| @@ -176173,15 +176190,17 @@ | ||
| 176173 | 176190 | ** of the current query. Specifically, a query equivalent to: |
| 176174 | 176191 | ** |
| 176175 | 176192 | ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid |
| 176176 | 176193 | ** |
| 176177 | 176194 | ** 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. | |
| 176183 | 176202 | ** |
| 176184 | 176203 | ** If the callback function returns any value other than SQLITE_OK, the |
| 176185 | 176204 | ** query is abandoned and the xQueryPhrase function returns immediately. |
| 176186 | 176205 | ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. |
| 176187 | 176206 | ** Otherwise, the error code is propagated upwards. |
| @@ -182211,10 +182230,21 @@ | ||
| 182211 | 182230 | sizeof(Fts5ExprNode)); |
| 182212 | 182231 | } |
| 182213 | 182232 | if( rc==SQLITE_OK ){ |
| 182214 | 182233 | pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc, |
| 182215 | 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 | + } | |
| 182216 | 182246 | } |
| 182217 | 182247 | |
| 182218 | 182248 | for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){ |
| 182219 | 182249 | int tflags = 0; |
| 182220 | 182250 | Fts5ExprTerm *p; |
| @@ -192820,11 +192850,11 @@ | ||
| 192820 | 192850 | int nArg, /* Number of args */ |
| 192821 | 192851 | sqlite3_value **apUnused /* Function arguments */ |
| 192822 | 192852 | ){ |
| 192823 | 192853 | assert( nArg==0 ); |
| 192824 | 192854 | 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); | |
| 192826 | 192856 | } |
| 192827 | 192857 | |
| 192828 | 192858 | static int fts5Init(sqlite3 *db){ |
| 192829 | 192859 | static const sqlite3_module fts5Mod = { |
| 192830 | 192860 | /* iVersion */ 2, |
| 192831 | 192861 |
| --- 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 @@ | ||
| 111 | 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | 113 | */ |
| 114 | 114 | #define SQLITE_VERSION "3.13.0" |
| 115 | 115 | #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" | |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | 121 | ** |
| @@ -8325,11 +8325,11 @@ | ||
| 8325 | 8325 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 8326 | 8326 | |
| 8327 | 8327 | /******** End of sqlite3rtree.h *********/ |
| 8328 | 8328 | /******** Begin file sqlite3session.h *********/ |
| 8329 | 8329 | |
| 8330 | -#ifndef __SQLITESESSION_H_ | |
| 8330 | +#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) | |
| 8331 | 8331 | #define __SQLITESESSION_H_ 1 |
| 8332 | 8332 | |
| 8333 | 8333 | /* |
| 8334 | 8334 | ** Make sure we can call this stuff from C++. |
| 8335 | 8335 | */ |
| @@ -9599,11 +9599,11 @@ | ||
| 9599 | 9599 | */ |
| 9600 | 9600 | #ifdef __cplusplus |
| 9601 | 9601 | } |
| 9602 | 9602 | #endif |
| 9603 | 9603 | |
| 9604 | -#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */ | |
| 9604 | +#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */ | |
| 9605 | 9605 | |
| 9606 | 9606 | /******** End of sqlite3session.h *********/ |
| 9607 | 9607 | /******** Begin file fts5.h *********/ |
| 9608 | 9608 | /* |
| 9609 | 9609 | ** 2014 May 31 |
| @@ -9747,15 +9747,17 @@ | ||
| 9747 | 9747 | ** of the current query. Specifically, a query equivalent to: |
| 9748 | 9748 | ** |
| 9749 | 9749 | ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid |
| 9750 | 9750 | ** |
| 9751 | 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. | |
| 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. | |
| 9757 | 9759 | ** |
| 9758 | 9760 | ** If the callback function returns any value other than SQLITE_OK, the |
| 9759 | 9761 | ** query is abandoned and the xQueryPhrase function returns immediately. |
| 9760 | 9762 | ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. |
| 9761 | 9763 | ** Otherwise, the error code is propagated upwards. |
| 9762 | 9764 |
| --- 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 |