diff options
author | drh <drh@noemail.net> | 2010-05-01 00:59:37 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-05-01 00:59:37 +0000 |
commit | d80b233850c12cd3b3e69bd797e7276a9bf6422f (patch) | |
tree | dc055c98dc7c40aaa40ed0cc7a2325a9e700f6f6 /src | |
parent | 27d52b2b195136c32997bb0f3b6471efc8227e78 (diff) | |
download | sqlite-d80b233850c12cd3b3e69bd797e7276a9bf6422f.tar.gz sqlite-d80b233850c12cd3b3e69bd797e7276a9bf6422f.zip |
Do not allow journal_mode=WAL if the underlying VFS does not support xShmOpen.
FossilOrigin-Name: d1fcccecdc8e9ac5d0d022914e51c545f4e1b04f
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index 60e72fadd..c6a38c5ba 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -5212,11 +5212,15 @@ case OP_Checkpoint: { ** ** Write a string containing the final journal-mode to register P2. */ -case OP_JournalMode: { +case OP_JournalMode: { /* out2-prerelease */ Btree *pBt; /* Btree to change journal mode of */ Pager *pPager; /* Pager associated with pBt */ - int eNew = pOp->p3; /* New journal mode */ + int eNew; /* New journal mode */ + int eOld; /* The old journal mode */ + const sqlite3_vfs *pVfs; /* The VFS of pPager */ + const char *zFilename; /* Name of database file for pPager */ + eNew = pOp->p3; assert( eNew==PAGER_JOURNALMODE_DELETE || eNew==PAGER_JOURNALMODE_TRUNCATE || eNew==PAGER_JOURNALMODE_PERSIST @@ -5230,15 +5234,21 @@ case OP_JournalMode: { pBt = db->aDb[pOp->p1].pBt; pPager = sqlite3BtreePager(pBt); + zFilename = sqlite3PagerFilename(pPager); + pVfs = sqlite3PagerVfs(pPager); - if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(pBt)) - && eNew==PAGER_JOURNALMODE_WAL + /* Do not allow a transition to journal_mode=WAL for a database + ** in temporary storage or if the VFS does not support xShmOpen. + */ + if( eNew==PAGER_JOURNALMODE_WAL + && (zFilename[0]==0 /* Temp file */ + || pVfs->iVersion<2 || pVfs->xShmOpen==0) /* No xShmOpen support */ ){ eNew = PAGER_JOURNALMODE_QUERY; } if( eNew!=PAGER_JOURNALMODE_QUERY ){ - int eOld = sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_QUERY); + eOld = sqlite3PagerJournalMode(pPager, PAGER_JOURNALMODE_QUERY); if( (eNew!=eOld) && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL) ){ |