Explorar o código

Update sqlite3

mingodad %!s(int64=8) %!d(string=hai) anos
pai
achega
5563b4e4d4
Modificáronse 2 ficheiros con 19 adicións e 13 borrados
  1. 18 12
      SquiLu-ext/sqlite3.c
  2. 1 1
      SquiLu-ext/sqlite3.h

+ 18 - 12
SquiLu-ext/sqlite3.c

@@ -400,7 +400,7 @@ extern "C" {
 */
 */
 #define SQLITE_VERSION        "3.18.0"
 #define SQLITE_VERSION        "3.18.0"
 #define SQLITE_VERSION_NUMBER 3018000
 #define SQLITE_VERSION_NUMBER 3018000
-#define SQLITE_SOURCE_ID      "2017-03-25 12:08:11 32be9c3faaafd736da3f49d475dc9279af4e4ba38070b60033d898345080acf0"
+#define SQLITE_SOURCE_ID      "2017-03-29 18:03:50 4a01880b62706c12d6f16f7c2b5c8b0dc67a9a8a0a48c5b42451e1a133e85611"
 
 
 /*
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -13965,7 +13965,7 @@ SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *);
 ** and the one-based values are used internally.
 ** and the one-based values are used internally.
 */
 */
 #ifndef SQLITE_DEFAULT_SYNCHRONOUS
 #ifndef SQLITE_DEFAULT_SYNCHRONOUS
-# define SQLITE_DEFAULT_SYNCHRONOUS (PAGER_SYNCHRONOUS_FULL-1)
+# define SQLITE_DEFAULT_SYNCHRONOUS 2
 #endif
 #endif
 #ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS
 #ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS
 # define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS
 # define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS
@@ -45472,8 +45472,7 @@ static int pcache1InitBulk(PCache1 *pCache){
   sqlite3EndBenignMalloc();
   sqlite3EndBenignMalloc();
   if( zBulk ){
   if( zBulk ){
     int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
     int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
-    int i;
-    for(i=0; i<nBulk; i++){
+    do{
       PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
       PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
       pX->page.pBuf = zBulk;
       pX->page.pBuf = zBulk;
       pX->page.pExtra = &pX[1];
       pX->page.pExtra = &pX[1];
@@ -45482,7 +45481,7 @@ static int pcache1InitBulk(PCache1 *pCache){
       pX->pNext = pCache->pFree;
       pX->pNext = pCache->pFree;
       pCache->pFree = pX;
       pCache->pFree = pX;
       zBulk += pCache->szAlloc;
       zBulk += pCache->szAlloc;
-    }
+    }while( --nBulk );
   }
   }
   return pCache->pFree!=0;
   return pCache->pFree!=0;
 }
 }
@@ -46398,7 +46397,7 @@ SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){
   int nFree = 0;
   int nFree = 0;
   assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
   assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
   assert( sqlite3_mutex_notheld(pcache1.mutex) );
   assert( sqlite3_mutex_notheld(pcache1.mutex) );
-  if( sqlite3GlobalConfig.nPage==0 ){
+  if( sqlite3GlobalConfig.pPage==0 ){
     PgHdr1 *p;
     PgHdr1 *p;
     pcache1EnterMutex(&pcache1.grp);
     pcache1EnterMutex(&pcache1.grp);
     while( (nReq<0 || nFree<nReq)
     while( (nReq<0 || nFree<nReq)
@@ -59684,6 +59683,7 @@ static void invalidateAllOverflowCache(BtShared *pBt){
 */
 */
 static void invalidateIncrblobCursors(
 static void invalidateIncrblobCursors(
   Btree *pBtree,          /* The database file to check */
   Btree *pBtree,          /* The database file to check */
+  Pgno pgnoRoot,          /* The table that might be changing */
   i64 iRow,               /* The rowid that might be changing */
   i64 iRow,               /* The rowid that might be changing */
   int isClearTable        /* True if all rows are being deleted */
   int isClearTable        /* True if all rows are being deleted */
 ){
 ){
@@ -59694,7 +59694,7 @@ static void invalidateIncrblobCursors(
   for(p=pBtree->pBt->pCursor; p; p=p->pNext){
   for(p=pBtree->pBt->pCursor; p; p=p->pNext){
     if( (p->curFlags & BTCF_Incrblob)!=0 ){
     if( (p->curFlags & BTCF_Incrblob)!=0 ){
       pBtree->hasIncrblobCur = 1;
       pBtree->hasIncrblobCur = 1;
-      if( isClearTable || p->info.nKey==iRow ){
+      if( p->pgnoRoot==pgnoRoot && (isClearTable || p->info.nKey==iRow) ){
         p->eState = CURSOR_INVALID;
         p->eState = CURSOR_INVALID;
       }
       }
     }
     }
@@ -59703,7 +59703,7 @@ static void invalidateIncrblobCursors(
 
 
 #else
 #else
   /* Stub function when INCRBLOB is omitted */
   /* Stub function when INCRBLOB is omitted */
-  #define invalidateIncrblobCursors(x,y,z)
+  #define invalidateIncrblobCursors(w,x,y,z)
 #endif /* SQLITE_OMIT_INCRBLOB */
 #endif /* SQLITE_OMIT_INCRBLOB */
 
 
 /*
 /*
@@ -67295,7 +67295,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
     assert( pX->pKey==0 );
     assert( pX->pKey==0 );
     /* If this is an insert into a table b-tree, invalidate any incrblob 
     /* If this is an insert into a table b-tree, invalidate any incrblob 
     ** cursors open on the row being replaced */
     ** cursors open on the row being replaced */
-    invalidateIncrblobCursors(p, pX->nKey, 0);
+    invalidateIncrblobCursors(p, pCur->pgnoRoot, pX->nKey, 0);
 
 
     /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing 
     /* If BTREE_SAVEPOSITION is set, the cursor must already be pointing 
     ** to a row with the same key as the new entry being inserted.  */
     ** to a row with the same key as the new entry being inserted.  */
@@ -67525,7 +67525,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
   /* If this is a delete operation to remove a row from a table b-tree,
   /* If this is a delete operation to remove a row from a table b-tree,
   ** invalidate any incrblob cursors open on the row being deleted.  */
   ** invalidate any incrblob cursors open on the row being deleted.  */
   if( pCur->pKeyInfo==0 ){
   if( pCur->pKeyInfo==0 ){
-    invalidateIncrblobCursors(p, pCur->info.nKey, 0);
+    invalidateIncrblobCursors(p, pCur->pgnoRoot, pCur->info.nKey, 0);
   }
   }
 
 
   /* Make the page containing the entry to be deleted writable. Then free any
   /* Make the page containing the entry to be deleted writable. Then free any
@@ -67852,7 +67852,7 @@ SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){
     /* Invalidate all incrblob cursors open on table iTable (assuming iTable
     /* Invalidate all incrblob cursors open on table iTable (assuming iTable
     ** is the root of a table b-tree - if it is not, the following call is
     ** is the root of a table b-tree - if it is not, the following call is
     ** a no-op).  */
     ** a no-op).  */
-    invalidateIncrblobCursors(p, 0, 1);
+    invalidateIncrblobCursors(p, (Pgno)iTable, 0, 1);
     rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
     rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);
   }
   }
   sqlite3BtreeLeave(p);
   sqlite3BtreeLeave(p);
@@ -112209,6 +112209,8 @@ struct sqlite3_api_routines {
   /* Version 3.14.0 and later */
   /* Version 3.14.0 and later */
   int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
   int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
   char *(*expanded_sql)(sqlite3_stmt*);
   char *(*expanded_sql)(sqlite3_stmt*);
+  /* Version 3.18.0 and later */
+  void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
 };
 };
 
 
 /*
 /*
@@ -112468,6 +112470,8 @@ typedef int (*sqlite3_loadext_entry)(
 /* Version 3.14.0 and later */
 /* Version 3.14.0 and later */
 #define sqlite3_trace_v2               sqlite3_api->trace_v2
 #define sqlite3_trace_v2               sqlite3_api->trace_v2
 #define sqlite3_expanded_sql           sqlite3_api->expanded_sql
 #define sqlite3_expanded_sql           sqlite3_api->expanded_sql
+/* Version 3.18.0 and later */
+#define sqlite3_set_last_insert_rowid  sqlite3_api->set_last_insert_rowid
 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
 
 
 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
@@ -112895,7 +112899,9 @@ static const sqlite3_api_routines sqlite3Apis = {
   sqlite3_system_errno,
   sqlite3_system_errno,
   /* Version 3.14.0 and later */
   /* Version 3.14.0 and later */
   sqlite3_trace_v2,
   sqlite3_trace_v2,
-  sqlite3_expanded_sql
+  sqlite3_expanded_sql,
+  /* Version 3.18.0 and later */
+  sqlite3_set_last_insert_rowid
 };
 };
 
 
 /*
 /*

+ 1 - 1
SquiLu-ext/sqlite3.h

@@ -123,7 +123,7 @@ extern "C" {
 */
 */
 #define SQLITE_VERSION        "3.18.0"
 #define SQLITE_VERSION        "3.18.0"
 #define SQLITE_VERSION_NUMBER 3018000
 #define SQLITE_VERSION_NUMBER 3018000
-#define SQLITE_SOURCE_ID      "2017-03-25 12:08:11 32be9c3faaafd736da3f49d475dc9279af4e4ba38070b60033d898345080acf0"
+#define SQLITE_SOURCE_ID      "2017-03-29 18:03:50 4a01880b62706c12d6f16f7c2b5c8b0dc67a9a8a0a48c5b42451e1a133e85611"
 
 
 /*
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
 ** CAPI3REF: Run-Time Library Version Numbers