| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.8.0. By combining all the individual C code files into this |
| 3 | +** version 3.8.0.1. 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. |
| | @@ -654,13 +654,13 @@ |
| 654 | 654 | ** |
| 655 | 655 | ** See also: [sqlite3_libversion()], |
| 656 | 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | 658 | */ |
| 659 | | -#define SQLITE_VERSION "3.8.0" |
| 659 | +#define SQLITE_VERSION "3.8.0.1" |
| 660 | 660 | #define SQLITE_VERSION_NUMBER 3008000 |
| 661 | | -#define SQLITE_SOURCE_ID "2013-08-22 02:56:28 0775501acf152dcbf4dd039f4511f3d8c4330d85" |
| 661 | +#define SQLITE_SOURCE_ID "2013-08-29 13:47:05 c5857808c0707baa30994dd6aa3b9c93a74c0073" |
| 662 | 662 | |
| 663 | 663 | /* |
| 664 | 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | 666 | ** |
| | @@ -81815,11 +81815,13 @@ |
| 81815 | 81815 | } |
| 81816 | 81816 | pPager = sqlite3BtreePager(aNew->pBt); |
| 81817 | 81817 | sqlite3PagerLockingMode(pPager, db->dfltLockMode); |
| 81818 | 81818 | sqlite3BtreeSecureDelete(aNew->pBt, |
| 81819 | 81819 | sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); |
| 81820 | +#ifndef SQLITE_OMIT_PAGER_PRAGMAS |
| 81820 | 81821 | sqlite3BtreeSetPagerFlags(aNew->pBt, 3 | (db->flags & PAGER_FLAGS_MASK)); |
| 81822 | +#endif |
| 81821 | 81823 | } |
| 81822 | 81824 | aNew->safety_level = 3; |
| 81823 | 81825 | aNew->zName = sqlite3DbStrDup(db, zName); |
| 81824 | 81826 | if( rc==SQLITE_OK && aNew->zName==0 ){ |
| 81825 | 81827 | rc = SQLITE_NOMEM; |
| | @@ -93907,10 +93909,12 @@ |
| 93907 | 93909 | } |
| 93908 | 93910 | pDb++; |
| 93909 | 93911 | } |
| 93910 | 93912 | } |
| 93911 | 93913 | } |
| 93914 | +#else |
| 93915 | +# define setAllPagerFlags(X) /* no-op */ |
| 93912 | 93916 | #endif |
| 93913 | 93917 | |
| 93914 | 93918 | |
| 93915 | 93919 | #ifndef SQLITE_OMIT_FLAG_PRAGMAS |
| 93916 | 93920 | /* |
| | @@ -105953,12 +105957,14 @@ |
| 105953 | 105957 | /* |
| 105954 | 105958 | ** If the pBase expression originated in the ON or USING clause of |
| 105955 | 105959 | ** a join, then transfer the appropriate markings over to derived. |
| 105956 | 105960 | */ |
| 105957 | 105961 | static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ |
| 105958 | | - pDerived->flags |= pBase->flags & EP_FromJoin; |
| 105959 | | - pDerived->iRightJoinTable = pBase->iRightJoinTable; |
| 105962 | + if( pDerived ){ |
| 105963 | + pDerived->flags |= pBase->flags & EP_FromJoin; |
| 105964 | + pDerived->iRightJoinTable = pBase->iRightJoinTable; |
| 105965 | + } |
| 105960 | 105966 | } |
| 105961 | 105967 | |
| 105962 | 105968 | #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY) |
| 105963 | 105969 | /* |
| 105964 | 105970 | ** Analyze a term that consists of two or more OR-connected |
| | @@ -106411,10 +106417,11 @@ |
| 106411 | 106417 | Expr *pNewExpr; |
| 106412 | 106418 | int idxNew; |
| 106413 | 106419 | pNewExpr = sqlite3PExpr(pParse, ops[i], |
| 106414 | 106420 | sqlite3ExprDup(db, pExpr->pLeft, 0), |
| 106415 | 106421 | sqlite3ExprDup(db, pList->a[i].pExpr, 0), 0); |
| 106422 | + transferJoinMarkings(pNewExpr, pExpr); |
| 106416 | 106423 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); |
| 106417 | 106424 | testcase( idxNew==0 ); |
| 106418 | 106425 | exprAnalyze(pSrc, pWC, idxNew); |
| 106419 | 106426 | pTerm = &pWC->a[idxTerm]; |
| 106420 | 106427 | pWC->a[idxNew].iParent = idxTerm; |
| | @@ -106478,17 +106485,19 @@ |
| 106478 | 106485 | sCollSeqName.n = 6; |
| 106479 | 106486 | pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); |
| 106480 | 106487 | pNewExpr1 = sqlite3PExpr(pParse, TK_GE, |
| 106481 | 106488 | sqlite3ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName), |
| 106482 | 106489 | pStr1, 0); |
| 106490 | + transferJoinMarkings(pNewExpr1, pExpr); |
| 106483 | 106491 | idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC); |
| 106484 | 106492 | testcase( idxNew1==0 ); |
| 106485 | 106493 | exprAnalyze(pSrc, pWC, idxNew1); |
| 106486 | 106494 | pNewExpr2 = sqlite3ExprDup(db, pLeft, 0); |
| 106487 | 106495 | pNewExpr2 = sqlite3PExpr(pParse, TK_LT, |
| 106488 | 106496 | sqlite3ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName), |
| 106489 | 106497 | pStr2, 0); |
| 106498 | + transferJoinMarkings(pNewExpr2, pExpr); |
| 106490 | 106499 | idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC); |
| 106491 | 106500 | testcase( idxNew2==0 ); |
| 106492 | 106501 | exprAnalyze(pSrc, pWC, idxNew2); |
| 106493 | 106502 | pTerm = &pWC->a[idxTerm]; |
| 106494 | 106503 | if( isComplete ){ |
| | @@ -109309,10 +109318,11 @@ |
| 109309 | 109318 | pProbe = &sPk; |
| 109310 | 109319 | } |
| 109311 | 109320 | rSize = whereCost(pSrc->pTab->nRowEst); |
| 109312 | 109321 | rLogSize = estLog(rSize); |
| 109313 | 109322 | |
| 109323 | +#ifndef SQLITE_OMIT_AUTOMATIC_INDEX |
| 109314 | 109324 | /* Automatic indexes */ |
| 109315 | 109325 | if( !pBuilder->pOrSet |
| 109316 | 109326 | && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 |
| 109317 | 109327 | && pSrc->pIndex==0 |
| 109318 | 109328 | && !pSrc->viaCoroutine |
| | @@ -109343,10 +109353,11 @@ |
| 109343 | 109353 | pNew->prereq = mExtra | pTerm->prereqRight; |
| 109344 | 109354 | rc = whereLoopInsert(pBuilder, pNew); |
| 109345 | 109355 | } |
| 109346 | 109356 | } |
| 109347 | 109357 | } |
| 109358 | +#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ |
| 109348 | 109359 | |
| 109349 | 109360 | /* Loop over all indices |
| 109350 | 109361 | */ |
| 109351 | 109362 | for(; rc==SQLITE_OK && pProbe; pProbe=pProbe->pNext, iSortIdx++){ |
| 109352 | 109363 | if( pProbe->pPartIdxWhere!=0 |
| | @@ -110292,15 +110303,19 @@ |
| 110292 | 110303 | pLoop->u.btree.nEq = 1; |
| 110293 | 110304 | /* TUNING: Cost of a rowid lookup is 10 */ |
| 110294 | 110305 | pLoop->rRun = 33; /* 33==whereCost(10) */ |
| 110295 | 110306 | }else{ |
| 110296 | 110307 | for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 110297 | | - if( pIdx->onError==OE_None || pIdx->pPartIdxWhere!=0 ) continue; |
| 110308 | + assert( pLoop->aLTermSpace==pLoop->aLTerm ); |
| 110309 | + assert( ArraySize(pLoop->aLTermSpace)==4 ); |
| 110310 | + if( pIdx->onError==OE_None |
| 110311 | + || pIdx->pPartIdxWhere!=0 |
| 110312 | + || pIdx->nColumn>ArraySize(pLoop->aLTermSpace) |
| 110313 | + ) continue; |
| 110298 | 110314 | for(j=0; j<pIdx->nColumn; j++){ |
| 110299 | 110315 | pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 0, WO_EQ, pIdx); |
| 110300 | 110316 | if( pTerm==0 ) break; |
| 110301 | | - whereLoopResize(pWInfo->pParse->db, pLoop, j); |
| 110302 | 110317 | pLoop->aLTerm[j] = pTerm; |
| 110303 | 110318 | } |
| 110304 | 110319 | if( j!=pIdx->nColumn ) continue; |
| 110305 | 110320 | pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW|WHERE_INDEXED; |
| 110306 | 110321 | if( (pItem->colUsed & ~columnsInIndex(pIdx))==0 ){ |
| 110307 | 110322 | |