mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
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
This commit is contained in:
13
src/attach.c
13
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).
|
||||
|
||||
Reference in New Issue
Block a user