diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pager.c | 13 | ||||
-rw-r--r-- | src/sqlite.h.in | 3 | ||||
-rw-r--r-- | src/vdbeaux.c | 5 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/pager.c b/src/pager.c index d4a07f7bf..7ff67bbb8 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.342 2007/05/24 09:41:21 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.343 2007/06/13 15:22:28 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -2941,6 +2941,9 @@ static int pagerAllocatePage(Pager *pPager, PgHdr **ppPg){ }else{ /* Recycle an existing page with a zero ref-count. */ rc = pager_recycle(pPager, 1, &pPg); + if( rc==SQLITE_BUSY ){ + rc = SQLITE_IOERR_BLOCKED; + } if( rc!=SQLITE_OK ){ goto pager_allocate_out; } @@ -3886,6 +3889,14 @@ int sqlite3PagerCommitPhaseOne(Pager *pPager, const char *zMaster, Pgno nTrunc){ } sync_exit: + if( rc==SQLITE_IOERR_BLOCKED ){ + /* pager_incr_changecounter() may attempt to obtain an exclusive + * lock to spill the cache and return IOERR_BLOCKED. But since + * there is no chance the cache is inconsistent, it's + * better to return SQLITE_BUSY. + */ + rc = SQLITE_BUSY; + } return rc; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f06f107c4..fa6830bd9 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.210 2007/05/24 09:44:11 danielk1977 Exp $ +** @(#) $Id: sqlite.h.in,v 1.211 2007/06/13 15:22:28 danielk1977 Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ @@ -231,6 +231,7 @@ int sqlite3_exec( #define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) #define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) #define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) +#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) /* ** Enable or disable the extended result codes. diff --git a/src/vdbeaux.c b/src/vdbeaux.c index c62b928fb..47bb7a081 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1391,7 +1391,10 @@ int sqlite3VdbeHalt(Vdbe *p){ ** proceed with the special handling. */ if( !isReadOnly ){ - if( p->rc==SQLITE_NOMEM && isStatement ){ + if( p->rc==SQLITE_IOERR_BLOCKED && isStatement ){ + xFunc = sqlite3BtreeRollbackStmt; + p->rc = SQLITE_BUSY; + } else if( p->rc==SQLITE_NOMEM && isStatement ){ xFunc = sqlite3BtreeRollbackStmt; }else{ /* We are forced to roll back the active transaction. Before doing |