|
|
|
@@ -11681,7 +11681,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
|
|
|
|
|
** number of pages. A negative number N translations means that a buffer
|
|
|
|
|
** of -1024*N bytes is allocated and used for as many pages as it will hold.
|
|
|
|
|
**
|
|
|
|
|
** The default value of "20" was choosen to minimize the run-time of the
|
|
|
|
|
** The default value of "20" was chosen to minimize the run-time of the
|
|
|
|
|
** speedtest1 test program with options: --shrink-memory --reprepare
|
|
|
|
|
*/
|
|
|
|
|
#ifndef SQLITE_DEFAULT_PCACHE_INITSZ
|
|
|
|
@@ -12337,7 +12337,7 @@ SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p);
|
|
|
|
|
** reduce network bandwidth.
|
|
|
|
|
**
|
|
|
|
|
** Note that BTREE_HINT_FLAGS with BTREE_BULKLOAD is the only hint used by
|
|
|
|
|
** standard SQLite. The other hints are provided for extentions that use
|
|
|
|
|
** standard SQLite. The other hints are provided for extensions that use
|
|
|
|
|
** the SQLite parser and code generator but substitute their own storage
|
|
|
|
|
** engine.
|
|
|
|
|
*/
|
|
|
|
@@ -19788,7 +19788,7 @@ static void strftimeFunc(
|
|
|
|
|
case 'S':
|
|
|
|
|
case 'W':
|
|
|
|
|
n++;
|
|
|
|
|
/* fall thru */
|
|
|
|
|
/* fall through */
|
|
|
|
|
case 'w':
|
|
|
|
|
case '%':
|
|
|
|
|
break;
|
|
|
|
@@ -19844,7 +19844,7 @@ static void strftimeFunc(
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'H': sqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break;
|
|
|
|
|
case 'W': /* Fall thru */
|
|
|
|
|
case 'W': /* Fall through */
|
|
|
|
|
case 'j': {
|
|
|
|
|
int nDay; /* Number of days since 1st day of year */
|
|
|
|
|
DateTime y = x;
|
|
|
|
@@ -23099,7 +23099,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
|
|
|
|
|
** are necessary under two condidtions: (1) Debug builds and (2) using
|
|
|
|
|
** are necessary under two conditions: (1) Debug builds and (2) using
|
|
|
|
|
** home-grown mutexes. Encapsulate these conditions into a single #define.
|
|
|
|
|
*/
|
|
|
|
|
#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)
|
|
|
|
@@ -28826,7 +28826,7 @@ SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Attempt to add, substract, or multiply the 64-bit signed value iB against
|
|
|
|
|
** Attempt to add, subtract, or multiply the 64-bit signed value iB against
|
|
|
|
|
** the other 64-bit signed integer at *pA and store the result in *pA.
|
|
|
|
|
** Return 0 on success. Or if the operation would have resulted in an
|
|
|
|
|
** overflow, leave *pA unchanged and return 1.
|
|
|
|
@@ -29274,7 +29274,7 @@ static HashElem *findElementWithHash(
|
|
|
|
|
const char *pKey, /* The key we are searching for */
|
|
|
|
|
unsigned int *pHash /* Write the hash value here */
|
|
|
|
|
){
|
|
|
|
|
HashElem *elem; /* Used to loop thru the element list */
|
|
|
|
|
HashElem *elem; /* Used to loop through the element list */
|
|
|
|
|
int count; /* Number of elements left to test */
|
|
|
|
|
unsigned int h; /* The computed hash */
|
|
|
|
|
|
|
|
|
@@ -29364,7 +29364,7 @@ SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
|
|
|
|
|
*/
|
|
|
|
|
SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
|
|
|
|
|
unsigned int h; /* the hash of the key modulo hash table size */
|
|
|
|
|
HashElem *elem; /* Used to loop thru the element list */
|
|
|
|
|
HashElem *elem; /* Used to loop through the element list */
|
|
|
|
|
HashElem *new_elem; /* New element added to the pH */
|
|
|
|
|
|
|
|
|
|
assert( pH!=0 );
|
|
|
|
@@ -32970,7 +32970,7 @@ static int unixRead(
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if SQLITE_MAX_MMAP_SIZE>0
|
|
|
|
|
/* Deal with as much of this read request as possible by transfering
|
|
|
|
|
/* Deal with as much of this read request as possible by transferring
|
|
|
|
|
** data from the memory mapping using memcpy(). */
|
|
|
|
|
if( offset<pFile->mmapSize ){
|
|
|
|
|
if( offset+amt <= pFile->mmapSize ){
|
|
|
|
@@ -33105,7 +33105,7 @@ static int unixWrite(
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
|
|
|
|
|
/* Deal with as much of this write request as possible by transfering
|
|
|
|
|
/* Deal with as much of this write request as possible by transferring
|
|
|
|
|
** data from the memory mapping using memcpy(). */
|
|
|
|
|
if( offset<pFile->mmapSize ){
|
|
|
|
|
if( offset+amt <= pFile->mmapSize ){
|
|
|
|
@@ -36782,7 +36782,7 @@ static int proxyTakeConch(unixFile *pFile){
|
|
|
|
|
fprintf(stderr, "fchmod %o FAILED with %d %s\n",
|
|
|
|
|
cmode, code, strerror(code));
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(stderr, "fchmod %o SUCCEDED\n",cmode);
|
|
|
|
|
fprintf(stderr, "fchmod %o SUCCEEDED\n",cmode);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
int code = errno;
|
|
|
|
@@ -40279,7 +40279,7 @@ static int winRead(
|
|
|
|
|
pFile->h, pBuf, amt, offset, pFile->locktype));
|
|
|
|
|
|
|
|
|
|
#if SQLITE_MAX_MMAP_SIZE>0
|
|
|
|
|
/* Deal with as much of this read request as possible by transfering
|
|
|
|
|
/* Deal with as much of this read request as possible by transferring
|
|
|
|
|
** data from the memory mapping using memcpy(). */
|
|
|
|
|
if( offset<pFile->mmapSize ){
|
|
|
|
|
if( offset+amt <= pFile->mmapSize ){
|
|
|
|
@@ -40357,7 +40357,7 @@ static int winWrite(
|
|
|
|
|
pFile->h, pBuf, amt, offset, pFile->locktype));
|
|
|
|
|
|
|
|
|
|
#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0
|
|
|
|
|
/* Deal with as much of this write request as possible by transfering
|
|
|
|
|
/* Deal with as much of this write request as possible by transferring
|
|
|
|
|
** data from the memory mapping using memcpy(). */
|
|
|
|
|
if( offset<pFile->mmapSize ){
|
|
|
|
|
if( offset+amt <= pFile->mmapSize ){
|
|
|
|
@@ -40494,7 +40494,7 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
|
|
|
|
|
#ifdef SQLITE_TEST
|
|
|
|
|
/*
|
|
|
|
|
** Count the number of fullsyncs and normal syncs. This is used to test
|
|
|
|
|
** that syncs and fullsyncs are occuring at the right times.
|
|
|
|
|
** that syncs and fullsyncs are occurring at the right times.
|
|
|
|
|
*/
|
|
|
|
|
SQLITE_API int sqlite3_sync_count = 0;
|
|
|
|
|
SQLITE_API int sqlite3_fullsync_count = 0;
|
|
|
|
@@ -44933,7 +44933,7 @@ SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHd
|
|
|
|
|
** If N is positive, then N pages worth of memory are allocated using a single
|
|
|
|
|
** sqlite3Malloc() call and that memory is used for the first N pages allocated.
|
|
|
|
|
** Or if N is negative, then -1024*N bytes of memory are allocated and used
|
|
|
|
|
** for as many pages as can be accomodated.
|
|
|
|
|
** for as many pages as can be accommodated.
|
|
|
|
|
**
|
|
|
|
|
** Only one of (2) or (3) can be used. Once the memory available to (2) or
|
|
|
|
|
** (3) is exhausted, subsequent allocations fail over to the general-purpose
|
|
|
|
@@ -47077,7 +47077,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */
|
|
|
|
|
** outstanding transactions have been abandoned, the pager is able to
|
|
|
|
|
** transition back to OPEN state, discarding the contents of the
|
|
|
|
|
** page-cache and any other in-memory state at the same time. Everything
|
|
|
|
|
** is reloaded from disk (and, if necessary, hot-journal rollback peformed)
|
|
|
|
|
** is reloaded from disk (and, if necessary, hot-journal rollback performed)
|
|
|
|
|
** when a read-transaction is next opened on the pager (transitioning
|
|
|
|
|
** the pager into READER state). At that point the system has recovered
|
|
|
|
|
** from the error.
|
|
|
|
@@ -48653,7 +48653,7 @@ static void pager_unlock(Pager *pPager){
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** This function is called whenever an IOERR or FULL error that requires
|
|
|
|
|
** the pager to transition into the ERROR state may ahve occurred.
|
|
|
|
|
** the pager to transition into the ERROR state may have occurred.
|
|
|
|
|
** The first argument is a pointer to the pager structure, the second
|
|
|
|
|
** the error-code about to be returned by a pager API function. The
|
|
|
|
|
** value returned is a copy of the second argument to this function.
|
|
|
|
@@ -65396,7 +65396,7 @@ static int rebuildPage(
|
|
|
|
|
** Finally, argument pBegin points to the byte immediately following the
|
|
|
|
|
** end of the space required by this page for the cell-pointer area (for
|
|
|
|
|
** all cells - not just those inserted by the current call). If the content
|
|
|
|
|
** area must be extended to before this point in order to accomodate all
|
|
|
|
|
** area must be extended to before this point in order to accommodate all
|
|
|
|
|
** cells in apCell[], then the cells do not fit and non-zero is returned.
|
|
|
|
|
*/
|
|
|
|
|
static int pageInsertArray(
|
|
|
|
@@ -71712,7 +71712,7 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
|
|
|
|
|
switch( pOp->opcode ){
|
|
|
|
|
case OP_Transaction: {
|
|
|
|
|
if( pOp->p2!=0 ) p->readOnly = 0;
|
|
|
|
|
/* fall thru */
|
|
|
|
|
/* fall through */
|
|
|
|
|
}
|
|
|
|
|
case OP_AutoCommit:
|
|
|
|
|
case OP_Savepoint: {
|
|
|
|
@@ -85673,7 +85673,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){
|
|
|
|
|
** The threshold for the amount of main memory to use before flushing
|
|
|
|
|
** records to a PMA is roughly the same as the limit configured for the
|
|
|
|
|
** page-cache of the main database. Specifically, the threshold is set to
|
|
|
|
|
** the value returned by "PRAGMA main.page_size" multipled by
|
|
|
|
|
** the value returned by "PRAGMA main.page_size" multiplied by
|
|
|
|
|
** that returned by "PRAGMA main.cache_size", in bytes.
|
|
|
|
|
**
|
|
|
|
|
** If the sorter is running in single-threaded mode, then all PMAs generated
|
|
|
|
@@ -87303,7 +87303,7 @@ static int vdbeSorterFlushPMA(VdbeSorter *pSorter){
|
|
|
|
|
** the background thread from a sub-tasks previous turn is still running,
|
|
|
|
|
** skip it. If the first (pSorter->nTask-1) sub-tasks are all still busy,
|
|
|
|
|
** fall back to using the final sub-task. The first (pSorter->nTask-1)
|
|
|
|
|
** sub-tasks are prefered as they use background threads - the final
|
|
|
|
|
** sub-tasks are preferred as they use background threads - the final
|
|
|
|
|
** sub-task uses the main thread. */
|
|
|
|
|
for(i=0; i<nWorker; i++){
|
|
|
|
|
int iTest = (pSorter->iPrev + i + 1) % nWorker;
|
|
|
|
@@ -90402,7 +90402,7 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames(
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Resolve all names in all expressions of a SELECT and in all
|
|
|
|
|
** decendents of the SELECT, including compounds off of p->pPrior,
|
|
|
|
|
** descendants of the SELECT, including compounds off of p->pPrior,
|
|
|
|
|
** subqueries in expressions, and subqueries used as FROM clause
|
|
|
|
|
** terms.
|
|
|
|
|
**
|
|
|
|
@@ -91550,7 +91550,7 @@ static int exprStructSize(Expr *p){
|
|
|
|
|
** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size
|
|
|
|
|
** (unreduced) Expr objects as they or originally constructed by the parser.
|
|
|
|
|
** During expression analysis, extra information is computed and moved into
|
|
|
|
|
** later parts of teh Expr object and that extra information might get chopped
|
|
|
|
|
** later parts of the Expr object and that extra information might get chopped
|
|
|
|
|
** off if the expression is reduced. Note also that it does not work to
|
|
|
|
|
** make an EXPRDUP_REDUCE copy of a reduced expression. It is only legal
|
|
|
|
|
** to reduce a pristine expression tree from the parser. The implementation
|
|
|
|
@@ -93880,7 +93880,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
|
|
|
|
|
pCol->iSorterColumn, target);
|
|
|
|
|
return target;
|
|
|
|
|
}
|
|
|
|
|
/* Otherwise, fall thru into the TK_COLUMN case */
|
|
|
|
|
/* Otherwise, fall through into the TK_COLUMN case */
|
|
|
|
|
}
|
|
|
|
|
case TK_COLUMN: {
|
|
|
|
|
int iTab = pExpr->iTable;
|
|
|
|
@@ -94481,7 +94481,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
|
|
|
|
|
**
|
|
|
|
|
** If regDest>=0 then the result is always stored in that register and the
|
|
|
|
|
** result is not reusable. If regDest<0 then this routine is free to
|
|
|
|
|
** store the value whereever it wants. The register where the expression
|
|
|
|
|
** store the value wherever it wants. The register where the expression
|
|
|
|
|
** is stored is returned. When regDest<0, two identical expressions will
|
|
|
|
|
** code to the same register.
|
|
|
|
|
*/
|
|
|
|
@@ -94759,7 +94759,7 @@ static void exprCodeBetween(
|
|
|
|
|
/*
|
|
|
|
|
** Generate code for a boolean expression such that a jump is made
|
|
|
|
|
** to the label "dest" if the expression is true but execution
|
|
|
|
|
** continues straight thru if the expression is false.
|
|
|
|
|
** continues straight through if the expression is false.
|
|
|
|
|
**
|
|
|
|
|
** If the expression evaluates to NULL (neither true nor false), then
|
|
|
|
|
** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL.
|
|
|
|
@@ -94811,7 +94811,7 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int
|
|
|
|
|
testcase( op==TK_ISNOT );
|
|
|
|
|
op = (op==TK_IS) ? TK_EQ : TK_NE;
|
|
|
|
|
jumpIfNull = SQLITE_NULLEQ;
|
|
|
|
|
/* Fall thru */
|
|
|
|
|
/* Fall through */
|
|
|
|
|
case TK_LT:
|
|
|
|
|
case TK_LE:
|
|
|
|
|
case TK_GT:
|
|
|
|
@@ -94887,7 +94887,7 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int
|
|
|
|
|
/*
|
|
|
|
|
** Generate code for a boolean expression such that a jump is made
|
|
|
|
|
** to the label "dest" if the expression is false but execution
|
|
|
|
|
** continues straight thru if the expression is true.
|
|
|
|
|
** continues straight through if the expression is true.
|
|
|
|
|
**
|
|
|
|
|
** If the expression evaluates to NULL (neither true nor false) then
|
|
|
|
|
** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull
|
|
|
|
@@ -94965,7 +94965,7 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int
|
|
|
|
|
testcase( pExpr->op==TK_ISNOT );
|
|
|
|
|
op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ;
|
|
|
|
|
jumpIfNull = SQLITE_NULLEQ;
|
|
|
|
|
/* Fall thru */
|
|
|
|
|
/* Fall through */
|
|
|
|
|
case TK_LT:
|
|
|
|
|
case TK_LE:
|
|
|
|
|
case TK_GT:
|
|
|
|
@@ -95751,7 +95751,7 @@ static void renameParentFunc(
|
|
|
|
|
** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER
|
|
|
|
|
** statement. The second is a table name. The table name in the CREATE
|
|
|
|
|
** TRIGGER statement is replaced with the third argument and the result
|
|
|
|
|
** returned. This is analagous to renameTableFunc() above, except for CREATE
|
|
|
|
|
** returned. This is analogous to renameTableFunc() above, except for CREATE
|
|
|
|
|
** TRIGGER, not CREATE INDEX and CREATE TABLE.
|
|
|
|
|
*/
|
|
|
|
|
static void renameTriggerFunc(
|
|
|
|
@@ -109674,7 +109674,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
|
|
|
|
|
switch( onError ){
|
|
|
|
|
default: {
|
|
|
|
|
onError = OE_Abort;
|
|
|
|
|
/* Fall thru into the next case */
|
|
|
|
|
/* Fall through into the next case */
|
|
|
|
|
}
|
|
|
|
|
case OE_Rollback:
|
|
|
|
|
case OE_Abort:
|
|
|
|
@@ -111751,7 +111751,7 @@ static int sqlite3LoadExtension(
|
|
|
|
|
** entry point name "sqlite3_extension_init" was not found, then
|
|
|
|
|
** construct an entry point name "sqlite3_X_init" where the X is
|
|
|
|
|
** replaced by the lowercase value of every ASCII alphabetic
|
|
|
|
|
** character in the filename after the last "/" upto the first ".",
|
|
|
|
|
** character in the filename after the last "/" up to the first ".",
|
|
|
|
|
** and eliding the first three characters if they are "lib".
|
|
|
|
|
** Examples:
|
|
|
|
|
**
|
|
|
|
@@ -117806,7 +117806,7 @@ static void generateWithRecursiveQuery(
|
|
|
|
|
int iQueue; /* The Queue table */
|
|
|
|
|
int iDistinct = 0; /* To ensure unique results if UNION */
|
|
|
|
|
int eDest = SRT_Fifo; /* How to write to Queue */
|
|
|
|
|
SelectDest destQueue; /* SelectDest targetting the Queue table */
|
|
|
|
|
SelectDest destQueue; /* SelectDest targeting the Queue table */
|
|
|
|
|
int i; /* Loop counter */
|
|
|
|
|
int rc; /* Result code */
|
|
|
|
|
ExprList *pOrderBy; /* The ORDER BY clause */
|
|
|
|
@@ -118375,7 +118375,7 @@ SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Code an output subroutine for a coroutine implementation of a
|
|
|
|
|
** SELECT statment.
|
|
|
|
|
** SELECT statement.
|
|
|
|
|
**
|
|
|
|
|
** The data to be output is contained in pIn->iSdst. There are
|
|
|
|
|
** pIn->nSdst columns to be output. pDest is where the output should
|
|
|
|
@@ -119070,7 +119070,7 @@ static void substSelect(
|
|
|
|
|
** aggregates.
|
|
|
|
|
**
|
|
|
|
|
** (**) Restriction (10) was removed from the code on 2005-02-05 but we
|
|
|
|
|
** accidently carried the comment forward until 2014-09-15. Original
|
|
|
|
|
** accidentally carried the comment forward until 2014-09-15. Original
|
|
|
|
|
** text: "The subquery does not use aggregates or the outer query
|
|
|
|
|
** does not use LIMIT."
|
|
|
|
|
**
|
|
|
|
@@ -119501,7 +119501,7 @@ static int flattenSubquery(
|
|
|
|
|
** ORDER BY column expression is identical to the iOrderByCol'th
|
|
|
|
|
** expression returned by SELECT statement pSub. Since these values
|
|
|
|
|
** do not necessarily correspond to columns in SELECT statement pParent,
|
|
|
|
|
** zero them before transfering the ORDER BY clause.
|
|
|
|
|
** zero them before transferring the ORDER BY clause.
|
|
|
|
|
**
|
|
|
|
|
** Not doing this may cause an error if a subsequent call to this
|
|
|
|
|
** function attempts to flatten a compound sub-query into pParent
|
|
|
|
@@ -121105,7 +121105,7 @@ SQLITE_PRIVATE int sqlite3Select(
|
|
|
|
|
*/
|
|
|
|
|
if( pGroupBy ){
|
|
|
|
|
KeyInfo *pKeyInfo; /* Keying information for the group by clause */
|
|
|
|
|
int addr1; /* A-vs-B comparision jump */
|
|
|
|
|
int addr1; /* A-vs-B comparison jump */
|
|
|
|
|
int addrOutputRow; /* Start of subroutine that outputs a result row */
|
|
|
|
|
int regOutputRow; /* Return address register for output subroutine */
|
|
|
|
|
int addrSetAbort; /* Set the abort flag and return */
|
|
|
|
@@ -125165,7 +125165,7 @@ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){
|
|
|
|
|
**
|
|
|
|
|
** An eponymous virtual table instance is one that is named after its
|
|
|
|
|
** module, and more importantly, does not require a CREATE VIRTUAL TABLE
|
|
|
|
|
** statement in order to come into existance. Eponymous virtual table
|
|
|
|
|
** statement in order to come into existence. Eponymous virtual table
|
|
|
|
|
** instances always exist. They cannot be DROP-ed.
|
|
|
|
|
**
|
|
|
|
|
** Any virtual table module for which xConnect and xCreate are the same
|
|
|
|
@@ -130576,7 +130576,7 @@ SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCo
|
|
|
|
|
** Value pLoop->nOut is currently set to the estimated number of rows
|
|
|
|
|
** visited for scanning (a=? AND b=?). This function reduces that estimate
|
|
|
|
|
** by some factor to account for the (c BETWEEN ? AND ?) expression based
|
|
|
|
|
** on the stat4 data for the index. this scan will be peformed multiple
|
|
|
|
|
** on the stat4 data for the index. this scan will be performed multiple
|
|
|
|
|
** times (once for each (a,b) combination that matches a=?) is dealt with
|
|
|
|
|
** by the caller.
|
|
|
|
|
**
|
|
|
|
@@ -133788,7 +133788,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
|
|
|
|
|
sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
|
|
|
|
|
|
|
|
|
|
/* Special case: a WHERE clause that is constant. Evaluate the
|
|
|
|
|
** expression and either jump over all of the code or fall thru.
|
|
|
|
|
** expression and either jump over all of the code or fall through.
|
|
|
|
|
*/
|
|
|
|
|
for(ii=0; ii<sWLB.pWC->nTerm; ii++){
|
|
|
|
|
if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){
|
|
|
|
@@ -133811,7 +133811,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
|
|
|
|
|
**
|
|
|
|
|
** The N-th term of the FROM clause is assigned a bitmask of 1<<N.
|
|
|
|
|
**
|
|
|
|
|
** The rule of the previous sentence ensures thta if X is the bitmask for
|
|
|
|
|
** The rule of the previous sentence ensures that if X is the bitmask for
|
|
|
|
|
** a table T, then X-1 is the bitmask for all other tables to the left of T.
|
|
|
|
|
** Knowing the bitmask for all tables to the left of a left join is
|
|
|
|
|
** important. Ticket #3015.
|
|
|
|
@@ -138726,7 +138726,7 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
/* If the next character is a digit, this is a floating point
|
|
|
|
|
** number that begins with ".". Fall thru into the next case */
|
|
|
|
|
** number that begins with ".". Fall through into the next case */
|
|
|
|
|
}
|
|
|
|
|
case CC_DIGIT: {
|
|
|
|
|
testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' );
|
|
|
|
@@ -142774,7 +142774,7 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
|
|
|
|
|
|
|
/* Find the column for which info is requested */
|
|
|
|
|
if( zColumnName==0 ){
|
|
|
|
|
/* Query for existance of table only */
|
|
|
|
|
/* Query for existence of table only */
|
|
|
|
|
}else{
|
|
|
|
|
for(iCol=0; iCol<pTab->nCol; iCol++){
|
|
|
|
|
pCol = &pTab->aCol[iCol];
|
|
|
|
@@ -144657,7 +144657,7 @@ struct Fts3Table {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef SQLITE_TEST
|
|
|
|
|
/* True to disable the incremental doclist optimization. This is controled
|
|
|
|
|
/* True to disable the incremental doclist optimization. This is controlled
|
|
|
|
|
** by special insert command 'test-no-incr-doclist'. */
|
|
|
|
|
int bNoIncrDoclist;
|
|
|
|
|
#endif
|
|
|
|
@@ -144699,7 +144699,7 @@ struct Fts3Cursor {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** The Fts3Cursor.eSearch member is always set to one of the following.
|
|
|
|
|
** Actualy, Fts3Cursor.eSearch can be greater than or equal to
|
|
|
|
|
** Actually, Fts3Cursor.eSearch can be greater than or equal to
|
|
|
|
|
** FTS3_FULLTEXT_SEARCH. If so, then Fts3Cursor.eSearch - 2 is the index
|
|
|
|
|
** of the column to be searched. For example, in
|
|
|
|
|
**
|
|
|
|
@@ -152741,7 +152741,7 @@ static Fts3HashElem *fts3FindElementByHash(
|
|
|
|
|
int nKey,
|
|
|
|
|
int h /* The hash for this key. */
|
|
|
|
|
){
|
|
|
|
|
Fts3HashElem *elem; /* Used to loop thru the element list */
|
|
|
|
|
Fts3HashElem *elem; /* Used to loop through the element list */
|
|
|
|
|
int count; /* Number of elements left to test */
|
|
|
|
|
int (*xCompare)(const void*,int,const void*,int); /* comparison function */
|
|
|
|
|
|
|
|
|
@@ -152848,7 +152848,7 @@ SQLITE_PRIVATE void *sqlite3Fts3HashInsert(
|
|
|
|
|
){
|
|
|
|
|
int hraw; /* Raw hash value of the key */
|
|
|
|
|
int h; /* the hash of the key modulo hash table size */
|
|
|
|
|
Fts3HashElem *elem; /* Used to loop thru the element list */
|
|
|
|
|
Fts3HashElem *elem; /* Used to loop through the element list */
|
|
|
|
|
Fts3HashElem *new_elem; /* New element added to the pH */
|
|
|
|
|
int (*xHash)(const void*,int); /* The hash function */
|
|
|
|
|
|
|
|
|
@@ -153048,7 +153048,7 @@ static const char cType[] = {
|
|
|
|
|
**
|
|
|
|
|
** In these routine, the letters are in reverse order. So the 'y' rule
|
|
|
|
|
** is that 'y' is a consonant unless it is followed by another
|
|
|
|
|
** consonent.
|
|
|
|
|
** consonant.
|
|
|
|
|
*/
|
|
|
|
|
static int isVowel(const char*);
|
|
|
|
|
static int isConsonant(const char *z){
|
|
|
|
@@ -153160,7 +153160,7 @@ static int star_oh(const char *z){
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** If the word ends with zFrom and xCond() is true for the stem
|
|
|
|
|
** of the word that preceeds the zFrom ending, then change the
|
|
|
|
|
** of the word that precedes the zFrom ending, then change the
|
|
|
|
|
** ending to zTo.
|
|
|
|
|
**
|
|
|
|
|
** The input word *pz and zFrom are both in reverse order. zTo
|
|
|
|
@@ -160243,7 +160243,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
|
|
|
|
|
/*
|
|
|
|
|
** SQLite value pRowid contains the rowid of a row that may or may not be
|
|
|
|
|
** present in the FTS3 table. If it is, delete it and adjust the contents
|
|
|
|
|
** of subsiduary data structures accordingly.
|
|
|
|
|
** of subsidiary data structures accordingly.
|
|
|
|
|
*/
|
|
|
|
|
static int fts3DeleteByRowid(
|
|
|
|
|
Fts3Table *p,
|
|
|
|
@@ -161063,7 +161063,7 @@ static int fts3StringAppend(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If there is insufficient space allocated at StrBuffer.z, use realloc()
|
|
|
|
|
** to grow the buffer until so that it is big enough to accomadate the
|
|
|
|
|
** to grow the buffer until so that it is big enough to accommodate the
|
|
|
|
|
** appended data.
|
|
|
|
|
*/
|
|
|
|
|
if( pStr->n+nAppend+1>=pStr->nAlloc ){
|
|
|
|
@@ -162058,7 +162058,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets(
|
|
|
|
|
sCtx.iTerm = 0;
|
|
|
|
|
(void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx);
|
|
|
|
|
|
|
|
|
|
/* Retreive the text stored in column iCol. If an SQL NULL is stored
|
|
|
|
|
/* Retrieve the text stored in column iCol. If an SQL NULL is stored
|
|
|
|
|
** in column iCol, jump immediately to the next iteration of the loop.
|
|
|
|
|
** If an OOM occurs while retrieving the data (this can happen if SQLite
|
|
|
|
|
** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM
|
|
|
|
@@ -167670,7 +167670,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(
|
|
|
|
|
**
|
|
|
|
|
** "RBU" stands for "Resumable Bulk Update". As in a large database update
|
|
|
|
|
** transmitted via a wireless network to a mobile device. A transaction
|
|
|
|
|
** applied using this extension is hence refered to as an "RBU update".
|
|
|
|
|
** applied using this extension is hence referred to as an "RBU update".
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** LIMITATIONS
|
|
|
|
@@ -169608,7 +169608,7 @@ static char *rbuObjIterGetIndexCols(
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
** Assuming the current table columns are "a", "b" and "c", and the zObj
|
|
|
|
|
** paramter is passed "old", return a string of the form:
|
|
|
|
|
** parameter is passed "old", return a string of the form:
|
|
|
|
|
**
|
|
|
|
|
** "old.a, old.b, old.b"
|
|
|
|
|
**
|
|
|
|
@@ -171504,7 +171504,7 @@ static void rbuDeleteVfs(sqlite3rbu *p){
|
|
|
|
|
/*
|
|
|
|
|
** This user-defined SQL function is invoked with a single argument - the
|
|
|
|
|
** name of a table expected to appear in the target database. It returns
|
|
|
|
|
** the number of auxilliary indexes on the table.
|
|
|
|
|
** the number of auxiliary indexes on the table.
|
|
|
|
|
*/
|
|
|
|
|
static void rbuIndexCntFunc(
|
|
|
|
|
sqlite3_context *pCtx,
|
|
|
|
@@ -172234,7 +172234,7 @@ static int rbuVfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
|
|
|
|
|
|
|
|
|
|
/* If this is an RBU vacuum operation and this is the target database,
|
|
|
|
|
** pretend that it has at least one page. Otherwise, SQLite will not
|
|
|
|
|
** check for the existance of a *-wal file. rbuVfsRead() contains
|
|
|
|
|
** check for the existence of a *-wal file. rbuVfsRead() contains
|
|
|
|
|
** similar logic. */
|
|
|
|
|
if( rc==SQLITE_OK && *pSize==0
|
|
|
|
|
&& p->pRbu && rbuIsVacuum(p->pRbu)
|
|
|
|
@@ -172569,7 +172569,7 @@ static int rbuVfsOpen(
|
|
|
|
|
rbu_file *pDb = rbuFindMaindb(pRbuVfs, zName);
|
|
|
|
|
if( pDb ){
|
|
|
|
|
if( pDb->pRbu && pDb->pRbu->eStage==RBU_STAGE_OAL ){
|
|
|
|
|
/* This call is to open a *-wal file. Intead, open the *-oal. This
|
|
|
|
|
/* This call is to open a *-wal file. Instead, open the *-oal. This
|
|
|
|
|
** code ensures that the string passed to xOpen() is terminated by a
|
|
|
|
|
** pair of '\0' bytes in case the VFS attempts to extract a URI
|
|
|
|
|
** parameter from it. */
|
|
|
|
@@ -174587,7 +174587,7 @@ static int sessionTableInfo(
|
|
|
|
|
/*
|
|
|
|
|
** This function is only called from within a pre-update handler for a
|
|
|
|
|
** write to table pTab, part of session pSession. If this is the first
|
|
|
|
|
** write to this table, initalize the SessionTable.nCol, azCol[] and
|
|
|
|
|
** write to this table, initialize the SessionTable.nCol, azCol[] and
|
|
|
|
|
** abPK[] arrays accordingly.
|
|
|
|
|
**
|
|
|
|
|
** If an error occurs, an error code is stored in sqlite3_session.rc and
|
|
|
|
@@ -177119,7 +177119,7 @@ static int sessionBindValue(
|
|
|
|
|
**
|
|
|
|
|
** New.* value $i from the iterator is bound to variable ($i+1) of
|
|
|
|
|
** statement pStmt. If parameter abPK is NULL, all values from 0 to (nCol-1)
|
|
|
|
|
** are transfered to the statement. Otherwise, if abPK is not NULL, it points
|
|
|
|
|
** are transferred to the statement. Otherwise, if abPK is not NULL, it points
|
|
|
|
|
** to an array nCol elements in size. In this case only those values for
|
|
|
|
|
** which abPK[$i] is true are read from the iterator and bound to the
|
|
|
|
|
** statement.
|
|
|
|
@@ -177158,7 +177158,7 @@ static int sessionBindRow(
|
|
|
|
|
** iterator pIter points to to the SELECT and attempts to seek to the table
|
|
|
|
|
** entry. If a row is found, the SELECT statement left pointing at the row
|
|
|
|
|
** and SQLITE_ROW is returned. Otherwise, if no row is found and no error
|
|
|
|
|
** has occured, the statement is reset and SQLITE_OK is returned. If an
|
|
|
|
|
** has occurred, the statement is reset and SQLITE_OK is returned. If an
|
|
|
|
|
** error occurs, the statement is reset and an SQLite error code is returned.
|
|
|
|
|
**
|
|
|
|
|
** If this function returns SQLITE_ROW, the caller must eventually reset()
|
|
|
|
@@ -180372,7 +180372,7 @@ static sqlite3_module jsonTreeModule = {
|
|
|
|
|
#endif /* SQLITE_OMIT_VIRTUALTABLE */
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
** The following routines are the only publically visible identifiers in this
|
|
|
|
|
** The following routines are the only publicly visible identifiers in this
|
|
|
|
|
** file. Call the following routines in order to register the various SQL
|
|
|
|
|
** functions and the virtual table implemented by this file.
|
|
|
|
|
****************************************************************************/
|
|
|
|
@@ -181132,7 +181132,7 @@ static int sqlite3Fts5Corrupt(void);
|
|
|
|
|
/*
|
|
|
|
|
** The assert_nc() macro is similar to the assert() macro, except that it
|
|
|
|
|
** is used for assert() conditions that are true only if it can be
|
|
|
|
|
** guranteed that the database is not corrupt.
|
|
|
|
|
** guaranteed that the database is not corrupt.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef SQLITE_DEBUG
|
|
|
|
|
SQLITE_API extern int sqlite3_fts5_may_be_corrupt;
|
|
|
|
@@ -192553,7 +192553,7 @@ static void fts5TrimSegments(Fts5Index *p, Fts5Iter *pIter){
|
|
|
|
|
if( pSeg->pSeg==0 ){
|
|
|
|
|
/* no-op */
|
|
|
|
|
}else if( pSeg->pLeaf==0 ){
|
|
|
|
|
/* All keys from this input segment have been transfered to the output.
|
|
|
|
|
/* All keys from this input segment have been transferred to the output.
|
|
|
|
|
** Set both the first and last page-numbers to 0 to indicate that the
|
|
|
|
|
** segment is now empty. */
|
|
|
|
|
pSeg->pSeg->pgnoLast = 0;
|
|
|
|
@@ -192615,7 +192615,7 @@ static void fts5MergeChunkCallback(
|
|
|
|
|
*/
|
|
|
|
|
static void fts5IndexMergeLevel(
|
|
|
|
|
Fts5Index *p, /* FTS5 backend object */
|
|
|
|
|
Fts5Structure **ppStruct, /* IN/OUT: Stucture of index */
|
|
|
|
|
Fts5Structure **ppStruct, /* IN/OUT: Structure of index */
|
|
|
|
|
int iLvl, /* Level to read input from */
|
|
|
|
|
int *pnRem /* Write up to this many output leaves */
|
|
|
|
|
){
|
|
|
|
@@ -199410,7 +199410,7 @@ static int fts5PorterGobbleVC(char *zStem, int nStem, int bPrevCons){
|
|
|
|
|
if( 0==(bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan for a consonent */
|
|
|
|
|
/* Scan for a consonant */
|
|
|
|
|
for(i++; i<nStem; i++){
|
|
|
|
|
if( (bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) return i+1;
|
|
|
|
|
}
|
|
|
|
|