Fossil SCM
Upgrade SQLite to version 3.6.14.1.
Commit
3b76c0474e3386aa77394521f6ccfccc03746288
Parent
b4ec5750c690ab2…
2 files changed
+34
-21
+1
-1
+34
-21
| --- 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.6.14. By combining all the individual C code files into this | |
| 3 | +** version 3.6.14.1. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -15,11 +15,11 @@ | ||
| 15 | 15 | ** needed if you want a wrapper to interface SQLite with your choice of |
| 16 | 16 | ** programming language. The code for the "sqlite3" command-line shell |
| 17 | 17 | ** is also in a separate file. This file contains only code for the core |
| 18 | 18 | ** SQLite library. |
| 19 | 19 | ** |
| 20 | -** This amalgamation was generated on 2009-05-07 00:36:11 UTC. | |
| 20 | +** This amalgamation was generated on 2009-05-18 17:12:46 UTC. | |
| 21 | 21 | */ |
| 22 | 22 | #define SQLITE_CORE 1 |
| 23 | 23 | #define SQLITE_AMALGAMATION 1 |
| 24 | 24 | #ifndef SQLITE_PRIVATE |
| 25 | 25 | # define SQLITE_PRIVATE static |
| @@ -599,11 +599,11 @@ | ||
| 599 | 599 | ** |
| 600 | 600 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 601 | 601 | ** |
| 602 | 602 | ** Requirements: [H10011] [H10014] |
| 603 | 603 | */ |
| 604 | -#define SQLITE_VERSION "3.6.14" | |
| 604 | +#define SQLITE_VERSION "3.6.14.1" | |
| 605 | 605 | #define SQLITE_VERSION_NUMBER 3006014 |
| 606 | 606 | |
| 607 | 607 | /* |
| 608 | 608 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 609 | 609 | ** KEYWORDS: sqlite3_version |
| @@ -29091,11 +29091,11 @@ | ||
| 29091 | 29091 | ** sqlite3_pcache interface). It also contains part of the implementation |
| 29092 | 29092 | ** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. |
| 29093 | 29093 | ** If the default page cache implementation is overriden, then neither of |
| 29094 | 29094 | ** these two features are available. |
| 29095 | 29095 | ** |
| 29096 | -** @(#) $Id: pcache1.c,v 1.11 2009/04/14 18:44:39 aswift Exp $ | |
| 29096 | +** @(#) $Id: pcache1.c,v 1.11.2.1 2009/05/18 16:14:25 drh Exp $ | |
| 29097 | 29097 | */ |
| 29098 | 29098 | |
| 29099 | 29099 | |
| 29100 | 29100 | typedef struct PCache1 PCache1; |
| 29101 | 29101 | typedef struct PgHdr1 PgHdr1; |
| @@ -29434,25 +29434,29 @@ | ||
| 29434 | 29434 | */ |
| 29435 | 29435 | static void pcache1TruncateUnsafe( |
| 29436 | 29436 | PCache1 *pCache, |
| 29437 | 29437 | unsigned int iLimit |
| 29438 | 29438 | ){ |
| 29439 | + TESTONLY( int nPage = 0; ) /* Used to assert pCache->nPage is correct */ | |
| 29439 | 29440 | unsigned int h; |
| 29440 | 29441 | assert( sqlite3_mutex_held(pcache1.mutex) ); |
| 29441 | 29442 | for(h=0; h<pCache->nHash; h++){ |
| 29442 | 29443 | PgHdr1 **pp = &pCache->apHash[h]; |
| 29443 | 29444 | PgHdr1 *pPage; |
| 29444 | 29445 | while( (pPage = *pp)!=0 ){ |
| 29445 | 29446 | if( pPage->iKey>=iLimit ){ |
| 29446 | - pcache1PinPage(pPage); | |
| 29447 | + pCache->nPage--; | |
| 29447 | 29448 | *pp = pPage->pNext; |
| 29449 | + pcache1PinPage(pPage); | |
| 29448 | 29450 | pcache1FreePage(pPage); |
| 29449 | 29451 | }else{ |
| 29450 | 29452 | pp = &pPage->pNext; |
| 29453 | + TESTONLY( nPage++ ); | |
| 29451 | 29454 | } |
| 29452 | 29455 | } |
| 29453 | 29456 | } |
| 29457 | + assert( pCache->nPage==nPage ); | |
| 29454 | 29458 | } |
| 29455 | 29459 | |
| 29456 | 29460 | /******************************************************************************/ |
| 29457 | 29461 | /******** sqlite3_pcache Methods **********************************************/ |
| 29458 | 29462 | |
| @@ -30273,11 +30277,11 @@ | ||
| 30273 | 30277 | ** is separate from the database file. The pager also implements file |
| 30274 | 30278 | ** locking to prevent two processes from writing the same database |
| 30275 | 30279 | ** file simultaneously, or one process from reading the database while |
| 30276 | 30280 | ** another is writing. |
| 30277 | 30281 | ** |
| 30278 | -** @(#) $Id: pager.c,v 1.586 2009/05/06 18:57:10 shane Exp $ | |
| 30282 | +** @(#) $Id: pager.c,v 1.586.2.1 2009/05/18 17:11:31 drh Exp $ | |
| 30279 | 30283 | */ |
| 30280 | 30284 | #ifndef SQLITE_OMIT_DISKIO |
| 30281 | 30285 | |
| 30282 | 30286 | /* |
| 30283 | 30287 | ** Macros for troubleshooting. Normally turned off |
| @@ -33876,11 +33880,11 @@ | ||
| 33876 | 33880 | assert( (pPager->state==PAGER_SHARED) |
| 33877 | 33881 | || (pPager->exclusiveMode && pPager->state>PAGER_SHARED) |
| 33878 | 33882 | ); |
| 33879 | 33883 | } |
| 33880 | 33884 | |
| 33881 | - if( sqlite3PcachePagecount(pPager->pPCache)>0 ){ | |
| 33885 | + if( pPager->pBackup || sqlite3PcachePagecount(pPager->pPCache)>0 ){ | |
| 33882 | 33886 | /* The shared-lock has just been acquired on the database file |
| 33883 | 33887 | ** and there are already pages in the cache (from a previous |
| 33884 | 33888 | ** read or write transaction). Check to see if the database |
| 33885 | 33889 | ** has been modified. If the database has changed, flush the |
| 33886 | 33890 | ** cache. |
| @@ -44238,11 +44242,11 @@ | ||
| 44238 | 44242 | ** |
| 44239 | 44243 | ************************************************************************* |
| 44240 | 44244 | ** This file contains the implementation of the sqlite3_backup_XXX() |
| 44241 | 44245 | ** API functions and the related features. |
| 44242 | 44246 | ** |
| 44243 | -** $Id: backup.c,v 1.13 2009/03/16 13:19:36 danielk1977 Exp $ | |
| 44247 | +** $Id: backup.c,v 1.13.2.1 2009/05/18 17:11:31 drh Exp $ | |
| 44244 | 44248 | */ |
| 44245 | 44249 | |
| 44246 | 44250 | /* Macro to find the minimum of two numeric values. |
| 44247 | 44251 | */ |
| 44248 | 44252 | #ifndef MIN |
| @@ -44268,10 +44272,11 @@ | ||
| 44268 | 44272 | ** read by calls to backup_remaining() and backup_pagecount(). |
| 44269 | 44273 | */ |
| 44270 | 44274 | Pgno nRemaining; /* Number of pages left to copy */ |
| 44271 | 44275 | Pgno nPagecount; /* Total number of pages to copy */ |
| 44272 | 44276 | |
| 44277 | + int isAttached; /* True once backup has been registered with pager */ | |
| 44273 | 44278 | sqlite3_backup *pNext; /* Next backup associated with source pager */ |
| 44274 | 44279 | }; |
| 44275 | 44280 | |
| 44276 | 44281 | /* |
| 44277 | 44282 | ** THREAD SAFETY NOTES: |
| @@ -44381,10 +44386,11 @@ | ||
| 44381 | 44386 | p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb); |
| 44382 | 44387 | p->pDest = findBtree(pDestDb, pDestDb, zDestDb); |
| 44383 | 44388 | p->pDestDb = pDestDb; |
| 44384 | 44389 | p->pSrcDb = pSrcDb; |
| 44385 | 44390 | p->iNext = 1; |
| 44391 | + p->isAttached = 0; | |
| 44386 | 44392 | |
| 44387 | 44393 | if( 0==p->pSrc || 0==p->pDest ){ |
| 44388 | 44394 | /* One (or both) of the named databases did not exist. An error has |
| 44389 | 44395 | ** already been written into the pDestDb handle. All that is left |
| 44390 | 44396 | ** to do here is free the sqlite3_backup structure. |
| @@ -44391,22 +44397,11 @@ | ||
| 44391 | 44397 | */ |
| 44392 | 44398 | sqlite3_free(p); |
| 44393 | 44399 | p = 0; |
| 44394 | 44400 | } |
| 44395 | 44401 | } |
| 44396 | - | |
| 44397 | - /* If everything has gone as planned, attach the backup object to the | |
| 44398 | - ** source pager. The source pager calls BackupUpdate() and BackupRestart() | |
| 44399 | - ** to notify this module if the source file is modified mid-backup. | |
| 44400 | - */ | |
| 44401 | 44402 | if( p ){ |
| 44402 | - sqlite3_backup **pp; /* Pointer to head of pagers backup list */ | |
| 44403 | - sqlite3BtreeEnter(p->pSrc); | |
| 44404 | - pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); | |
| 44405 | - p->pNext = *pp; | |
| 44406 | - *pp = p; | |
| 44407 | - sqlite3BtreeLeave(p->pSrc); | |
| 44408 | 44403 | p->pSrc->nBackup++; |
| 44409 | 44404 | } |
| 44410 | 44405 | |
| 44411 | 44406 | sqlite3_mutex_leave(pDestDb->mutex); |
| 44412 | 44407 | sqlite3_mutex_leave(pSrcDb->mutex); |
| @@ -44494,10 +44489,23 @@ | ||
| 44494 | 44489 | if( rc==SQLITE_OK && iCurrent>iSize ){ |
| 44495 | 44490 | rc = sqlite3OsTruncate(pFile, iSize); |
| 44496 | 44491 | } |
| 44497 | 44492 | return rc; |
| 44498 | 44493 | } |
| 44494 | + | |
| 44495 | +/* | |
| 44496 | +** Register this backup object with the associated source pager for | |
| 44497 | +** callbacks when pages are changed or the cache invalidated. | |
| 44498 | +*/ | |
| 44499 | +static void attachBackupObject(sqlite3_backup *p){ | |
| 44500 | + sqlite3_backup **pp; | |
| 44501 | + assert( sqlite3BtreeHoldsMutex(p->pSrc) ); | |
| 44502 | + pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); | |
| 44503 | + p->pNext = *pp; | |
| 44504 | + *pp = p; | |
| 44505 | + p->isAttached = 1; | |
| 44506 | +} | |
| 44499 | 44507 | |
| 44500 | 44508 | /* |
| 44501 | 44509 | ** Copy nPage pages from the source b-tree to the destination. |
| 44502 | 44510 | */ |
| 44503 | 44511 | SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ |
| @@ -44564,10 +44572,12 @@ | ||
| 44564 | 44572 | if( rc==SQLITE_OK ){ |
| 44565 | 44573 | p->nPagecount = nSrcPage; |
| 44566 | 44574 | p->nRemaining = nSrcPage+1-p->iNext; |
| 44567 | 44575 | if( p->iNext>(Pgno)nSrcPage ){ |
| 44568 | 44576 | rc = SQLITE_DONE; |
| 44577 | + }else if( !p->isAttached ){ | |
| 44578 | + attachBackupObject(p); | |
| 44569 | 44579 | } |
| 44570 | 44580 | } |
| 44571 | 44581 | |
| 44572 | 44582 | if( rc==SQLITE_DONE ){ |
| 44573 | 44583 | const int nSrcPagesize = sqlite3BtreeGetPageSize(p->pSrc); |
| @@ -44696,16 +44706,18 @@ | ||
| 44696 | 44706 | sqlite3_mutex_enter(p->pDestDb->mutex); |
| 44697 | 44707 | } |
| 44698 | 44708 | |
| 44699 | 44709 | /* Detach this backup from the source pager. */ |
| 44700 | 44710 | if( p->pDestDb ){ |
| 44711 | + p->pSrc->nBackup--; | |
| 44712 | + } | |
| 44713 | + if( p->isAttached ){ | |
| 44701 | 44714 | pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); |
| 44702 | 44715 | while( *pp!=p ){ |
| 44703 | 44716 | pp = &(*pp)->pNext; |
| 44704 | 44717 | } |
| 44705 | 44718 | *pp = p->pNext; |
| 44706 | - p->pSrc->nBackup--; | |
| 44707 | 44719 | } |
| 44708 | 44720 | |
| 44709 | 44721 | /* If a transaction is still open on the Btree, roll it back. */ |
| 44710 | 44722 | sqlite3BtreeRollback(p->pDest); |
| 44711 | 44723 | |
| @@ -49984,11 +49996,11 @@ | ||
| 49984 | 49996 | ** documentation, headers files, or other derived files. The formatting |
| 49985 | 49997 | ** of the code in this file is, therefore, important. See other comments |
| 49986 | 49998 | ** in this file for details. If in doubt, do not deviate from existing |
| 49987 | 49999 | ** commenting and indentation practices when changing or adding code. |
| 49988 | 50000 | ** |
| 49989 | -** $Id: vdbe.c,v 1.842 2009/05/06 18:57:10 shane Exp $ | |
| 50001 | +** $Id: vdbe.c,v 1.842.2.1 2009/05/18 16:14:25 drh Exp $ | |
| 49990 | 50002 | */ |
| 49991 | 50003 | |
| 49992 | 50004 | /* |
| 49993 | 50005 | ** The following global variable is incremented every time a cursor |
| 49994 | 50006 | ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
| @@ -50706,10 +50718,11 @@ | ||
| 50706 | 50718 | assert( pOp->p2>0 ); |
| 50707 | 50719 | assert( pOp->p2<=p->nMem ); |
| 50708 | 50720 | pOut = &p->aMem[pOp->p2]; |
| 50709 | 50721 | sqlite3VdbeMemReleaseExternal(pOut); |
| 50710 | 50722 | pOut->flags = MEM_Null; |
| 50723 | + pOut->n = 0; | |
| 50711 | 50724 | }else |
| 50712 | 50725 | |
| 50713 | 50726 | /* Do common setup for opcodes marked with one of the following |
| 50714 | 50727 | ** combinations of properties. |
| 50715 | 50728 | ** |
| 50716 | 50729 |
| --- 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.6.14. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -15,11 +15,11 @@ | |
| 15 | ** needed if you want a wrapper to interface SQLite with your choice of |
| 16 | ** programming language. The code for the "sqlite3" command-line shell |
| 17 | ** is also in a separate file. This file contains only code for the core |
| 18 | ** SQLite library. |
| 19 | ** |
| 20 | ** This amalgamation was generated on 2009-05-07 00:36:11 UTC. |
| 21 | */ |
| 22 | #define SQLITE_CORE 1 |
| 23 | #define SQLITE_AMALGAMATION 1 |
| 24 | #ifndef SQLITE_PRIVATE |
| 25 | # define SQLITE_PRIVATE static |
| @@ -599,11 +599,11 @@ | |
| 599 | ** |
| 600 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 601 | ** |
| 602 | ** Requirements: [H10011] [H10014] |
| 603 | */ |
| 604 | #define SQLITE_VERSION "3.6.14" |
| 605 | #define SQLITE_VERSION_NUMBER 3006014 |
| 606 | |
| 607 | /* |
| 608 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 609 | ** KEYWORDS: sqlite3_version |
| @@ -29091,11 +29091,11 @@ | |
| 29091 | ** sqlite3_pcache interface). It also contains part of the implementation |
| 29092 | ** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. |
| 29093 | ** If the default page cache implementation is overriden, then neither of |
| 29094 | ** these two features are available. |
| 29095 | ** |
| 29096 | ** @(#) $Id: pcache1.c,v 1.11 2009/04/14 18:44:39 aswift Exp $ |
| 29097 | */ |
| 29098 | |
| 29099 | |
| 29100 | typedef struct PCache1 PCache1; |
| 29101 | typedef struct PgHdr1 PgHdr1; |
| @@ -29434,25 +29434,29 @@ | |
| 29434 | */ |
| 29435 | static void pcache1TruncateUnsafe( |
| 29436 | PCache1 *pCache, |
| 29437 | unsigned int iLimit |
| 29438 | ){ |
| 29439 | unsigned int h; |
| 29440 | assert( sqlite3_mutex_held(pcache1.mutex) ); |
| 29441 | for(h=0; h<pCache->nHash; h++){ |
| 29442 | PgHdr1 **pp = &pCache->apHash[h]; |
| 29443 | PgHdr1 *pPage; |
| 29444 | while( (pPage = *pp)!=0 ){ |
| 29445 | if( pPage->iKey>=iLimit ){ |
| 29446 | pcache1PinPage(pPage); |
| 29447 | *pp = pPage->pNext; |
| 29448 | pcache1FreePage(pPage); |
| 29449 | }else{ |
| 29450 | pp = &pPage->pNext; |
| 29451 | } |
| 29452 | } |
| 29453 | } |
| 29454 | } |
| 29455 | |
| 29456 | /******************************************************************************/ |
| 29457 | /******** sqlite3_pcache Methods **********************************************/ |
| 29458 | |
| @@ -30273,11 +30277,11 @@ | |
| 30273 | ** is separate from the database file. The pager also implements file |
| 30274 | ** locking to prevent two processes from writing the same database |
| 30275 | ** file simultaneously, or one process from reading the database while |
| 30276 | ** another is writing. |
| 30277 | ** |
| 30278 | ** @(#) $Id: pager.c,v 1.586 2009/05/06 18:57:10 shane Exp $ |
| 30279 | */ |
| 30280 | #ifndef SQLITE_OMIT_DISKIO |
| 30281 | |
| 30282 | /* |
| 30283 | ** Macros for troubleshooting. Normally turned off |
| @@ -33876,11 +33880,11 @@ | |
| 33876 | assert( (pPager->state==PAGER_SHARED) |
| 33877 | || (pPager->exclusiveMode && pPager->state>PAGER_SHARED) |
| 33878 | ); |
| 33879 | } |
| 33880 | |
| 33881 | if( sqlite3PcachePagecount(pPager->pPCache)>0 ){ |
| 33882 | /* The shared-lock has just been acquired on the database file |
| 33883 | ** and there are already pages in the cache (from a previous |
| 33884 | ** read or write transaction). Check to see if the database |
| 33885 | ** has been modified. If the database has changed, flush the |
| 33886 | ** cache. |
| @@ -44238,11 +44242,11 @@ | |
| 44238 | ** |
| 44239 | ************************************************************************* |
| 44240 | ** This file contains the implementation of the sqlite3_backup_XXX() |
| 44241 | ** API functions and the related features. |
| 44242 | ** |
| 44243 | ** $Id: backup.c,v 1.13 2009/03/16 13:19:36 danielk1977 Exp $ |
| 44244 | */ |
| 44245 | |
| 44246 | /* Macro to find the minimum of two numeric values. |
| 44247 | */ |
| 44248 | #ifndef MIN |
| @@ -44268,10 +44272,11 @@ | |
| 44268 | ** read by calls to backup_remaining() and backup_pagecount(). |
| 44269 | */ |
| 44270 | Pgno nRemaining; /* Number of pages left to copy */ |
| 44271 | Pgno nPagecount; /* Total number of pages to copy */ |
| 44272 | |
| 44273 | sqlite3_backup *pNext; /* Next backup associated with source pager */ |
| 44274 | }; |
| 44275 | |
| 44276 | /* |
| 44277 | ** THREAD SAFETY NOTES: |
| @@ -44381,10 +44386,11 @@ | |
| 44381 | p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb); |
| 44382 | p->pDest = findBtree(pDestDb, pDestDb, zDestDb); |
| 44383 | p->pDestDb = pDestDb; |
| 44384 | p->pSrcDb = pSrcDb; |
| 44385 | p->iNext = 1; |
| 44386 | |
| 44387 | if( 0==p->pSrc || 0==p->pDest ){ |
| 44388 | /* One (or both) of the named databases did not exist. An error has |
| 44389 | ** already been written into the pDestDb handle. All that is left |
| 44390 | ** to do here is free the sqlite3_backup structure. |
| @@ -44391,22 +44397,11 @@ | |
| 44391 | */ |
| 44392 | sqlite3_free(p); |
| 44393 | p = 0; |
| 44394 | } |
| 44395 | } |
| 44396 | |
| 44397 | /* If everything has gone as planned, attach the backup object to the |
| 44398 | ** source pager. The source pager calls BackupUpdate() and BackupRestart() |
| 44399 | ** to notify this module if the source file is modified mid-backup. |
| 44400 | */ |
| 44401 | if( p ){ |
| 44402 | sqlite3_backup **pp; /* Pointer to head of pagers backup list */ |
| 44403 | sqlite3BtreeEnter(p->pSrc); |
| 44404 | pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); |
| 44405 | p->pNext = *pp; |
| 44406 | *pp = p; |
| 44407 | sqlite3BtreeLeave(p->pSrc); |
| 44408 | p->pSrc->nBackup++; |
| 44409 | } |
| 44410 | |
| 44411 | sqlite3_mutex_leave(pDestDb->mutex); |
| 44412 | sqlite3_mutex_leave(pSrcDb->mutex); |
| @@ -44494,10 +44489,23 @@ | |
| 44494 | if( rc==SQLITE_OK && iCurrent>iSize ){ |
| 44495 | rc = sqlite3OsTruncate(pFile, iSize); |
| 44496 | } |
| 44497 | return rc; |
| 44498 | } |
| 44499 | |
| 44500 | /* |
| 44501 | ** Copy nPage pages from the source b-tree to the destination. |
| 44502 | */ |
| 44503 | SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ |
| @@ -44564,10 +44572,12 @@ | |
| 44564 | if( rc==SQLITE_OK ){ |
| 44565 | p->nPagecount = nSrcPage; |
| 44566 | p->nRemaining = nSrcPage+1-p->iNext; |
| 44567 | if( p->iNext>(Pgno)nSrcPage ){ |
| 44568 | rc = SQLITE_DONE; |
| 44569 | } |
| 44570 | } |
| 44571 | |
| 44572 | if( rc==SQLITE_DONE ){ |
| 44573 | const int nSrcPagesize = sqlite3BtreeGetPageSize(p->pSrc); |
| @@ -44696,16 +44706,18 @@ | |
| 44696 | sqlite3_mutex_enter(p->pDestDb->mutex); |
| 44697 | } |
| 44698 | |
| 44699 | /* Detach this backup from the source pager. */ |
| 44700 | if( p->pDestDb ){ |
| 44701 | pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); |
| 44702 | while( *pp!=p ){ |
| 44703 | pp = &(*pp)->pNext; |
| 44704 | } |
| 44705 | *pp = p->pNext; |
| 44706 | p->pSrc->nBackup--; |
| 44707 | } |
| 44708 | |
| 44709 | /* If a transaction is still open on the Btree, roll it back. */ |
| 44710 | sqlite3BtreeRollback(p->pDest); |
| 44711 | |
| @@ -49984,11 +49996,11 @@ | |
| 49984 | ** documentation, headers files, or other derived files. The formatting |
| 49985 | ** of the code in this file is, therefore, important. See other comments |
| 49986 | ** in this file for details. If in doubt, do not deviate from existing |
| 49987 | ** commenting and indentation practices when changing or adding code. |
| 49988 | ** |
| 49989 | ** $Id: vdbe.c,v 1.842 2009/05/06 18:57:10 shane Exp $ |
| 49990 | */ |
| 49991 | |
| 49992 | /* |
| 49993 | ** The following global variable is incremented every time a cursor |
| 49994 | ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
| @@ -50706,10 +50718,11 @@ | |
| 50706 | assert( pOp->p2>0 ); |
| 50707 | assert( pOp->p2<=p->nMem ); |
| 50708 | pOut = &p->aMem[pOp->p2]; |
| 50709 | sqlite3VdbeMemReleaseExternal(pOut); |
| 50710 | pOut->flags = MEM_Null; |
| 50711 | }else |
| 50712 | |
| 50713 | /* Do common setup for opcodes marked with one of the following |
| 50714 | ** combinations of properties. |
| 50715 | ** |
| 50716 |
| --- 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.6.14.1. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a one 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% are more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -15,11 +15,11 @@ | |
| 15 | ** needed if you want a wrapper to interface SQLite with your choice of |
| 16 | ** programming language. The code for the "sqlite3" command-line shell |
| 17 | ** is also in a separate file. This file contains only code for the core |
| 18 | ** SQLite library. |
| 19 | ** |
| 20 | ** This amalgamation was generated on 2009-05-18 17:12:46 UTC. |
| 21 | */ |
| 22 | #define SQLITE_CORE 1 |
| 23 | #define SQLITE_AMALGAMATION 1 |
| 24 | #ifndef SQLITE_PRIVATE |
| 25 | # define SQLITE_PRIVATE static |
| @@ -599,11 +599,11 @@ | |
| 599 | ** |
| 600 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 601 | ** |
| 602 | ** Requirements: [H10011] [H10014] |
| 603 | */ |
| 604 | #define SQLITE_VERSION "3.6.14.1" |
| 605 | #define SQLITE_VERSION_NUMBER 3006014 |
| 606 | |
| 607 | /* |
| 608 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 609 | ** KEYWORDS: sqlite3_version |
| @@ -29091,11 +29091,11 @@ | |
| 29091 | ** sqlite3_pcache interface). It also contains part of the implementation |
| 29092 | ** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. |
| 29093 | ** If the default page cache implementation is overriden, then neither of |
| 29094 | ** these two features are available. |
| 29095 | ** |
| 29096 | ** @(#) $Id: pcache1.c,v 1.11.2.1 2009/05/18 16:14:25 drh Exp $ |
| 29097 | */ |
| 29098 | |
| 29099 | |
| 29100 | typedef struct PCache1 PCache1; |
| 29101 | typedef struct PgHdr1 PgHdr1; |
| @@ -29434,25 +29434,29 @@ | |
| 29434 | */ |
| 29435 | static void pcache1TruncateUnsafe( |
| 29436 | PCache1 *pCache, |
| 29437 | unsigned int iLimit |
| 29438 | ){ |
| 29439 | TESTONLY( int nPage = 0; ) /* Used to assert pCache->nPage is correct */ |
| 29440 | unsigned int h; |
| 29441 | assert( sqlite3_mutex_held(pcache1.mutex) ); |
| 29442 | for(h=0; h<pCache->nHash; h++){ |
| 29443 | PgHdr1 **pp = &pCache->apHash[h]; |
| 29444 | PgHdr1 *pPage; |
| 29445 | while( (pPage = *pp)!=0 ){ |
| 29446 | if( pPage->iKey>=iLimit ){ |
| 29447 | pCache->nPage--; |
| 29448 | *pp = pPage->pNext; |
| 29449 | pcache1PinPage(pPage); |
| 29450 | pcache1FreePage(pPage); |
| 29451 | }else{ |
| 29452 | pp = &pPage->pNext; |
| 29453 | TESTONLY( nPage++ ); |
| 29454 | } |
| 29455 | } |
| 29456 | } |
| 29457 | assert( pCache->nPage==nPage ); |
| 29458 | } |
| 29459 | |
| 29460 | /******************************************************************************/ |
| 29461 | /******** sqlite3_pcache Methods **********************************************/ |
| 29462 | |
| @@ -30273,11 +30277,11 @@ | |
| 30277 | ** is separate from the database file. The pager also implements file |
| 30278 | ** locking to prevent two processes from writing the same database |
| 30279 | ** file simultaneously, or one process from reading the database while |
| 30280 | ** another is writing. |
| 30281 | ** |
| 30282 | ** @(#) $Id: pager.c,v 1.586.2.1 2009/05/18 17:11:31 drh Exp $ |
| 30283 | */ |
| 30284 | #ifndef SQLITE_OMIT_DISKIO |
| 30285 | |
| 30286 | /* |
| 30287 | ** Macros for troubleshooting. Normally turned off |
| @@ -33876,11 +33880,11 @@ | |
| 33880 | assert( (pPager->state==PAGER_SHARED) |
| 33881 | || (pPager->exclusiveMode && pPager->state>PAGER_SHARED) |
| 33882 | ); |
| 33883 | } |
| 33884 | |
| 33885 | if( pPager->pBackup || sqlite3PcachePagecount(pPager->pPCache)>0 ){ |
| 33886 | /* The shared-lock has just been acquired on the database file |
| 33887 | ** and there are already pages in the cache (from a previous |
| 33888 | ** read or write transaction). Check to see if the database |
| 33889 | ** has been modified. If the database has changed, flush the |
| 33890 | ** cache. |
| @@ -44238,11 +44242,11 @@ | |
| 44242 | ** |
| 44243 | ************************************************************************* |
| 44244 | ** This file contains the implementation of the sqlite3_backup_XXX() |
| 44245 | ** API functions and the related features. |
| 44246 | ** |
| 44247 | ** $Id: backup.c,v 1.13.2.1 2009/05/18 17:11:31 drh Exp $ |
| 44248 | */ |
| 44249 | |
| 44250 | /* Macro to find the minimum of two numeric values. |
| 44251 | */ |
| 44252 | #ifndef MIN |
| @@ -44268,10 +44272,11 @@ | |
| 44272 | ** read by calls to backup_remaining() and backup_pagecount(). |
| 44273 | */ |
| 44274 | Pgno nRemaining; /* Number of pages left to copy */ |
| 44275 | Pgno nPagecount; /* Total number of pages to copy */ |
| 44276 | |
| 44277 | int isAttached; /* True once backup has been registered with pager */ |
| 44278 | sqlite3_backup *pNext; /* Next backup associated with source pager */ |
| 44279 | }; |
| 44280 | |
| 44281 | /* |
| 44282 | ** THREAD SAFETY NOTES: |
| @@ -44381,10 +44386,11 @@ | |
| 44386 | p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb); |
| 44387 | p->pDest = findBtree(pDestDb, pDestDb, zDestDb); |
| 44388 | p->pDestDb = pDestDb; |
| 44389 | p->pSrcDb = pSrcDb; |
| 44390 | p->iNext = 1; |
| 44391 | p->isAttached = 0; |
| 44392 | |
| 44393 | if( 0==p->pSrc || 0==p->pDest ){ |
| 44394 | /* One (or both) of the named databases did not exist. An error has |
| 44395 | ** already been written into the pDestDb handle. All that is left |
| 44396 | ** to do here is free the sqlite3_backup structure. |
| @@ -44391,22 +44397,11 @@ | |
| 44397 | */ |
| 44398 | sqlite3_free(p); |
| 44399 | p = 0; |
| 44400 | } |
| 44401 | } |
| 44402 | if( p ){ |
| 44403 | p->pSrc->nBackup++; |
| 44404 | } |
| 44405 | |
| 44406 | sqlite3_mutex_leave(pDestDb->mutex); |
| 44407 | sqlite3_mutex_leave(pSrcDb->mutex); |
| @@ -44494,10 +44489,23 @@ | |
| 44489 | if( rc==SQLITE_OK && iCurrent>iSize ){ |
| 44490 | rc = sqlite3OsTruncate(pFile, iSize); |
| 44491 | } |
| 44492 | return rc; |
| 44493 | } |
| 44494 | |
| 44495 | /* |
| 44496 | ** Register this backup object with the associated source pager for |
| 44497 | ** callbacks when pages are changed or the cache invalidated. |
| 44498 | */ |
| 44499 | static void attachBackupObject(sqlite3_backup *p){ |
| 44500 | sqlite3_backup **pp; |
| 44501 | assert( sqlite3BtreeHoldsMutex(p->pSrc) ); |
| 44502 | pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); |
| 44503 | p->pNext = *pp; |
| 44504 | *pp = p; |
| 44505 | p->isAttached = 1; |
| 44506 | } |
| 44507 | |
| 44508 | /* |
| 44509 | ** Copy nPage pages from the source b-tree to the destination. |
| 44510 | */ |
| 44511 | SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ |
| @@ -44564,10 +44572,12 @@ | |
| 44572 | if( rc==SQLITE_OK ){ |
| 44573 | p->nPagecount = nSrcPage; |
| 44574 | p->nRemaining = nSrcPage+1-p->iNext; |
| 44575 | if( p->iNext>(Pgno)nSrcPage ){ |
| 44576 | rc = SQLITE_DONE; |
| 44577 | }else if( !p->isAttached ){ |
| 44578 | attachBackupObject(p); |
| 44579 | } |
| 44580 | } |
| 44581 | |
| 44582 | if( rc==SQLITE_DONE ){ |
| 44583 | const int nSrcPagesize = sqlite3BtreeGetPageSize(p->pSrc); |
| @@ -44696,16 +44706,18 @@ | |
| 44706 | sqlite3_mutex_enter(p->pDestDb->mutex); |
| 44707 | } |
| 44708 | |
| 44709 | /* Detach this backup from the source pager. */ |
| 44710 | if( p->pDestDb ){ |
| 44711 | p->pSrc->nBackup--; |
| 44712 | } |
| 44713 | if( p->isAttached ){ |
| 44714 | pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); |
| 44715 | while( *pp!=p ){ |
| 44716 | pp = &(*pp)->pNext; |
| 44717 | } |
| 44718 | *pp = p->pNext; |
| 44719 | } |
| 44720 | |
| 44721 | /* If a transaction is still open on the Btree, roll it back. */ |
| 44722 | sqlite3BtreeRollback(p->pDest); |
| 44723 | |
| @@ -49984,11 +49996,11 @@ | |
| 49996 | ** documentation, headers files, or other derived files. The formatting |
| 49997 | ** of the code in this file is, therefore, important. See other comments |
| 49998 | ** in this file for details. If in doubt, do not deviate from existing |
| 49999 | ** commenting and indentation practices when changing or adding code. |
| 50000 | ** |
| 50001 | ** $Id: vdbe.c,v 1.842.2.1 2009/05/18 16:14:25 drh Exp $ |
| 50002 | */ |
| 50003 | |
| 50004 | /* |
| 50005 | ** The following global variable is incremented every time a cursor |
| 50006 | ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
| @@ -50706,10 +50718,11 @@ | |
| 50718 | assert( pOp->p2>0 ); |
| 50719 | assert( pOp->p2<=p->nMem ); |
| 50720 | pOut = &p->aMem[pOp->p2]; |
| 50721 | sqlite3VdbeMemReleaseExternal(pOut); |
| 50722 | pOut->flags = MEM_Null; |
| 50723 | pOut->n = 0; |
| 50724 | }else |
| 50725 | |
| 50726 | /* Do common setup for opcodes marked with one of the following |
| 50727 | ** combinations of properties. |
| 50728 | ** |
| 50729 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -97,11 +97,11 @@ | ||
| 97 | 97 | ** |
| 98 | 98 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 99 | 99 | ** |
| 100 | 100 | ** Requirements: [H10011] [H10014] |
| 101 | 101 | */ |
| 102 | -#define SQLITE_VERSION "3.6.14" | |
| 102 | +#define SQLITE_VERSION "3.6.14.1" | |
| 103 | 103 | #define SQLITE_VERSION_NUMBER 3006014 |
| 104 | 104 | |
| 105 | 105 | /* |
| 106 | 106 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 107 | 107 | ** KEYWORDS: sqlite3_version |
| 108 | 108 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -97,11 +97,11 @@ | |
| 97 | ** |
| 98 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 99 | ** |
| 100 | ** Requirements: [H10011] [H10014] |
| 101 | */ |
| 102 | #define SQLITE_VERSION "3.6.14" |
| 103 | #define SQLITE_VERSION_NUMBER 3006014 |
| 104 | |
| 105 | /* |
| 106 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 107 | ** KEYWORDS: sqlite3_version |
| 108 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -97,11 +97,11 @@ | |
| 97 | ** |
| 98 | ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. |
| 99 | ** |
| 100 | ** Requirements: [H10011] [H10014] |
| 101 | */ |
| 102 | #define SQLITE_VERSION "3.6.14.1" |
| 103 | #define SQLITE_VERSION_NUMBER 3006014 |
| 104 | |
| 105 | /* |
| 106 | ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100> |
| 107 | ** KEYWORDS: sqlite3_version |
| 108 |