MFB: libsqlite3 3.6.14.1 upgrade

This commit is contained in:
Ilia Alshanetsky 2009-05-19 18:44:00 +00:00
parent da62d8d02e
commit 761422a4a7
2 changed files with 31 additions and 18 deletions

View file

@ -4,7 +4,7 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.6.14. By combining all the individual C code files into this
** version 3.6.14.1. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a one translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@ -21,7 +21,7 @@
** is also in a separate file. This file contains only code for the core
** SQLite library.
**
** This amalgamation was generated on 2009-05-07 01:56:00 UTC.
** This amalgamation was generated on 2009-05-18 18:33:54 UTC.
*/
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
@ -601,7 +601,7 @@ extern "C" {
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION "3.6.14"
#define SQLITE_VERSION "3.6.14.1"
#define SQLITE_VERSION_NUMBER 3006014
/*
@ -29437,6 +29437,7 @@ static void pcache1TruncateUnsafe(
PCache1 *pCache,
unsigned int iLimit
){
TESTONLY( int nPage = 0; ) /* Used to assert pCache->nPage is correct */
unsigned int h;
assert( sqlite3_mutex_held(pcache1.mutex) );
for(h=0; h<pCache->nHash; h++){
@ -29444,14 +29445,17 @@ static void pcache1TruncateUnsafe(
PgHdr1 *pPage;
while( (pPage = *pp)!=0 ){
if( pPage->iKey>=iLimit ){
pcache1PinPage(pPage);
pCache->nPage--;
*pp = pPage->pNext;
pcache1PinPage(pPage);
pcache1FreePage(pPage);
}else{
pp = &pPage->pNext;
TESTONLY( nPage++ );
}
}
}
assert( pCache->nPage==nPage );
}
/******************************************************************************/
@ -33879,7 +33883,7 @@ static int pagerSharedLock(Pager *pPager){
);
}
if( sqlite3PcachePagecount(pPager->pPCache)>0 ){
if( pPager->pBackup || sqlite3PcachePagecount(pPager->pPCache)>0 ){
/* The shared-lock has just been acquired on the database file
** and there are already pages in the cache (from a previous
** read or write transaction). Check to see if the database
@ -44271,6 +44275,7 @@ struct sqlite3_backup {
Pgno nRemaining; /* Number of pages left to copy */
Pgno nPagecount; /* Total number of pages to copy */
int isAttached; /* True once backup has been registered with pager */
sqlite3_backup *pNext; /* Next backup associated with source pager */
};
@ -44384,6 +44389,7 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init(
p->pDestDb = pDestDb;
p->pSrcDb = pSrcDb;
p->iNext = 1;
p->isAttached = 0;
if( 0==p->pSrc || 0==p->pDest ){
/* One (or both) of the named databases did not exist. An error has
@ -44394,18 +44400,7 @@ SQLITE_API sqlite3_backup *sqlite3_backup_init(
p = 0;
}
}
/* If everything has gone as planned, attach the backup object to the
** source pager. The source pager calls BackupUpdate() and BackupRestart()
** to notify this module if the source file is modified mid-backup.
*/
if( p ){
sqlite3_backup **pp; /* Pointer to head of pagers backup list */
sqlite3BtreeEnter(p->pSrc);
pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
p->pNext = *pp;
*pp = p;
sqlite3BtreeLeave(p->pSrc);
p->pSrc->nBackup++;
}
@ -44498,6 +44493,19 @@ static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){
return rc;
}
/*
** Register this backup object with the associated source pager for
** callbacks when pages are changed or the cache invalidated.
*/
static void attachBackupObject(sqlite3_backup *p){
sqlite3_backup **pp;
assert( sqlite3BtreeHoldsMutex(p->pSrc) );
pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
p->pNext = *pp;
*pp = p;
p->isAttached = 1;
}
/*
** Copy nPage pages from the source b-tree to the destination.
*/
@ -44567,6 +44575,8 @@ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){
p->nRemaining = nSrcPage+1-p->iNext;
if( p->iNext>(Pgno)nSrcPage ){
rc = SQLITE_DONE;
}else if( !p->isAttached ){
attachBackupObject(p);
}
}
@ -44699,12 +44709,14 @@ SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){
/* Detach this backup from the source pager. */
if( p->pDestDb ){
p->pSrc->nBackup--;
}
if( p->isAttached ){
pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));
while( *pp!=p ){
pp = &(*pp)->pNext;
}
*pp = p->pNext;
p->pSrc->nBackup--;
}
/* If a transaction is still open on the Btree, roll it back. */
@ -50709,6 +50721,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
pOut = &p->aMem[pOp->p2];
sqlite3VdbeMemReleaseExternal(pOut);
pOut->flags = MEM_Null;
pOut->n = 0;
}else
/* Do common setup for opcodes marked with one of the following