aboutsummaryrefslogtreecommitdiff
path: root/src/pager.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2011-01-11 16:09:55 +0000
committerdan <dan@noemail.net>2011-01-11 16:09:55 +0000
commit9f4beedb6fcff907e90a5a2ba4d8c3fe3f9af27d (patch)
tree361fd6e474ca1e3cca23d43df83e670b618d54d1 /src/pager.c
parentbbd91944dd7fca17d19afe43ee9e5e982bf58b3a (diff)
downloadsqlite-9f4beedb6fcff907e90a5a2ba4d8c3fe3f9af27d.tar.gz
sqlite-9f4beedb6fcff907e90a5a2ba4d8c3fe3f9af27d.zip
If a rollback is attempted in journal_mode=off mode, force SQLite to discard the contents of the pager cache before processing any subsequent queries.
FossilOrigin-Name: ece7efce2733b4fdd71db385abebbde464ac8f30
Diffstat (limited to 'src/pager.c')
-rw-r--r--src/pager.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pager.c b/src/pager.c
index 5fcee322b..a4773e230 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -5926,7 +5926,17 @@ int sqlite3PagerRollback(Pager *pPager){
rc2 = pager_end_transaction(pPager, pPager->setMaster);
if( rc==SQLITE_OK ) rc = rc2;
}else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){
+ int eState = pPager->eState;
rc = pager_end_transaction(pPager, 0);
+ if( !MEMDB && eState>PAGER_WRITER_LOCKED ){
+ /* This can happen using journal_mode=off. Move the pager to the error
+ ** state to indicate that the contents of the cache may not be trusted.
+ ** Any active readers will get SQLITE_ABORT.
+ */
+ pPager->errCode = SQLITE_ABORT;
+ pPager->eState = PAGER_ERROR;
+ return rc;
+ }
}else{
rc = pager_playback(pPager, 0);
}