Răsfoiți Sursa

Update sqlite3

mingodad 9 ani în urmă
părinte
comite
07f6694b34
2 a modificat fișierele cu 18 adăugiri și 9 ștergeri
  1. 15 6
      SquiLu-ext/sqlite3.c
  2. 3 3
      SquiLu-ext/sqlite3.h

+ 15 - 6
SquiLu-ext/sqlite3.c

@@ -365,7 +365,7 @@ extern "C" {
 */
 */
 #define SQLITE_VERSION        "3.13.0"
 #define SQLITE_VERSION        "3.13.0"
 #define SQLITE_VERSION_NUMBER 3013000
 #define SQLITE_VERSION_NUMBER 3013000
-#define SQLITE_SOURCE_ID      "2016-05-03 19:40:54 1b43358f8979c4f18519e824e0d5f6ef2250107c"
+#define SQLITE_SOURCE_ID      "2016-05-04 21:06:21 71af9ac165ac02272f4886f69bd9ab4770fd7bb6"
 
 
 /*
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -8616,7 +8616,7 @@ struct sqlite3_rtree_query_info {
 /******** End of sqlite3rtree.h *********/
 /******** End of sqlite3rtree.h *********/
 /******** Begin file sqlite3session.h *********/
 /******** Begin file sqlite3session.h *********/
 
 
-#ifndef __SQLITESESSION_H_
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
 #define __SQLITESESSION_H_ 1
 #define __SQLITESESSION_H_ 1
 
 
 /*
 /*
@@ -9890,7 +9890,7 @@ int sqlite3changegroup_output_strm(sqlite3_changegroup*,
 }
 }
 #endif
 #endif
 
 
-#endif  /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
+#endif  /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
 
 
 /******** End of sqlite3session.h *********/
 /******** End of sqlite3session.h *********/
 /******** Begin file fts5.h *********/
 /******** Begin file fts5.h *********/
@@ -15065,6 +15065,7 @@ struct NameContext {
 #define NC_InAggFunc 0x0008  /* True if analyzing arguments to an agg func */
 #define NC_InAggFunc 0x0008  /* True if analyzing arguments to an agg func */
 #define NC_HasAgg    0x0010  /* One or more aggregate functions seen */
 #define NC_HasAgg    0x0010  /* One or more aggregate functions seen */
 #define NC_IdxExpr   0x0020  /* True if resolving columns of CREATE INDEX */
 #define NC_IdxExpr   0x0020  /* True if resolving columns of CREATE INDEX */
+#define NC_VarSelect 0x0040  /* A correlated subquery has been seen */
 #define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
 #define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
 
 
 /*
 /*
@@ -51919,10 +51920,16 @@ SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){
 **
 **
 ** Tests show that this optimization can quadruple the speed of large 
 ** Tests show that this optimization can quadruple the speed of large 
 ** DELETE operations.
 ** DELETE operations.
+**
+** This optimization cannot be used with a temp-file, as the page may
+** have been dirty at the start of the transaction. In that case, if
+** memory pressure forces page pPg out of the cache, the data does need 
+** to be written out to disk so that it may be read back in if the 
+** current transaction is rolled back.
 */
 */
 SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
 SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
   Pager *pPager = pPg->pPager;
   Pager *pPager = pPg->pPager;
-  if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
+  if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
     PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
     PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
     IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
     IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
     pPg->flags |= PGHDR_DONT_WRITE;
     pPg->flags |= PGHDR_DONT_WRITE;
@@ -88854,6 +88861,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
         assert( pNC->nRef>=nRef );
         assert( pNC->nRef>=nRef );
         if( nRef!=pNC->nRef ){
         if( nRef!=pNC->nRef ){
           ExprSetProperty(pExpr, EP_VarSelect);
           ExprSetProperty(pExpr, EP_VarSelect);
+          pNC->ncFlags |= NC_VarSelect;
         }
         }
       }
       }
       break;
       break;
@@ -102623,9 +102631,10 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
   int addrBypass = 0;    /* Address of jump over the delete logic */
   int addrBypass = 0;    /* Address of jump over the delete logic */
   int addrLoop = 0;      /* Top of the delete loop */
   int addrLoop = 0;      /* Top of the delete loop */
   int addrEphOpen = 0;   /* Instruction to open the Ephemeral table */
   int addrEphOpen = 0;   /* Instruction to open the Ephemeral table */
-  struct SrcList_item *pItem; /*To namage table alias*/
   int bComplex;          /* True if there are triggers or FKs or or
   int bComplex;          /* True if there are triggers or FKs or or
+  int bComplex;          /* True if there are triggers or FKs or
                          ** subqueries in the WHERE clause */
                          ** subqueries in the WHERE clause */
+  struct SrcList_item *pItem; /*To namage table alias*/
                          
                          
 #ifndef SQLITE_OMIT_TRIGGER
 #ifndef SQLITE_OMIT_TRIGGER
   int isView;                  /* True if attempting to delete from a view */
   int isView;                  /* True if attempting to delete from a view */
@@ -102765,7 +102774,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
   {
   {
     u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
     u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
-    if( pWhere && ExprHasProperty(pWhere, EP_Subquery) ) bComplex = 1;
+    if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
     wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
     wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
     if( HasRowid(pTab) ){
     if( HasRowid(pTab) ){
       /* For a rowid table, initialize the RowSet to an empty set */
       /* For a rowid table, initialize the RowSet to an empty set */

+ 3 - 3
SquiLu-ext/sqlite3.h

@@ -113,7 +113,7 @@ extern "C" {
 */
 */
 #define SQLITE_VERSION        "3.13.0"
 #define SQLITE_VERSION        "3.13.0"
 #define SQLITE_VERSION_NUMBER 3013000
 #define SQLITE_VERSION_NUMBER 3013000
-#define SQLITE_SOURCE_ID      "2016-05-03 19:40:54 1b43358f8979c4f18519e824e0d5f6ef2250107c"
+#define SQLITE_SOURCE_ID      "2016-05-04 21:06:21 71af9ac165ac02272f4886f69bd9ab4770fd7bb6"
 
 
 /*
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -8364,7 +8364,7 @@ struct sqlite3_rtree_query_info {
 /******** End of sqlite3rtree.h *********/
 /******** End of sqlite3rtree.h *********/
 /******** Begin file sqlite3session.h *********/
 /******** Begin file sqlite3session.h *********/
 
 
-#ifndef __SQLITESESSION_H_
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
 #define __SQLITESESSION_H_ 1
 #define __SQLITESESSION_H_ 1
 
 
 /*
 /*
@@ -9638,7 +9638,7 @@ int sqlite3changegroup_output_strm(sqlite3_changegroup*,
 }
 }
 #endif
 #endif
 
 
-#endif  /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
+#endif  /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
 
 
 /******** End of sqlite3session.h *********/
 /******** End of sqlite3session.h *********/
 /******** Begin file fts5.h *********/
 /******** Begin file fts5.h *********/