From da925ee5ccb1c53b460a3806084f744b39ea0238 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 10 Sep 2013 07:45:34 -0700 Subject: [PATCH] Update to SQLite 3.8.0.2 --- modules/beast_sqlite/sqlite/sqlite3.c | 36 +++++++++++++++++---------- modules/beast_sqlite/sqlite/sqlite3.h | 4 +-- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/modules/beast_sqlite/sqlite/sqlite3.c b/modules/beast_sqlite/sqlite/sqlite3.c index c1cb5bc6d3..9657356eed 100644 --- a/modules/beast_sqlite/sqlite/sqlite3.c +++ b/modules/beast_sqlite/sqlite/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.8.0. By combining all the individual C code files into this +** version 3.8.0.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -25,11 +25,6 @@ #ifndef SQLITE_API # define SQLITE_API #endif -// -// VFALCO: NOTE -// This is actually the pre-release snapshot as of 2013-08-22 02:56 UTC -// as indicated in the SQLITE_VERSION macro. -// /************** Begin file sqliteInt.h ***************************************/ /* ** 2001 September 15 @@ -661,9 +656,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.8.0" +#define SQLITE_VERSION "3.8.0.2" #define SQLITE_VERSION_NUMBER 3008000 -#define SQLITE_SOURCE_ID "2013-08-22 02:56:28 0775501acf152dcbf4dd039f4511f3d8c4330d85" +#define SQLITE_SOURCE_ID "2013-09-03 17:11:13 7dd4968f235d6e1ca9547cda9cf3bd570e1609ef" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -81822,7 +81817,9 @@ static void attachFunc( sqlite3PagerLockingMode(pPager, db->dfltLockMode); sqlite3BtreeSecureDelete(aNew->pBt, sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); +#ifndef SQLITE_OMIT_PAGER_PRAGMAS sqlite3BtreeSetPagerFlags(aNew->pBt, 3 | (db->flags & PAGER_FLAGS_MASK)); +#endif } aNew->safety_level = 3; aNew->zName = sqlite3DbStrDup(db, zName); @@ -93914,6 +93911,8 @@ static void setAllPagerFlags(sqlite3 *db){ } } } +#else +# define setAllPagerFlags(X) /* no-op */ #endif @@ -105960,8 +105959,10 @@ static int isMatchOfColumn( ** a join, then transfer the appropriate markings over to derived. */ static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ - pDerived->flags |= pBase->flags & EP_FromJoin; - pDerived->iRightJoinTable = pBase->iRightJoinTable; + if( pDerived ){ + pDerived->flags |= pBase->flags & EP_FromJoin; + pDerived->iRightJoinTable = pBase->iRightJoinTable; + } } #if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY) @@ -106418,6 +106419,7 @@ static void exprAnalyze( pNewExpr = sqlite3PExpr(pParse, ops[i], sqlite3ExprDup(db, pExpr->pLeft, 0), sqlite3ExprDup(db, pList->a[i].pExpr, 0), 0); + transferJoinMarkings(pNewExpr, pExpr); idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew==0 ); exprAnalyze(pSrc, pWC, idxNew); @@ -106485,6 +106487,7 @@ static void exprAnalyze( pNewExpr1 = sqlite3PExpr(pParse, TK_GE, sqlite3ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName), pStr1, 0); + transferJoinMarkings(pNewExpr1, pExpr); idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew1==0 ); exprAnalyze(pSrc, pWC, idxNew1); @@ -106492,6 +106495,7 @@ static void exprAnalyze( pNewExpr2 = sqlite3PExpr(pParse, TK_LT, sqlite3ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName), pStr2, 0); + transferJoinMarkings(pNewExpr2, pExpr); idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew2==0 ); exprAnalyze(pSrc, pWC, idxNew2); @@ -109316,6 +109320,7 @@ static int whereLoopAddBtree( rSize = whereCost(pSrc->pTab->nRowEst); rLogSize = estLog(rSize); +#ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ if( !pBuilder->pOrSet && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 @@ -109350,6 +109355,7 @@ static int whereLoopAddBtree( } } } +#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ /* Loop over all indices */ @@ -110299,11 +110305,15 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop->rRun = 33; /* 33==whereCost(10) */ }else{ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->onError==OE_None || pIdx->pPartIdxWhere!=0 ) continue; + assert( pLoop->aLTermSpace==pLoop->aLTerm ); + assert( ArraySize(pLoop->aLTermSpace)==4 ); + if( pIdx->onError==OE_None + || pIdx->pPartIdxWhere!=0 + || pIdx->nColumn>ArraySize(pLoop->aLTermSpace) + ) continue; for(j=0; jnColumn; j++){ pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 0, WO_EQ, pIdx); if( pTerm==0 ) break; - whereLoopResize(pWInfo->pParse->db, pLoop, j); pLoop->aLTerm[j] = pTerm; } if( j!=pIdx->nColumn ) continue; @@ -110658,7 +110668,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( && OptimizationEnabled(db, SQLITE_OmitNoopJoin) ){ Bitmask tabUsed = exprListTableUsage(pMaskSet, pResultSet); - if( pOrderBy ) tabUsed |= exprListTableUsage(pMaskSet, pOrderBy); + if( sWLB.pOrderBy ) tabUsed |= exprListTableUsage(pMaskSet, sWLB.pOrderBy); while( pWInfo->nLevel>=2 ){ WhereTerm *pTerm, *pEnd; pLoop = pWInfo->a[pWInfo->nLevel-1].pWLoop; diff --git a/modules/beast_sqlite/sqlite/sqlite3.h b/modules/beast_sqlite/sqlite/sqlite3.h index 1efac96e12..70cfd5f944 100644 --- a/modules/beast_sqlite/sqlite/sqlite3.h +++ b/modules/beast_sqlite/sqlite/sqlite3.h @@ -107,9 +107,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.8.0" +#define SQLITE_VERSION "3.8.0.2" #define SQLITE_VERSION_NUMBER 3008000 -#define SQLITE_SOURCE_ID "2013-08-22 02:56:28 0775501acf152dcbf4dd039f4511f3d8c4330d85" +#define SQLITE_SOURCE_ID "2013-09-03 17:11:13 7dd4968f235d6e1ca9547cda9cf3bd570e1609ef" /* ** CAPI3REF: Run-Time Library Version Numbers