-C Merged\sexperimental\scrashsql()\sinto\strunk.
-D 2010-07-08T16:50:08
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Change\sthe\sjournal_mode\spragma\sto\sremove\sthe\s"default\sjournal\smode"\sconcept.\nThe\sjournal_mode\spragma\sonly\seffects\scurrently\sattached\sdatabases\sand\sdoes\s\nnot\schange\sthe\sbehavior\sof\sfuture\sattachments.
+D 2010-07-08T17:40:38
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c4270a1cd7cd70a263b7e96a258aa90e9c3618eb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
F src/alter.c a9ff6f14b3935502537e90194b66c7bc79bed317
F src/analyze.c 3457a2af126eb78f20ad239c225a2c8ed61b78b6
-F src/attach.c 47b230972b52580e3b3bd6ee69e55f3a043b615b
+F src/attach.c 17bec1f18254d9341369f20f90ba24ce35d20d10
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed
F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0
F src/btree.c 9a214e6141555b183216b73ace058c7a499cdbe2
F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a
F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291
-F src/build.c 31830208adbd6f97bef2517531ed70954a306fde
+F src/build.c 559d38b48f79bc92370c082f4606eefe1e8f94ac
F src/callback.c 01843bdf4b0420fd28046525d150fcd9802931a9
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c 4f3aadad62c6c9f0d4e5a96718516ac4e3c598df
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
F src/pcache1.c 3a7c28f46a61b43ff0b5c087a7983c154f4b264c
-F src/pragma.c ca1a5634806bf53de653b1fe207b6eeedf3e3aa7
+F src/pragma.c 4a79269ea6f86150fb8e44688c753989fc7238dd
F src/prepare.c f045aeff869d6409a2eae2fe08f7dc2df9528195
F src/printf.c 5f5b65a83e63f2096a541a340722a509fa0240a7
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/shell.c fd4ccdb37c3b68de0623eb938a649e0990710714
F src/sqlite.h.in 26bcfc3084a2e4b4debba311c59ae434820c8e98
F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89
-F src/sqliteInt.h 72de24dfe07f452ac8a5c8c5eb1ce97ea6eff751
+F src/sqliteInt.h 8eb5d1c63fff70ed30f4b861aeaf8485e663129c
F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3
F src/status.c 4df6fe7dce2d256130b905847c6c60055882bdbe
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685
F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b
F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f
-F src/vdbe.c 046cd38df1ac63545ab1439eecf02d7b0222fb2c
+F src/vdbe.c 14d3e04d13e1c79ab62674e06b0d0a8ed70f9e75
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d
F test/crash5.test 80a2f7073381837fc082435c97df52a830abcd80
F test/crash6.test 9c730cf06335003cb1f5cfceddacd044155336e0
F test/crash7.test e20a7b9ee1d16eaef7c94a4cb7ed2191b4d05970
-F test/crash8.test 6666f5fff4734e43d6c6d66798fa607f54d96bf3
+F test/crash8.test 76b95451933fe172ce8e26bff22d5c663c8ae473
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/journal2.test c59fec987580f74b94aa0b98f7f2402302424ba5
-F test/jrnlmode.test 17881937be86841ad80431699222bf84aa01172a
+F test/jrnlmode.test 2d5a8b6d68de8512f522532731d90ca96912f3b7
F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00
F test/jrnlmode3.test cfcdb12b90e640a23b92785a002d96c0624c8710
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
-F test/walmode.test 0c0687ca696762e4fb5ede3a616d1991d1477614
+F test/walmode.test 5dc3008ef71988ecdd949ea16e5750e325b92b54
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 0bfcf3bcd77acab48344dde87cecb01e877f1a19 8a5811ea80e8415f9ba6b1d9390ed723840402c3
-R 88877c3276846acf4750cafa5881b8d1
-U shaneh
-Z 9cb1c2ec419c9dc18b8023733894c905
+P 01b575ff1aa512f34be78f9d67b6caaf825e5820
+R a13709e283d8f3bc4026d3b776e078a5
+U drh
+Z 41a4fbd69a763fa1a99cac4fa52e1ff6
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFMNg2ZoxKgR168RlERAkLDAJ99AtJN29CjABohWCbCazMk9tpTNgCeI1C1
+EIBDh09s9ogDgoFqn2S4k2A=
+=qqB+
+-----END PGP SIGNATURE-----
-01b575ff1aa512f34be78f9d67b6caaf825e5820
\ No newline at end of file
+e396184cd3bdb96e29ac33af5d1f631cac553341
\ No newline at end of file
}
pPager = sqlite3BtreePager(aNew->pBt);
sqlite3PagerLockingMode(pPager, db->dfltLockMode);
- /* 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) );
}
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);
- sqlite3VdbeChangeP5(v, 1);
- }
-
/* 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).
db->mallocFailed = 1;
return 1;
}
- sqlite3PagerSetJournalMode(sqlite3BtreePager(pBt), db->dfltJournalMode);
}
return 0;
}
** (delete|persist|off|truncate|memory|wal|off)
*/
if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
- int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
+ int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */
+ int ii; /* Loop counter */
+ /* Force the schema to be loaded on all databases. This cases all
+ ** database files to be opened and the journal_modes set. */
if( sqlite3ReadSchema(pParse) ){
goto pragma_out;
}
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC);
if( zRight==0 ){
+ /* If there is no "=MODE" part of the pragma, do a query for the
+ ** current mode */
eMode = PAGER_JOURNALMODE_QUERY;
}else{
const char *zMode;
if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
}
if( !zMode ){
+ /* If the "=MODE" part does not match any known journal mode,
+ ** then do a query */
eMode = PAGER_JOURNALMODE_QUERY;
}
}
- if( pId2->n==0 && eMode==PAGER_JOURNALMODE_QUERY ){
- /* Simple "PRAGMA journal_mode;" statement. This is a query for
- ** the current default journal mode (which may be different to
- ** the journal-mode of the main database).
- */
- eMode = db->dfltJournalMode;
- sqlite3VdbeAddOp2(v, OP_String8, 0, 1);
- sqlite3VdbeChangeP4(v, -1, sqlite3JournalModename(eMode), P4_STATIC);
- }else{
- int ii;
-
- 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.
- */
- db->dfltJournalMode = (u8)eMode;
- }
-
- for(ii=db->nDb-1; ii>=0; ii--){
- if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
- sqlite3VdbeUsesBtree(v, ii);
- sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);
- }
+ if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
+ /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */
+ iDb = 0;
+ pId2->n = 1;
+ }
+ for(ii=db->nDb-1; ii>=0; ii--){
+ if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
+ sqlite3VdbeUsesBtree(v, ii);
+ sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);
}
}
-
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
}else
u8 temp_store; /* 1: file 2: memory 0: default */
u8 mallocFailed; /* True if we have seen a malloc failure */
u8 dfltLockMode; /* Default locking-mode for attached dbs */
- u8 dfltJournalMode; /* Default journal mode for attached dbs */
signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */
u8 suppressErr; /* Do not issue error messages if true */
int nextPagesize; /* Pagesize after VACUUM if >0 */
** If changing into or out of WAL mode the procedure is more complicated.
**
** Write a string containing the final journal-mode to register P2.
-**
-** If an attempt to change in to or out of WAL mode fails because another
-** connection also has the same database open, then an SQLITE_BUSY error
-** is raised if P5==0, or of P5!=0 the journal mode changed is skipped
-** without signaling the error.
*/
case OP_JournalMode: { /* out2-prerelease */
Btree *pBt; /* Btree to change journal mode of */
#endif /* ifndef SQLITE_OMIT_WAL */
if( rc ){
- if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK;
eNew = eOld;
}
eNew = sqlite3PagerSetJournalMode(pPager, eNew);
INSERT INTO ab VALUES(6, NULL);
UPDATE ab SET b = randstr(1000,1000);
ATTACH 'test2.db' AS aux;
+ PRAGMA aux.journal_mode = persist;
CREATE TABLE aux.ab(a, b);
INSERT INTO aux.ab SELECT * FROM main.ab;
execsql {
PRAGMA journal_mode;
}
- } {persist}
+ } {off}
do_test jrnlmode-1.12 {
execsql {
ATTACH ':memory:' as aux2;
do_test jrnlmode-5.3 {
execsql {
ATTACH 'test2.db' AS aux;
+ PRAGMA aux.journal_mode=persist;
PRAGMA aux.journal_size_limit;
}
- } {-1}
+ } {persist -1}
do_test jrnlmode-5.4.1 {
execsql { PRAGMA aux.journal_size_limit = 999999999999 }
} {999999999999}
} {10240}
do_test jrnlmode-5.8 {
- execsql { ATTACH 'test3.db' AS aux2 }
- } {}
+ execsql {
+ ATTACH 'test3.db' AS aux2;
+ PRAGMA aux2.journal_mode=persist;
+ }
+ } {persist}
do_test jrnlmode-5.9 {
execsql {
}
} {wal}
foreach {tn sql result} {
- 1 "PRAGMA journal_mode" delete
+ 1 "PRAGMA journal_mode" wal
2 "PRAGMA main.journal_mode" wal
3 "PRAGMA journal_mode = delete" delete
4 "PRAGMA journal_mode" delete
5 "PRAGMA main.journal_mode" delete
6 "PRAGMA journal_mode = wal" wal
- 7 "PRAGMA journal_mode" delete
+ 7 "PRAGMA journal_mode" wal
8 "PRAGMA main.journal_mode" wal
- 9 "PRAGMA journal_mode" delete
+ 9 "PRAGMA journal_mode" wal
10 "PRAGMA main.journal_mode" wal
11 "PRAGMA main.journal_mode = delete" delete
12 "PRAGMA journal_mode" delete
13 "PRAGMA main.journal_mode" delete
14 "PRAGMA main.journal_mode = wal" wal
- 15 "PRAGMA journal_mode" delete
+ 15 "PRAGMA journal_mode" wal
16 "PRAGMA main.journal_mode" wal
} {
do_test walmode-7.$tn {
CREATE TABLE two.t2(a, b);
} {wal}
do_execsql_test walmode-8.2 { PRAGMA main.journal_mode } {wal}
-do_execsql_test walmode-8.3 { PRAGMA two.journal_mode } {wal}
+do_execsql_test walmode-8.3 { PRAGMA two.journal_mode } {delete}
do_execsql_test walmode-8.4 { PRAGMA two.journal_mode = DELETE } {delete}
db close
do_execsql_test walmode-8.9 { PRAGMA two.journal_mode } {delete}
do_execsql_test walmode-8.10 { INSERT INTO t1 DEFAULT VALUES } {}
do_execsql_test walmode-8.11 { PRAGMA main.journal_mode } {wal}
-do_execsql_test walmode-8.12 { PRAGMA journal_mode } {delete}
+do_execsql_test walmode-8.12 { PRAGMA journal_mode } {wal}
+
+# Change to WAL mode on test2.db and make sure (in the tests that follow)
+# that this mode change persists.
+do_test walmode-8.x1 {
+ execsql {
+ PRAGMA two.journal_mode=WAL;
+ PRAGMA two.journal_mode;
+ }
+} {wal wal}
db close
sqlite3 db test.db
db2 close
finish_test
-