1
0
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:
drh
2010-05-06 21:37:22 +00:00
parent 72af0774f9
commit 3ebaee9633
6 changed files with 56 additions and 22 deletions

View File

@@ -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).