aboutsummaryrefslogtreecommitdiff
path: root/src/attach.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-05-06 21:37:22 +0000
committerdrh <drh@noemail.net>2010-05-06 21:37:22 +0000
commit3ebaee9633db3e3d97cde82922bb50d95e731618 (patch)
treedc99485ca330d31387f767b08e7f4fd276588b77 /src/attach.c
parent72af0774f9a2d75e8e2dccb0fb15626babf8a875 (diff)
downloadsqlite-3ebaee9633db3e3d97cde82922bb50d95e731618.tar.gz
sqlite-3ebaee9633db3e3d97cde82922bb50d95e731618.zip
The PRAGMA journal_mode=WAL; command now makes WAL the default journal mode
for new databases added with ATTACH, so the behavior is consistent with the other journal modes. FossilOrigin-Name: c3520460a4a39fc5e981c3033068ffbb422a4af2
Diffstat (limited to 'src/attach.c')
-rw-r--r--src/attach.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/attach.c b/src/attach.c
index 6f0acef94..2b57793f9 100644
--- a/src/attach.c
+++ b/src/attach.c
@@ -143,7 +143,8 @@ static void attachFunc(
}
pPager = sqlite3BtreePager(aNew->pBt);
sqlite3PagerLockingMode(pPager, db->dfltLockMode);
- sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
+ /* journal_mode set by the OP_JournalMode opcode that will following
+ ** the OP_Function opcode that invoked this function. */
sqlite3BtreeSecureDelete(aNew->pBt,
sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );
}
@@ -339,6 +340,16 @@ static void codeAttach(
sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg));
sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF);
+ if( type==SQLITE_ATTACH ){
+ /* On an attach, also set the journal mode. Note that
+ ** sqlite3VdbeUsesBtree() is not call here since the iDb index
+ ** will be out of range prior to the new database being attached.
+ ** The OP_JournalMode opcode will all sqlite3VdbeUsesBtree() for us.
+ */
+ sqlite3VdbeAddOp3(v, OP_JournalMode, db->nDb, regArgs+3,
+ db->dfltJournalMode);
+ }
+
/* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this
** statement only). For DETACH, set it to false (expire all existing
** statements).