Fossil SCM
Update the built-in SQLite to the latest from upstream. The latest SQLite has some changes that stress the difference engine. This upgrade is to pull those changes into the source tree so that they can be added to the diff-test page.
Commit
df0d0d04d18dc41a96bd42bb4d53f76bbc510cb8
Parent
60d5b1f5a2c704a…
2 files changed
+154
-99
+4
-4
+154
-99
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | -** version 3.7.15. By combining all the individual C code files into this | |
| 3 | +** version 3.7.16. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | ||
| 671 | 671 | ** |
| 672 | 672 | ** See also: [sqlite3_libversion()], |
| 673 | 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | 675 | */ |
| 676 | -#define SQLITE_VERSION "3.7.15" | |
| 677 | -#define SQLITE_VERSION_NUMBER 3007015 | |
| 678 | -#define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272" | |
| 676 | +#define SQLITE_VERSION "3.7.16" | |
| 677 | +#define SQLITE_VERSION_NUMBER 3007016 | |
| 678 | +#define SQLITE_SOURCE_ID "2012-12-14 17:54:38 3d65c70343196b8f69c5293e7703839846fade85" | |
| 679 | 679 | |
| 680 | 680 | /* |
| 681 | 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | 683 | ** |
| @@ -2156,11 +2156,11 @@ | ||
| 2156 | 2156 | ** database connection is opened. By default, URI handling is globally |
| 2157 | 2157 | ** disabled. The default value may be changed by compiling with the |
| 2158 | 2158 | ** [SQLITE_USE_URI] symbol defined. |
| 2159 | 2159 | ** |
| 2160 | 2160 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 2161 | -** <dd> This option taks a single integer argument which is interpreted as | |
| 2161 | +** <dd> This option takes a single integer argument which is interpreted as | |
| 2162 | 2162 | ** a boolean in order to enable or disable the use of covering indices for |
| 2163 | 2163 | ** full table scans in the query optimizer. The default setting is determined |
| 2164 | 2164 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 2165 | 2165 | ** if that compile-time option is omitted. |
| 2166 | 2166 | ** The ability to disable the use of covering indices for full table scans |
| @@ -56334,11 +56334,11 @@ | ||
| 56334 | 56334 | sqlite3BtreeLeave(p); |
| 56335 | 56335 | return 0; |
| 56336 | 56336 | } |
| 56337 | 56337 | i = PENDING_BYTE_PAGE(pBt); |
| 56338 | 56338 | if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); |
| 56339 | - sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), 20000); | |
| 56339 | + sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); | |
| 56340 | 56340 | sCheck.errMsg.useMalloc = 2; |
| 56341 | 56341 | |
| 56342 | 56342 | /* Check the integrity of the freelist |
| 56343 | 56343 | */ |
| 56344 | 56344 | checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]), |
| @@ -97445,38 +97445,47 @@ | ||
| 97445 | 97445 | return 1; |
| 97446 | 97446 | } |
| 97447 | 97447 | #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ |
| 97448 | 97448 | |
| 97449 | 97449 | /* |
| 97450 | -** Analyze the SELECT statement passed as an argument to see if it | |
| 97451 | -** is a min() or max() query. Return WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX if | |
| 97452 | -** it is, or 0 otherwise. At present, a query is considered to be | |
| 97453 | -** a min()/max() query if: | |
| 97454 | -** | |
| 97455 | -** 1. There is a single object in the FROM clause. | |
| 97456 | -** | |
| 97457 | -** 2. There is a single expression in the result set, and it is | |
| 97458 | -** either min(x) or max(x), where x is a column reference. | |
| 97459 | -*/ | |
| 97460 | -static u8 minMaxQuery(Select *p){ | |
| 97461 | - Expr *pExpr; | |
| 97462 | - ExprList *pEList = p->pEList; | |
| 97463 | - | |
| 97464 | - if( pEList->nExpr!=1 ) return WHERE_ORDERBY_NORMAL; | |
| 97465 | - pExpr = pEList->a[0].pExpr; | |
| 97466 | - if( pExpr->op!=TK_AGG_FUNCTION ) return 0; | |
| 97467 | - if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0; | |
| 97468 | - pEList = pExpr->x.pList; | |
| 97469 | - if( pEList==0 || pEList->nExpr!=1 ) return 0; | |
| 97470 | - if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL; | |
| 97471 | - assert( !ExprHasProperty(pExpr, EP_IntValue) ); | |
| 97472 | - if( sqlite3StrICmp(pExpr->u.zToken,"min")==0 ){ | |
| 97473 | - return WHERE_ORDERBY_MIN; | |
| 97474 | - }else if( sqlite3StrICmp(pExpr->u.zToken,"max")==0 ){ | |
| 97475 | - return WHERE_ORDERBY_MAX; | |
| 97476 | - } | |
| 97477 | - return WHERE_ORDERBY_NORMAL; | |
| 97450 | +** Based on the contents of the AggInfo structure indicated by the first | |
| 97451 | +** argument, this function checks if the following are true: | |
| 97452 | +** | |
| 97453 | +** * the query contains just a single aggregate function, | |
| 97454 | +** * the aggregate function is either min() or max(), and | |
| 97455 | +** * the argument to the aggregate function is a column value. | |
| 97456 | +** | |
| 97457 | +** If all of the above are true, then WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX | |
| 97458 | +** is returned as appropriate. Also, *ppMinMax is set to point to the | |
| 97459 | +** list of arguments passed to the aggregate before returning. | |
| 97460 | +** | |
| 97461 | +** Or, if the conditions above are not met, *ppMinMax is set to 0 and | |
| 97462 | +** WHERE_ORDERBY_NORMAL is returned. | |
| 97463 | +*/ | |
| 97464 | +static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){ | |
| 97465 | + int eRet = WHERE_ORDERBY_NORMAL; /* Return value */ | |
| 97466 | + | |
| 97467 | + *ppMinMax = 0; | |
| 97468 | + if( pAggInfo->nFunc==1 ){ | |
| 97469 | + Expr *pExpr = pAggInfo->aFunc[0].pExpr; /* Aggregate function */ | |
| 97470 | + ExprList *pEList = pExpr->x.pList; /* Arguments to agg function */ | |
| 97471 | + | |
| 97472 | + assert( pExpr->op==TK_AGG_FUNCTION ); | |
| 97473 | + if( pEList && pEList->nExpr==1 && pEList->a[0].pExpr->op==TK_AGG_COLUMN ){ | |
| 97474 | + const char *zFunc = pExpr->u.zToken; | |
| 97475 | + if( sqlite3StrICmp(zFunc, "min")==0 ){ | |
| 97476 | + eRet = WHERE_ORDERBY_MIN; | |
| 97477 | + *ppMinMax = pEList; | |
| 97478 | + }else if( sqlite3StrICmp(zFunc, "max")==0 ){ | |
| 97479 | + eRet = WHERE_ORDERBY_MAX; | |
| 97480 | + *ppMinMax = pEList; | |
| 97481 | + } | |
| 97482 | + } | |
| 97483 | + } | |
| 97484 | + | |
| 97485 | + assert( *ppMinMax==0 || (*ppMinMax)->nExpr==1 ); | |
| 97486 | + return eRet; | |
| 97478 | 97487 | } |
| 97479 | 97488 | |
| 97480 | 97489 | /* |
| 97481 | 97490 | ** The select statement passed as the first argument is an aggregate query. |
| 97482 | 97491 | ** The second argment is the associated aggregate-info object. This |
| @@ -98812,15 +98821,21 @@ | ||
| 98812 | 98821 | ** index or indices to use) should place a different priority on |
| 98813 | 98822 | ** satisfying the 'ORDER BY' clause than it does in other cases. |
| 98814 | 98823 | ** Refer to code and comments in where.c for details. |
| 98815 | 98824 | */ |
| 98816 | 98825 | ExprList *pMinMax = 0; |
| 98817 | - u8 flag = minMaxQuery(p); | |
| 98826 | + u8 flag = WHERE_ORDERBY_NORMAL; | |
| 98827 | + | |
| 98828 | + assert( p->pGroupBy==0 ); | |
| 98829 | + assert( flag==0 ); | |
| 98830 | + if( p->pHaving==0 ){ | |
| 98831 | + flag = minMaxQuery(&sAggInfo, &pMinMax); | |
| 98832 | + } | |
| 98833 | + assert( flag==0 || (pMinMax!=0 && pMinMax->nExpr==1) ); | |
| 98834 | + | |
| 98818 | 98835 | if( flag ){ |
| 98819 | - assert( !ExprHasProperty(p->pEList->a[0].pExpr, EP_xIsSelect) ); | |
| 98820 | - assert( p->pEList->a[0].pExpr->x.pList->nExpr==1 ); | |
| 98821 | - pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->x.pList,0); | |
| 98836 | + pMinMax = sqlite3ExprListDup(db, pMinMax, 0); | |
| 98822 | 98837 | pDel = pMinMax; |
| 98823 | 98838 | if( pMinMax && !db->mallocFailed ){ |
| 98824 | 98839 | pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0; |
| 98825 | 98840 | pMinMax->a[0].pExpr->op = TK_COLUMN; |
| 98826 | 98841 | } |
| @@ -102704,11 +102719,11 @@ | ||
| 102704 | 102719 | #define WHERE_COLUMN_RANGE 0x00020000 /* x<EXPR and/or x>EXPR */ |
| 102705 | 102720 | #define WHERE_COLUMN_IN 0x00040000 /* x IN (...) */ |
| 102706 | 102721 | #define WHERE_COLUMN_NULL 0x00080000 /* x IS NULL */ |
| 102707 | 102722 | #define WHERE_INDEXED 0x000f0000 /* Anything that uses an index */ |
| 102708 | 102723 | #define WHERE_NOT_FULLSCAN 0x100f3000 /* Does not do a full table scan */ |
| 102709 | -#define WHERE_IN_ABLE 0x000f1000 /* Able to support an IN operator */ | |
| 102724 | +#define WHERE_IN_ABLE 0x080f1000 /* Able to support an IN operator */ | |
| 102710 | 102725 | #define WHERE_TOP_LIMIT 0x00100000 /* x<EXPR or x<=EXPR constraint */ |
| 102711 | 102726 | #define WHERE_BTM_LIMIT 0x00200000 /* x>EXPR or x>=EXPR constraint */ |
| 102712 | 102727 | #define WHERE_BOTH_LIMIT 0x00300000 /* Both x>EXPR and x<EXPR */ |
| 102713 | 102728 | #define WHERE_IDX_ONLY 0x00400000 /* Use index only - omit table */ |
| 102714 | 102729 | #define WHERE_ORDERED 0x00800000 /* Output will appear in correct order */ |
| @@ -104507,11 +104522,11 @@ | ||
| 104507 | 104522 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104508 | 104523 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104509 | 104524 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104510 | 104525 | testcase( pTerm->eOperator==WO_IN ); |
| 104511 | 104526 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104512 | - if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; | |
| 104527 | + if( pTerm->eOperator & (WO_ISNULL) ) continue; | |
| 104513 | 104528 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104514 | 104529 | nTerm++; |
| 104515 | 104530 | } |
| 104516 | 104531 | |
| 104517 | 104532 | /* If the ORDER BY clause contains only columns in the current |
| @@ -104555,29 +104570,32 @@ | ||
| 104555 | 104570 | *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy; |
| 104556 | 104571 | *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage = |
| 104557 | 104572 | pUsage; |
| 104558 | 104573 | |
| 104559 | 104574 | for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104575 | + u8 op; | |
| 104560 | 104576 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104561 | 104577 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104562 | 104578 | testcase( pTerm->eOperator==WO_IN ); |
| 104563 | 104579 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104564 | - if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; | |
| 104580 | + if( pTerm->eOperator & (WO_ISNULL) ) continue; | |
| 104565 | 104581 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104566 | 104582 | pIdxCons[j].iColumn = pTerm->u.leftColumn; |
| 104567 | 104583 | pIdxCons[j].iTermOffset = i; |
| 104568 | - pIdxCons[j].op = (u8)pTerm->eOperator; | |
| 104584 | + op = (u8)pTerm->eOperator; | |
| 104585 | + if( op==WO_IN ) op = WO_EQ; | |
| 104586 | + pIdxCons[j].op = op; | |
| 104569 | 104587 | /* The direct assignment in the previous line is possible only because |
| 104570 | 104588 | ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The |
| 104571 | 104589 | ** following asserts verify this fact. */ |
| 104572 | 104590 | assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ ); |
| 104573 | 104591 | assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT ); |
| 104574 | 104592 | assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE ); |
| 104575 | 104593 | assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT ); |
| 104576 | 104594 | assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE ); |
| 104577 | 104595 | assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH ); |
| 104578 | - assert( pTerm->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); | |
| 104596 | + assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); | |
| 104579 | 104597 | j++; |
| 104580 | 104598 | } |
| 104581 | 104599 | for(i=0; i<nOrderBy; i++){ |
| 104582 | 104600 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 104583 | 104601 | pIdxOrderBy[i].iColumn = pExpr->iColumn; |
| @@ -104659,10 +104677,11 @@ | ||
| 104659 | 104677 | struct sqlite3_index_constraint *pIdxCons; |
| 104660 | 104678 | struct sqlite3_index_constraint_usage *pUsage; |
| 104661 | 104679 | WhereTerm *pTerm; |
| 104662 | 104680 | int i, j; |
| 104663 | 104681 | int nOrderBy; |
| 104682 | + int bAllowIN; /* Allow IN optimizations */ | |
| 104664 | 104683 | double rCost; |
| 104665 | 104684 | |
| 104666 | 104685 | /* Make sure wsFlags is initialized to some sane value. Otherwise, if the |
| 104667 | 104686 | ** malloc in allocateIndexInfo() fails and this function returns leaving |
| 104668 | 104687 | ** wsFlags in an uninitialized state, the caller may behave unpredictably. |
| @@ -104693,63 +104712,91 @@ | ||
| 104693 | 104712 | ** sqlite3ViewGetColumnNames() would have picked up the error. |
| 104694 | 104713 | */ |
| 104695 | 104714 | assert( pTab->azModuleArg && pTab->azModuleArg[0] ); |
| 104696 | 104715 | assert( sqlite3GetVTable(pParse->db, pTab) ); |
| 104697 | 104716 | |
| 104698 | - /* Set the aConstraint[].usable fields and initialize all | |
| 104699 | - ** output variables to zero. | |
| 104700 | - ** | |
| 104701 | - ** aConstraint[].usable is true for constraints where the right-hand | |
| 104702 | - ** side contains only references to tables to the left of the current | |
| 104703 | - ** table. In other words, if the constraint is of the form: | |
| 104704 | - ** | |
| 104705 | - ** column = expr | |
| 104706 | - ** | |
| 104707 | - ** and we are evaluating a join, then the constraint on column is | |
| 104708 | - ** only valid if all tables referenced in expr occur to the left | |
| 104709 | - ** of the table containing column. | |
| 104710 | - ** | |
| 104711 | - ** The aConstraints[] array contains entries for all constraints | |
| 104712 | - ** on the current table. That way we only have to compute it once | |
| 104713 | - ** even though we might try to pick the best index multiple times. | |
| 104714 | - ** For each attempt at picking an index, the order of tables in the | |
| 104715 | - ** join might be different so we have to recompute the usable flag | |
| 104716 | - ** each time. | |
| 104717 | - */ | |
| 104718 | - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; | |
| 104719 | - pUsage = pIdxInfo->aConstraintUsage; | |
| 104720 | - for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ | |
| 104721 | - j = pIdxCons->iTermOffset; | |
| 104722 | - pTerm = &pWC->a[j]; | |
| 104723 | - pIdxCons->usable = (pTerm->prereqRight&p->notReady) ? 0 : 1; | |
| 104724 | - } | |
| 104725 | - memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint); | |
| 104726 | - if( pIdxInfo->needToFreeIdxStr ){ | |
| 104727 | - sqlite3_free(pIdxInfo->idxStr); | |
| 104728 | - } | |
| 104729 | - pIdxInfo->idxStr = 0; | |
| 104730 | - pIdxInfo->idxNum = 0; | |
| 104731 | - pIdxInfo->needToFreeIdxStr = 0; | |
| 104732 | - pIdxInfo->orderByConsumed = 0; | |
| 104733 | - /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */ | |
| 104734 | - pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2); | |
| 104735 | - nOrderBy = pIdxInfo->nOrderBy; | |
| 104736 | - if( !p->pOrderBy ){ | |
| 104737 | - pIdxInfo->nOrderBy = 0; | |
| 104738 | - } | |
| 104739 | - | |
| 104740 | - if( vtabBestIndex(pParse, pTab, pIdxInfo) ){ | |
| 104741 | - return; | |
| 104742 | - } | |
| 104743 | - | |
| 104744 | - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; | |
| 104745 | - for(i=0; i<pIdxInfo->nConstraint; i++){ | |
| 104746 | - if( pUsage[i].argvIndex>0 ){ | |
| 104747 | - p->cost.used |= pWC->a[pIdxCons[i].iTermOffset].prereqRight; | |
| 104748 | - } | |
| 104749 | - } | |
| 104750 | - | |
| 104717 | + /* Try once or twice. On the first attempt, allow IN optimizations. | |
| 104718 | + ** If an IN optimization is accepted by the virtual table xBestIndex | |
| 104719 | + ** method, but the pInfo->aConstrainUsage.omit flag is not set, then | |
| 104720 | + ** the query will not work because it might allow duplicate rows in | |
| 104721 | + ** output. In that case, run the xBestIndex method a second time | |
| 104722 | + ** without the IN constraints. Usually this loop only runs once. | |
| 104723 | + ** The loop will exit using a "break" statement. | |
| 104724 | + */ | |
| 104725 | + for(bAllowIN=1; 1; bAllowIN--){ | |
| 104726 | + assert( bAllowIN==0 || bAllowIN==1 ); | |
| 104727 | + | |
| 104728 | + /* Set the aConstraint[].usable fields and initialize all | |
| 104729 | + ** output variables to zero. | |
| 104730 | + ** | |
| 104731 | + ** aConstraint[].usable is true for constraints where the right-hand | |
| 104732 | + ** side contains only references to tables to the left of the current | |
| 104733 | + ** table. In other words, if the constraint is of the form: | |
| 104734 | + ** | |
| 104735 | + ** column = expr | |
| 104736 | + ** | |
| 104737 | + ** and we are evaluating a join, then the constraint on column is | |
| 104738 | + ** only valid if all tables referenced in expr occur to the left | |
| 104739 | + ** of the table containing column. | |
| 104740 | + ** | |
| 104741 | + ** The aConstraints[] array contains entries for all constraints | |
| 104742 | + ** on the current table. That way we only have to compute it once | |
| 104743 | + ** even though we might try to pick the best index multiple times. | |
| 104744 | + ** For each attempt at picking an index, the order of tables in the | |
| 104745 | + ** join might be different so we have to recompute the usable flag | |
| 104746 | + ** each time. | |
| 104747 | + */ | |
| 104748 | + pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; | |
| 104749 | + pUsage = pIdxInfo->aConstraintUsage; | |
| 104750 | + for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ | |
| 104751 | + j = pIdxCons->iTermOffset; | |
| 104752 | + pTerm = &pWC->a[j]; | |
| 104753 | + if( (pTerm->prereqRight&p->notReady)==0 | |
| 104754 | + && (bAllowIN || pTerm->eOperator!=WO_IN) | |
| 104755 | + ){ | |
| 104756 | + pIdxCons->usable = 1; | |
| 104757 | + }else{ | |
| 104758 | + pIdxCons->usable = 0; | |
| 104759 | + } | |
| 104760 | + } | |
| 104761 | + memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint); | |
| 104762 | + if( pIdxInfo->needToFreeIdxStr ){ | |
| 104763 | + sqlite3_free(pIdxInfo->idxStr); | |
| 104764 | + } | |
| 104765 | + pIdxInfo->idxStr = 0; | |
| 104766 | + pIdxInfo->idxNum = 0; | |
| 104767 | + pIdxInfo->needToFreeIdxStr = 0; | |
| 104768 | + pIdxInfo->orderByConsumed = 0; | |
| 104769 | + /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */ | |
| 104770 | + pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2); | |
| 104771 | + nOrderBy = pIdxInfo->nOrderBy; | |
| 104772 | + if( !p->pOrderBy ){ | |
| 104773 | + pIdxInfo->nOrderBy = 0; | |
| 104774 | + } | |
| 104775 | + | |
| 104776 | + if( vtabBestIndex(pParse, pTab, pIdxInfo) ){ | |
| 104777 | + return; | |
| 104778 | + } | |
| 104779 | + | |
| 104780 | + pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; | |
| 104781 | + for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ | |
| 104782 | + if( pUsage[i].argvIndex>0 ){ | |
| 104783 | + j = pIdxCons->iTermOffset; | |
| 104784 | + pTerm = &pWC->a[j]; | |
| 104785 | + p->cost.used |= pTerm->prereqRight; | |
| 104786 | + if( pTerm->eOperator==WO_IN && pUsage[i].omit==0 ){ | |
| 104787 | + /* Do not attempt to use an IN constraint if the virtual table | |
| 104788 | + ** says that the equivalent EQ constraint cannot be safely omitted. | |
| 104789 | + ** If we do attempt to use such a constraint, some rows might be | |
| 104790 | + ** repeated in the output. */ | |
| 104791 | + break; | |
| 104792 | + } | |
| 104793 | + } | |
| 104794 | + } | |
| 104795 | + if( i>=pIdxInfo->nConstraint ) break; | |
| 104796 | + } | |
| 104797 | + | |
| 104751 | 104798 | /* If there is an ORDER BY clause, and the selected virtual table index |
| 104752 | 104799 | ** does not satisfy it, increase the cost of the scan accordingly. This |
| 104753 | 104800 | ** matches the processing for non-virtual tables in bestBtreeIndex(). |
| 104754 | 104801 | */ |
| 104755 | 104802 | rCost = pIdxInfo->estimatedCost; |
| @@ -106514,32 +106561,40 @@ | ||
| 106514 | 106561 | if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){ |
| 106515 | 106562 | /* Case 0: The table is a virtual-table. Use the VFilter and VNext |
| 106516 | 106563 | ** to access the data. |
| 106517 | 106564 | */ |
| 106518 | 106565 | int iReg; /* P3 Value for OP_VFilter */ |
| 106566 | + int addrNotFound; | |
| 106519 | 106567 | sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx; |
| 106520 | 106568 | int nConstraint = pVtabIdx->nConstraint; |
| 106521 | 106569 | struct sqlite3_index_constraint_usage *aUsage = |
| 106522 | 106570 | pVtabIdx->aConstraintUsage; |
| 106523 | 106571 | const struct sqlite3_index_constraint *aConstraint = |
| 106524 | 106572 | pVtabIdx->aConstraint; |
| 106525 | 106573 | |
| 106526 | 106574 | sqlite3ExprCachePush(pParse); |
| 106527 | 106575 | iReg = sqlite3GetTempRange(pParse, nConstraint+2); |
| 106576 | + addrNotFound = pLevel->addrBrk; | |
| 106528 | 106577 | for(j=1; j<=nConstraint; j++){ |
| 106529 | 106578 | for(k=0; k<nConstraint; k++){ |
| 106530 | 106579 | if( aUsage[k].argvIndex==j ){ |
| 106531 | - int iTerm = aConstraint[k].iTermOffset; | |
| 106532 | - sqlite3ExprCode(pParse, pWC->a[iTerm].pExpr->pRight, iReg+j+1); | |
| 106580 | + WhereTerm *pTerm = &pWC->a[aConstraint[k].iTermOffset]; | |
| 106581 | + int iTarget = iReg+j+1; | |
| 106582 | + if( pTerm->eOperator & WO_IN ){ | |
| 106583 | + codeEqualityTerm(pParse, pTerm, pLevel, iTarget); | |
| 106584 | + addrNotFound = pLevel->addrNxt; | |
| 106585 | + }else{ | |
| 106586 | + sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget); | |
| 106587 | + } | |
| 106533 | 106588 | break; |
| 106534 | 106589 | } |
| 106535 | 106590 | } |
| 106536 | 106591 | if( k==nConstraint ) break; |
| 106537 | 106592 | } |
| 106538 | 106593 | sqlite3VdbeAddOp2(v, OP_Integer, pVtabIdx->idxNum, iReg); |
| 106539 | 106594 | sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1); |
| 106540 | - sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrBrk, iReg, pVtabIdx->idxStr, | |
| 106595 | + sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, pVtabIdx->idxStr, | |
| 106541 | 106596 | pVtabIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC); |
| 106542 | 106597 | pVtabIdx->needToFreeIdxStr = 0; |
| 106543 | 106598 | for(j=0; j<nConstraint; j++){ |
| 106544 | 106599 | if( aUsage[j].omit ){ |
| 106545 | 106600 | int iTerm = aConstraint[j].iTermOffset; |
| 106546 | 106601 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.7.15. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | |
| 671 | ** |
| 672 | ** See also: [sqlite3_libversion()], |
| 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | */ |
| 676 | #define SQLITE_VERSION "3.7.15" |
| 677 | #define SQLITE_VERSION_NUMBER 3007015 |
| 678 | #define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272" |
| 679 | |
| 680 | /* |
| 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | ** |
| @@ -2156,11 +2156,11 @@ | |
| 2156 | ** database connection is opened. By default, URI handling is globally |
| 2157 | ** disabled. The default value may be changed by compiling with the |
| 2158 | ** [SQLITE_USE_URI] symbol defined. |
| 2159 | ** |
| 2160 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 2161 | ** <dd> This option taks a single integer argument which is interpreted as |
| 2162 | ** a boolean in order to enable or disable the use of covering indices for |
| 2163 | ** full table scans in the query optimizer. The default setting is determined |
| 2164 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 2165 | ** if that compile-time option is omitted. |
| 2166 | ** The ability to disable the use of covering indices for full table scans |
| @@ -56334,11 +56334,11 @@ | |
| 56334 | sqlite3BtreeLeave(p); |
| 56335 | return 0; |
| 56336 | } |
| 56337 | i = PENDING_BYTE_PAGE(pBt); |
| 56338 | if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); |
| 56339 | sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), 20000); |
| 56340 | sCheck.errMsg.useMalloc = 2; |
| 56341 | |
| 56342 | /* Check the integrity of the freelist |
| 56343 | */ |
| 56344 | checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]), |
| @@ -97445,38 +97445,47 @@ | |
| 97445 | return 1; |
| 97446 | } |
| 97447 | #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ |
| 97448 | |
| 97449 | /* |
| 97450 | ** Analyze the SELECT statement passed as an argument to see if it |
| 97451 | ** is a min() or max() query. Return WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX if |
| 97452 | ** it is, or 0 otherwise. At present, a query is considered to be |
| 97453 | ** a min()/max() query if: |
| 97454 | ** |
| 97455 | ** 1. There is a single object in the FROM clause. |
| 97456 | ** |
| 97457 | ** 2. There is a single expression in the result set, and it is |
| 97458 | ** either min(x) or max(x), where x is a column reference. |
| 97459 | */ |
| 97460 | static u8 minMaxQuery(Select *p){ |
| 97461 | Expr *pExpr; |
| 97462 | ExprList *pEList = p->pEList; |
| 97463 | |
| 97464 | if( pEList->nExpr!=1 ) return WHERE_ORDERBY_NORMAL; |
| 97465 | pExpr = pEList->a[0].pExpr; |
| 97466 | if( pExpr->op!=TK_AGG_FUNCTION ) return 0; |
| 97467 | if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0; |
| 97468 | pEList = pExpr->x.pList; |
| 97469 | if( pEList==0 || pEList->nExpr!=1 ) return 0; |
| 97470 | if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL; |
| 97471 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 97472 | if( sqlite3StrICmp(pExpr->u.zToken,"min")==0 ){ |
| 97473 | return WHERE_ORDERBY_MIN; |
| 97474 | }else if( sqlite3StrICmp(pExpr->u.zToken,"max")==0 ){ |
| 97475 | return WHERE_ORDERBY_MAX; |
| 97476 | } |
| 97477 | return WHERE_ORDERBY_NORMAL; |
| 97478 | } |
| 97479 | |
| 97480 | /* |
| 97481 | ** The select statement passed as the first argument is an aggregate query. |
| 97482 | ** The second argment is the associated aggregate-info object. This |
| @@ -98812,15 +98821,21 @@ | |
| 98812 | ** index or indices to use) should place a different priority on |
| 98813 | ** satisfying the 'ORDER BY' clause than it does in other cases. |
| 98814 | ** Refer to code and comments in where.c for details. |
| 98815 | */ |
| 98816 | ExprList *pMinMax = 0; |
| 98817 | u8 flag = minMaxQuery(p); |
| 98818 | if( flag ){ |
| 98819 | assert( !ExprHasProperty(p->pEList->a[0].pExpr, EP_xIsSelect) ); |
| 98820 | assert( p->pEList->a[0].pExpr->x.pList->nExpr==1 ); |
| 98821 | pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->x.pList,0); |
| 98822 | pDel = pMinMax; |
| 98823 | if( pMinMax && !db->mallocFailed ){ |
| 98824 | pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0; |
| 98825 | pMinMax->a[0].pExpr->op = TK_COLUMN; |
| 98826 | } |
| @@ -102704,11 +102719,11 @@ | |
| 102704 | #define WHERE_COLUMN_RANGE 0x00020000 /* x<EXPR and/or x>EXPR */ |
| 102705 | #define WHERE_COLUMN_IN 0x00040000 /* x IN (...) */ |
| 102706 | #define WHERE_COLUMN_NULL 0x00080000 /* x IS NULL */ |
| 102707 | #define WHERE_INDEXED 0x000f0000 /* Anything that uses an index */ |
| 102708 | #define WHERE_NOT_FULLSCAN 0x100f3000 /* Does not do a full table scan */ |
| 102709 | #define WHERE_IN_ABLE 0x000f1000 /* Able to support an IN operator */ |
| 102710 | #define WHERE_TOP_LIMIT 0x00100000 /* x<EXPR or x<=EXPR constraint */ |
| 102711 | #define WHERE_BTM_LIMIT 0x00200000 /* x>EXPR or x>=EXPR constraint */ |
| 102712 | #define WHERE_BOTH_LIMIT 0x00300000 /* Both x>EXPR and x<EXPR */ |
| 102713 | #define WHERE_IDX_ONLY 0x00400000 /* Use index only - omit table */ |
| 102714 | #define WHERE_ORDERED 0x00800000 /* Output will appear in correct order */ |
| @@ -104507,11 +104522,11 @@ | |
| 104507 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104508 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104509 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104510 | testcase( pTerm->eOperator==WO_IN ); |
| 104511 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104512 | if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; |
| 104513 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104514 | nTerm++; |
| 104515 | } |
| 104516 | |
| 104517 | /* If the ORDER BY clause contains only columns in the current |
| @@ -104555,29 +104570,32 @@ | |
| 104555 | *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy; |
| 104556 | *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage = |
| 104557 | pUsage; |
| 104558 | |
| 104559 | for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104560 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104561 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104562 | testcase( pTerm->eOperator==WO_IN ); |
| 104563 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104564 | if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; |
| 104565 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104566 | pIdxCons[j].iColumn = pTerm->u.leftColumn; |
| 104567 | pIdxCons[j].iTermOffset = i; |
| 104568 | pIdxCons[j].op = (u8)pTerm->eOperator; |
| 104569 | /* The direct assignment in the previous line is possible only because |
| 104570 | ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The |
| 104571 | ** following asserts verify this fact. */ |
| 104572 | assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ ); |
| 104573 | assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT ); |
| 104574 | assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE ); |
| 104575 | assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT ); |
| 104576 | assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE ); |
| 104577 | assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH ); |
| 104578 | assert( pTerm->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); |
| 104579 | j++; |
| 104580 | } |
| 104581 | for(i=0; i<nOrderBy; i++){ |
| 104582 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 104583 | pIdxOrderBy[i].iColumn = pExpr->iColumn; |
| @@ -104659,10 +104677,11 @@ | |
| 104659 | struct sqlite3_index_constraint *pIdxCons; |
| 104660 | struct sqlite3_index_constraint_usage *pUsage; |
| 104661 | WhereTerm *pTerm; |
| 104662 | int i, j; |
| 104663 | int nOrderBy; |
| 104664 | double rCost; |
| 104665 | |
| 104666 | /* Make sure wsFlags is initialized to some sane value. Otherwise, if the |
| 104667 | ** malloc in allocateIndexInfo() fails and this function returns leaving |
| 104668 | ** wsFlags in an uninitialized state, the caller may behave unpredictably. |
| @@ -104693,63 +104712,91 @@ | |
| 104693 | ** sqlite3ViewGetColumnNames() would have picked up the error. |
| 104694 | */ |
| 104695 | assert( pTab->azModuleArg && pTab->azModuleArg[0] ); |
| 104696 | assert( sqlite3GetVTable(pParse->db, pTab) ); |
| 104697 | |
| 104698 | /* Set the aConstraint[].usable fields and initialize all |
| 104699 | ** output variables to zero. |
| 104700 | ** |
| 104701 | ** aConstraint[].usable is true for constraints where the right-hand |
| 104702 | ** side contains only references to tables to the left of the current |
| 104703 | ** table. In other words, if the constraint is of the form: |
| 104704 | ** |
| 104705 | ** column = expr |
| 104706 | ** |
| 104707 | ** and we are evaluating a join, then the constraint on column is |
| 104708 | ** only valid if all tables referenced in expr occur to the left |
| 104709 | ** of the table containing column. |
| 104710 | ** |
| 104711 | ** The aConstraints[] array contains entries for all constraints |
| 104712 | ** on the current table. That way we only have to compute it once |
| 104713 | ** even though we might try to pick the best index multiple times. |
| 104714 | ** For each attempt at picking an index, the order of tables in the |
| 104715 | ** join might be different so we have to recompute the usable flag |
| 104716 | ** each time. |
| 104717 | */ |
| 104718 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; |
| 104719 | pUsage = pIdxInfo->aConstraintUsage; |
| 104720 | for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ |
| 104721 | j = pIdxCons->iTermOffset; |
| 104722 | pTerm = &pWC->a[j]; |
| 104723 | pIdxCons->usable = (pTerm->prereqRight&p->notReady) ? 0 : 1; |
| 104724 | } |
| 104725 | memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint); |
| 104726 | if( pIdxInfo->needToFreeIdxStr ){ |
| 104727 | sqlite3_free(pIdxInfo->idxStr); |
| 104728 | } |
| 104729 | pIdxInfo->idxStr = 0; |
| 104730 | pIdxInfo->idxNum = 0; |
| 104731 | pIdxInfo->needToFreeIdxStr = 0; |
| 104732 | pIdxInfo->orderByConsumed = 0; |
| 104733 | /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */ |
| 104734 | pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2); |
| 104735 | nOrderBy = pIdxInfo->nOrderBy; |
| 104736 | if( !p->pOrderBy ){ |
| 104737 | pIdxInfo->nOrderBy = 0; |
| 104738 | } |
| 104739 | |
| 104740 | if( vtabBestIndex(pParse, pTab, pIdxInfo) ){ |
| 104741 | return; |
| 104742 | } |
| 104743 | |
| 104744 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; |
| 104745 | for(i=0; i<pIdxInfo->nConstraint; i++){ |
| 104746 | if( pUsage[i].argvIndex>0 ){ |
| 104747 | p->cost.used |= pWC->a[pIdxCons[i].iTermOffset].prereqRight; |
| 104748 | } |
| 104749 | } |
| 104750 | |
| 104751 | /* If there is an ORDER BY clause, and the selected virtual table index |
| 104752 | ** does not satisfy it, increase the cost of the scan accordingly. This |
| 104753 | ** matches the processing for non-virtual tables in bestBtreeIndex(). |
| 104754 | */ |
| 104755 | rCost = pIdxInfo->estimatedCost; |
| @@ -106514,32 +106561,40 @@ | |
| 106514 | if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){ |
| 106515 | /* Case 0: The table is a virtual-table. Use the VFilter and VNext |
| 106516 | ** to access the data. |
| 106517 | */ |
| 106518 | int iReg; /* P3 Value for OP_VFilter */ |
| 106519 | sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx; |
| 106520 | int nConstraint = pVtabIdx->nConstraint; |
| 106521 | struct sqlite3_index_constraint_usage *aUsage = |
| 106522 | pVtabIdx->aConstraintUsage; |
| 106523 | const struct sqlite3_index_constraint *aConstraint = |
| 106524 | pVtabIdx->aConstraint; |
| 106525 | |
| 106526 | sqlite3ExprCachePush(pParse); |
| 106527 | iReg = sqlite3GetTempRange(pParse, nConstraint+2); |
| 106528 | for(j=1; j<=nConstraint; j++){ |
| 106529 | for(k=0; k<nConstraint; k++){ |
| 106530 | if( aUsage[k].argvIndex==j ){ |
| 106531 | int iTerm = aConstraint[k].iTermOffset; |
| 106532 | sqlite3ExprCode(pParse, pWC->a[iTerm].pExpr->pRight, iReg+j+1); |
| 106533 | break; |
| 106534 | } |
| 106535 | } |
| 106536 | if( k==nConstraint ) break; |
| 106537 | } |
| 106538 | sqlite3VdbeAddOp2(v, OP_Integer, pVtabIdx->idxNum, iReg); |
| 106539 | sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1); |
| 106540 | sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrBrk, iReg, pVtabIdx->idxStr, |
| 106541 | pVtabIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC); |
| 106542 | pVtabIdx->needToFreeIdxStr = 0; |
| 106543 | for(j=0; j<nConstraint; j++){ |
| 106544 | if( aUsage[j].omit ){ |
| 106545 | int iTerm = aConstraint[j].iTermOffset; |
| 106546 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.7.16. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | |
| 671 | ** |
| 672 | ** See also: [sqlite3_libversion()], |
| 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | */ |
| 676 | #define SQLITE_VERSION "3.7.16" |
| 677 | #define SQLITE_VERSION_NUMBER 3007016 |
| 678 | #define SQLITE_SOURCE_ID "2012-12-14 17:54:38 3d65c70343196b8f69c5293e7703839846fade85" |
| 679 | |
| 680 | /* |
| 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | ** |
| @@ -2156,11 +2156,11 @@ | |
| 2156 | ** database connection is opened. By default, URI handling is globally |
| 2157 | ** disabled. The default value may be changed by compiling with the |
| 2158 | ** [SQLITE_USE_URI] symbol defined. |
| 2159 | ** |
| 2160 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 2161 | ** <dd> This option takes a single integer argument which is interpreted as |
| 2162 | ** a boolean in order to enable or disable the use of covering indices for |
| 2163 | ** full table scans in the query optimizer. The default setting is determined |
| 2164 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 2165 | ** if that compile-time option is omitted. |
| 2166 | ** The ability to disable the use of covering indices for full table scans |
| @@ -56334,11 +56334,11 @@ | |
| 56334 | sqlite3BtreeLeave(p); |
| 56335 | return 0; |
| 56336 | } |
| 56337 | i = PENDING_BYTE_PAGE(pBt); |
| 56338 | if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); |
| 56339 | sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); |
| 56340 | sCheck.errMsg.useMalloc = 2; |
| 56341 | |
| 56342 | /* Check the integrity of the freelist |
| 56343 | */ |
| 56344 | checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]), |
| @@ -97445,38 +97445,47 @@ | |
| 97445 | return 1; |
| 97446 | } |
| 97447 | #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ |
| 97448 | |
| 97449 | /* |
| 97450 | ** Based on the contents of the AggInfo structure indicated by the first |
| 97451 | ** argument, this function checks if the following are true: |
| 97452 | ** |
| 97453 | ** * the query contains just a single aggregate function, |
| 97454 | ** * the aggregate function is either min() or max(), and |
| 97455 | ** * the argument to the aggregate function is a column value. |
| 97456 | ** |
| 97457 | ** If all of the above are true, then WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX |
| 97458 | ** is returned as appropriate. Also, *ppMinMax is set to point to the |
| 97459 | ** list of arguments passed to the aggregate before returning. |
| 97460 | ** |
| 97461 | ** Or, if the conditions above are not met, *ppMinMax is set to 0 and |
| 97462 | ** WHERE_ORDERBY_NORMAL is returned. |
| 97463 | */ |
| 97464 | static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){ |
| 97465 | int eRet = WHERE_ORDERBY_NORMAL; /* Return value */ |
| 97466 | |
| 97467 | *ppMinMax = 0; |
| 97468 | if( pAggInfo->nFunc==1 ){ |
| 97469 | Expr *pExpr = pAggInfo->aFunc[0].pExpr; /* Aggregate function */ |
| 97470 | ExprList *pEList = pExpr->x.pList; /* Arguments to agg function */ |
| 97471 | |
| 97472 | assert( pExpr->op==TK_AGG_FUNCTION ); |
| 97473 | if( pEList && pEList->nExpr==1 && pEList->a[0].pExpr->op==TK_AGG_COLUMN ){ |
| 97474 | const char *zFunc = pExpr->u.zToken; |
| 97475 | if( sqlite3StrICmp(zFunc, "min")==0 ){ |
| 97476 | eRet = WHERE_ORDERBY_MIN; |
| 97477 | *ppMinMax = pEList; |
| 97478 | }else if( sqlite3StrICmp(zFunc, "max")==0 ){ |
| 97479 | eRet = WHERE_ORDERBY_MAX; |
| 97480 | *ppMinMax = pEList; |
| 97481 | } |
| 97482 | } |
| 97483 | } |
| 97484 | |
| 97485 | assert( *ppMinMax==0 || (*ppMinMax)->nExpr==1 ); |
| 97486 | return eRet; |
| 97487 | } |
| 97488 | |
| 97489 | /* |
| 97490 | ** The select statement passed as the first argument is an aggregate query. |
| 97491 | ** The second argment is the associated aggregate-info object. This |
| @@ -98812,15 +98821,21 @@ | |
| 98821 | ** index or indices to use) should place a different priority on |
| 98822 | ** satisfying the 'ORDER BY' clause than it does in other cases. |
| 98823 | ** Refer to code and comments in where.c for details. |
| 98824 | */ |
| 98825 | ExprList *pMinMax = 0; |
| 98826 | u8 flag = WHERE_ORDERBY_NORMAL; |
| 98827 | |
| 98828 | assert( p->pGroupBy==0 ); |
| 98829 | assert( flag==0 ); |
| 98830 | if( p->pHaving==0 ){ |
| 98831 | flag = minMaxQuery(&sAggInfo, &pMinMax); |
| 98832 | } |
| 98833 | assert( flag==0 || (pMinMax!=0 && pMinMax->nExpr==1) ); |
| 98834 | |
| 98835 | if( flag ){ |
| 98836 | pMinMax = sqlite3ExprListDup(db, pMinMax, 0); |
| 98837 | pDel = pMinMax; |
| 98838 | if( pMinMax && !db->mallocFailed ){ |
| 98839 | pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0; |
| 98840 | pMinMax->a[0].pExpr->op = TK_COLUMN; |
| 98841 | } |
| @@ -102704,11 +102719,11 @@ | |
| 102719 | #define WHERE_COLUMN_RANGE 0x00020000 /* x<EXPR and/or x>EXPR */ |
| 102720 | #define WHERE_COLUMN_IN 0x00040000 /* x IN (...) */ |
| 102721 | #define WHERE_COLUMN_NULL 0x00080000 /* x IS NULL */ |
| 102722 | #define WHERE_INDEXED 0x000f0000 /* Anything that uses an index */ |
| 102723 | #define WHERE_NOT_FULLSCAN 0x100f3000 /* Does not do a full table scan */ |
| 102724 | #define WHERE_IN_ABLE 0x080f1000 /* Able to support an IN operator */ |
| 102725 | #define WHERE_TOP_LIMIT 0x00100000 /* x<EXPR or x<=EXPR constraint */ |
| 102726 | #define WHERE_BTM_LIMIT 0x00200000 /* x>EXPR or x>=EXPR constraint */ |
| 102727 | #define WHERE_BOTH_LIMIT 0x00300000 /* Both x>EXPR and x<EXPR */ |
| 102728 | #define WHERE_IDX_ONLY 0x00400000 /* Use index only - omit table */ |
| 102729 | #define WHERE_ORDERED 0x00800000 /* Output will appear in correct order */ |
| @@ -104507,11 +104522,11 @@ | |
| 104522 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104523 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104524 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104525 | testcase( pTerm->eOperator==WO_IN ); |
| 104526 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104527 | if( pTerm->eOperator & (WO_ISNULL) ) continue; |
| 104528 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104529 | nTerm++; |
| 104530 | } |
| 104531 | |
| 104532 | /* If the ORDER BY clause contains only columns in the current |
| @@ -104555,29 +104570,32 @@ | |
| 104570 | *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy; |
| 104571 | *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage = |
| 104572 | pUsage; |
| 104573 | |
| 104574 | for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 104575 | u8 op; |
| 104576 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 104577 | assert( (pTerm->eOperator&(pTerm->eOperator-1))==0 ); |
| 104578 | testcase( pTerm->eOperator==WO_IN ); |
| 104579 | testcase( pTerm->eOperator==WO_ISNULL ); |
| 104580 | if( pTerm->eOperator & (WO_ISNULL) ) continue; |
| 104581 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 104582 | pIdxCons[j].iColumn = pTerm->u.leftColumn; |
| 104583 | pIdxCons[j].iTermOffset = i; |
| 104584 | op = (u8)pTerm->eOperator; |
| 104585 | if( op==WO_IN ) op = WO_EQ; |
| 104586 | pIdxCons[j].op = op; |
| 104587 | /* The direct assignment in the previous line is possible only because |
| 104588 | ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The |
| 104589 | ** following asserts verify this fact. */ |
| 104590 | assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ ); |
| 104591 | assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT ); |
| 104592 | assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE ); |
| 104593 | assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT ); |
| 104594 | assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE ); |
| 104595 | assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH ); |
| 104596 | assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); |
| 104597 | j++; |
| 104598 | } |
| 104599 | for(i=0; i<nOrderBy; i++){ |
| 104600 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 104601 | pIdxOrderBy[i].iColumn = pExpr->iColumn; |
| @@ -104659,10 +104677,11 @@ | |
| 104677 | struct sqlite3_index_constraint *pIdxCons; |
| 104678 | struct sqlite3_index_constraint_usage *pUsage; |
| 104679 | WhereTerm *pTerm; |
| 104680 | int i, j; |
| 104681 | int nOrderBy; |
| 104682 | int bAllowIN; /* Allow IN optimizations */ |
| 104683 | double rCost; |
| 104684 | |
| 104685 | /* Make sure wsFlags is initialized to some sane value. Otherwise, if the |
| 104686 | ** malloc in allocateIndexInfo() fails and this function returns leaving |
| 104687 | ** wsFlags in an uninitialized state, the caller may behave unpredictably. |
| @@ -104693,63 +104712,91 @@ | |
| 104712 | ** sqlite3ViewGetColumnNames() would have picked up the error. |
| 104713 | */ |
| 104714 | assert( pTab->azModuleArg && pTab->azModuleArg[0] ); |
| 104715 | assert( sqlite3GetVTable(pParse->db, pTab) ); |
| 104716 | |
| 104717 | /* Try once or twice. On the first attempt, allow IN optimizations. |
| 104718 | ** If an IN optimization is accepted by the virtual table xBestIndex |
| 104719 | ** method, but the pInfo->aConstrainUsage.omit flag is not set, then |
| 104720 | ** the query will not work because it might allow duplicate rows in |
| 104721 | ** output. In that case, run the xBestIndex method a second time |
| 104722 | ** without the IN constraints. Usually this loop only runs once. |
| 104723 | ** The loop will exit using a "break" statement. |
| 104724 | */ |
| 104725 | for(bAllowIN=1; 1; bAllowIN--){ |
| 104726 | assert( bAllowIN==0 || bAllowIN==1 ); |
| 104727 | |
| 104728 | /* Set the aConstraint[].usable fields and initialize all |
| 104729 | ** output variables to zero. |
| 104730 | ** |
| 104731 | ** aConstraint[].usable is true for constraints where the right-hand |
| 104732 | ** side contains only references to tables to the left of the current |
| 104733 | ** table. In other words, if the constraint is of the form: |
| 104734 | ** |
| 104735 | ** column = expr |
| 104736 | ** |
| 104737 | ** and we are evaluating a join, then the constraint on column is |
| 104738 | ** only valid if all tables referenced in expr occur to the left |
| 104739 | ** of the table containing column. |
| 104740 | ** |
| 104741 | ** The aConstraints[] array contains entries for all constraints |
| 104742 | ** on the current table. That way we only have to compute it once |
| 104743 | ** even though we might try to pick the best index multiple times. |
| 104744 | ** For each attempt at picking an index, the order of tables in the |
| 104745 | ** join might be different so we have to recompute the usable flag |
| 104746 | ** each time. |
| 104747 | */ |
| 104748 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; |
| 104749 | pUsage = pIdxInfo->aConstraintUsage; |
| 104750 | for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ |
| 104751 | j = pIdxCons->iTermOffset; |
| 104752 | pTerm = &pWC->a[j]; |
| 104753 | if( (pTerm->prereqRight&p->notReady)==0 |
| 104754 | && (bAllowIN || pTerm->eOperator!=WO_IN) |
| 104755 | ){ |
| 104756 | pIdxCons->usable = 1; |
| 104757 | }else{ |
| 104758 | pIdxCons->usable = 0; |
| 104759 | } |
| 104760 | } |
| 104761 | memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint); |
| 104762 | if( pIdxInfo->needToFreeIdxStr ){ |
| 104763 | sqlite3_free(pIdxInfo->idxStr); |
| 104764 | } |
| 104765 | pIdxInfo->idxStr = 0; |
| 104766 | pIdxInfo->idxNum = 0; |
| 104767 | pIdxInfo->needToFreeIdxStr = 0; |
| 104768 | pIdxInfo->orderByConsumed = 0; |
| 104769 | /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */ |
| 104770 | pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2); |
| 104771 | nOrderBy = pIdxInfo->nOrderBy; |
| 104772 | if( !p->pOrderBy ){ |
| 104773 | pIdxInfo->nOrderBy = 0; |
| 104774 | } |
| 104775 | |
| 104776 | if( vtabBestIndex(pParse, pTab, pIdxInfo) ){ |
| 104777 | return; |
| 104778 | } |
| 104779 | |
| 104780 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; |
| 104781 | for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){ |
| 104782 | if( pUsage[i].argvIndex>0 ){ |
| 104783 | j = pIdxCons->iTermOffset; |
| 104784 | pTerm = &pWC->a[j]; |
| 104785 | p->cost.used |= pTerm->prereqRight; |
| 104786 | if( pTerm->eOperator==WO_IN && pUsage[i].omit==0 ){ |
| 104787 | /* Do not attempt to use an IN constraint if the virtual table |
| 104788 | ** says that the equivalent EQ constraint cannot be safely omitted. |
| 104789 | ** If we do attempt to use such a constraint, some rows might be |
| 104790 | ** repeated in the output. */ |
| 104791 | break; |
| 104792 | } |
| 104793 | } |
| 104794 | } |
| 104795 | if( i>=pIdxInfo->nConstraint ) break; |
| 104796 | } |
| 104797 | |
| 104798 | /* If there is an ORDER BY clause, and the selected virtual table index |
| 104799 | ** does not satisfy it, increase the cost of the scan accordingly. This |
| 104800 | ** matches the processing for non-virtual tables in bestBtreeIndex(). |
| 104801 | */ |
| 104802 | rCost = pIdxInfo->estimatedCost; |
| @@ -106514,32 +106561,40 @@ | |
| 106561 | if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){ |
| 106562 | /* Case 0: The table is a virtual-table. Use the VFilter and VNext |
| 106563 | ** to access the data. |
| 106564 | */ |
| 106565 | int iReg; /* P3 Value for OP_VFilter */ |
| 106566 | int addrNotFound; |
| 106567 | sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx; |
| 106568 | int nConstraint = pVtabIdx->nConstraint; |
| 106569 | struct sqlite3_index_constraint_usage *aUsage = |
| 106570 | pVtabIdx->aConstraintUsage; |
| 106571 | const struct sqlite3_index_constraint *aConstraint = |
| 106572 | pVtabIdx->aConstraint; |
| 106573 | |
| 106574 | sqlite3ExprCachePush(pParse); |
| 106575 | iReg = sqlite3GetTempRange(pParse, nConstraint+2); |
| 106576 | addrNotFound = pLevel->addrBrk; |
| 106577 | for(j=1; j<=nConstraint; j++){ |
| 106578 | for(k=0; k<nConstraint; k++){ |
| 106579 | if( aUsage[k].argvIndex==j ){ |
| 106580 | WhereTerm *pTerm = &pWC->a[aConstraint[k].iTermOffset]; |
| 106581 | int iTarget = iReg+j+1; |
| 106582 | if( pTerm->eOperator & WO_IN ){ |
| 106583 | codeEqualityTerm(pParse, pTerm, pLevel, iTarget); |
| 106584 | addrNotFound = pLevel->addrNxt; |
| 106585 | }else{ |
| 106586 | sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget); |
| 106587 | } |
| 106588 | break; |
| 106589 | } |
| 106590 | } |
| 106591 | if( k==nConstraint ) break; |
| 106592 | } |
| 106593 | sqlite3VdbeAddOp2(v, OP_Integer, pVtabIdx->idxNum, iReg); |
| 106594 | sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1); |
| 106595 | sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, pVtabIdx->idxStr, |
| 106596 | pVtabIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC); |
| 106597 | pVtabIdx->needToFreeIdxStr = 0; |
| 106598 | for(j=0; j<nConstraint; j++){ |
| 106599 | if( aUsage[j].omit ){ |
| 106600 | int iTerm = aConstraint[j].iTermOffset; |
| 106601 |
+4
-4
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -105,13 +105,13 @@ | ||
| 105 | 105 | ** |
| 106 | 106 | ** See also: [sqlite3_libversion()], |
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | -#define SQLITE_VERSION "3.7.15" | |
| 111 | -#define SQLITE_VERSION_NUMBER 3007015 | |
| 112 | -#define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272" | |
| 110 | +#define SQLITE_VERSION "3.7.16" | |
| 111 | +#define SQLITE_VERSION_NUMBER 3007016 | |
| 112 | +#define SQLITE_SOURCE_ID "2012-12-14 17:54:38 3d65c70343196b8f69c5293e7703839846fade85" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -1590,11 +1590,11 @@ | ||
| 1590 | 1590 | ** database connection is opened. By default, URI handling is globally |
| 1591 | 1591 | ** disabled. The default value may be changed by compiling with the |
| 1592 | 1592 | ** [SQLITE_USE_URI] symbol defined. |
| 1593 | 1593 | ** |
| 1594 | 1594 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 1595 | -** <dd> This option taks a single integer argument which is interpreted as | |
| 1595 | +** <dd> This option takes a single integer argument which is interpreted as | |
| 1596 | 1596 | ** a boolean in order to enable or disable the use of covering indices for |
| 1597 | 1597 | ** full table scans in the query optimizer. The default setting is determined |
| 1598 | 1598 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 1599 | 1599 | ** if that compile-time option is omitted. |
| 1600 | 1600 | ** The ability to disable the use of covering indices for full table scans |
| 1601 | 1601 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -105,13 +105,13 @@ | |
| 105 | ** |
| 106 | ** See also: [sqlite3_libversion()], |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.15" |
| 111 | #define SQLITE_VERSION_NUMBER 3007015 |
| 112 | #define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -1590,11 +1590,11 @@ | |
| 1590 | ** database connection is opened. By default, URI handling is globally |
| 1591 | ** disabled. The default value may be changed by compiling with the |
| 1592 | ** [SQLITE_USE_URI] symbol defined. |
| 1593 | ** |
| 1594 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 1595 | ** <dd> This option taks a single integer argument which is interpreted as |
| 1596 | ** a boolean in order to enable or disable the use of covering indices for |
| 1597 | ** full table scans in the query optimizer. The default setting is determined |
| 1598 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 1599 | ** if that compile-time option is omitted. |
| 1600 | ** The ability to disable the use of covering indices for full table scans |
| 1601 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -105,13 +105,13 @@ | |
| 105 | ** |
| 106 | ** See also: [sqlite3_libversion()], |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.16" |
| 111 | #define SQLITE_VERSION_NUMBER 3007016 |
| 112 | #define SQLITE_SOURCE_ID "2012-12-14 17:54:38 3d65c70343196b8f69c5293e7703839846fade85" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -1590,11 +1590,11 @@ | |
| 1590 | ** database connection is opened. By default, URI handling is globally |
| 1591 | ** disabled. The default value may be changed by compiling with the |
| 1592 | ** [SQLITE_USE_URI] symbol defined. |
| 1593 | ** |
| 1594 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 1595 | ** <dd> This option takes a single integer argument which is interpreted as |
| 1596 | ** a boolean in order to enable or disable the use of covering indices for |
| 1597 | ** full table scans in the query optimizer. The default setting is determined |
| 1598 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 1599 | ** if that compile-time option is omitted. |
| 1600 | ** The ability to disable the use of covering indices for full table scans |
| 1601 |