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

@@ -531,7 +531,8 @@ void sqlite3Pragma(
/*
** PRAGMA [database.]journal_mode
** PRAGMA [database.]journal_mode = (delete|persist|off|truncate|memory)
** PRAGMA [database.]journal_mode =
** (delete|persist|off|truncate|memory|wal|off)
*/
if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
@@ -562,15 +563,14 @@ void sqlite3Pragma(
}else{
int ii;
if( pId2->n==0 && eMode!=PAGER_JOURNALMODE_WAL ){
/* This indicates that no database name was specified as part
** of the PRAGMA command. In this case the journal-mode must be
** set on all attached databases, as well as the main db file.
if( pId2->n==0 ){
/* When there is no database name before the "journal_mode" keyword
** in the PRAGMA, then the journal-mode will be set on
** all attached databases, as well as the main db file.
**
** Also, the sqlite3.dfltJournalMode variable is set so that
** any subsequently attached databases also use the specified
** journal mode. Except, the default journal mode is never set
** to WAL.
** journal mode.
*/
db->dfltJournalMode = (u8)eMode;
}