Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Rearrange some code in OP_JournalMode to avoid incorrect returns from subsequent invocations of "PRAGMA journal_mode" following an IO error. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | experimental |
Files: | files | file ages | folders |
SHA1: |
ce0a4a9b5f981d066822a9ae63740c91 |
User & Date: | dan 2010-06-18 16:13:45.000 |
Context
2010-06-18
| ||
18:59 | Add tests to pager1.test. (check-in: 582fca8919 user: dan tags: experimental) | |
16:13 | Rearrange some code in OP_JournalMode to avoid incorrect returns from subsequent invocations of "PRAGMA journal_mode" following an IO error. (check-in: ce0a4a9b5f user: dan tags: experimental) | |
11:10 | Change the implementation of the unix implementation of xAccess() so that it returns 0 (does not exist) to an SQLITE_ACCESS_EXISTS query on a file that exists but is zero bytes in size. (check-in: 077b0e5bcd user: dan tags: experimental) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
5244 5245 5246 5247 5248 5249 5250 | ** to PagerCloseWal() checkpoints and deletes the write-ahead-log ** file. An EXCLUSIVE lock may still be held on the database file ** after a successful return. */ rc = sqlite3PagerCloseWal(pPager); if( rc==SQLITE_OK ){ sqlite3PagerSetJournalMode(pPager, eNew); | < < < < < < < > > > > | 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 | ** to PagerCloseWal() checkpoints and deletes the write-ahead-log ** file. An EXCLUSIVE lock may still be held on the database file ** after a successful return. */ rc = sqlite3PagerCloseWal(pPager); if( rc==SQLITE_OK ){ sqlite3PagerSetJournalMode(pPager, eNew); } } /* Open a transaction on the database file. Regardless of the journal ** mode, this transaction always uses a rollback journal. */ assert( sqlite3BtreeIsInTrans(pBt)==0 ); if( rc==SQLITE_OK ){ rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); } } } #endif /* ifndef SQLITE_OMIT_WAL */ if( rc ){ if( rc==SQLITE_BUSY && pOp->p5!=0 ) rc = SQLITE_OK; eNew = eOld; } eNew = sqlite3PagerSetJournalMode(pPager, eNew); pOut = &aMem[pOp->p2]; pOut->flags = MEM_Str|MEM_Static|MEM_Term; pOut->z = (char *)sqlite3JournalModename(eNew); pOut->n = sqlite3Strlen30(pOut->z); pOut->enc = SQLITE_UTF8; |
︙ | ︙ |
Changes to test/walmode.test.
︙ | ︙ | |||
120 121 122 123 124 125 126 | list [file exists test.db-journal] [file exists test.db-wal] } {1 0} # Test that nothing goes wrong if a connection is prevented from changing # from WAL to rollback mode because a second connection has the database # open. Or from rollback to WAL. # | | | | | | > | | | | > | | | | | < | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | list [file exists test.db-journal] [file exists test.db-wal] } {1 0} # Test that nothing goes wrong if a connection is prevented from changing # from WAL to rollback mode because a second connection has the database # open. Or from rollback to WAL. # do_test walmode-4.6 { sqlite3 db2 test.db execsql { PRAGMA main.journal_mode } db2 } {delete} do_test walmode-4.7 { execsql { PRAGMA main.journal_mode = wal } db } {wal} do_test walmode-4.8 { execsql { SELECT * FROM t1 } db2 } {1 2} do_test walmode-4.9 { catchsql { PRAGMA journal_mode = delete } db } {1 {database is locked}} do_test walmode-4.10 { execsql { PRAGMA main.journal_mode } db } {wal} do_test walmode-4.11 { db2 close execsql { PRAGMA journal_mode = delete } db } {delete} do_test walmode-4.12 { execsql { PRAGMA main.journal_mode } db } {delete} do_test walmode-4.13 { list [file exists test.db-journal] [file exists test.db-wal] } {0 0} do_test walmode-4.14 { sqlite3 db2 test.db execsql { BEGIN; SELECT * FROM t1; } db2 } {1 2} do_test walmode-4.16 { execsql { PRAGMA main.journal_mode } db } {delete} do_test walmode-4.17 { execsql { PRAGMA main.journal_mode } db2 } {delete} do_test walmode-4.17 { catchsql { PRAGMA main.journal_mode = wal } db } {1 {database is locked}} do_test walmode-4.18 { execsql { PRAGMA main.journal_mode } db } {delete} catch { db close } catch { db2 close } # Test that it is not possible to change a temporary or in-memory database # to WAL mode. WAL mode is for persistent file-backed databases only. # # walmode-5.1.*: Try to set journal_mode=WAL on [sqlite3 db :memory:] database. # walmode-5.2.*: Try to set journal_mode=WAL on [sqlite3 db ""] database. # walmode-5.3.*: Try to set temp.journal_mode=WAL. # do_test walmode-5.1.1 { sqlite3 db :memory: execsql { PRAGMA main.journal_mode } } {memory} do_test walmode-5.1.2 { execsql { PRAGMA main.journal_mode = wal } } {memory} do_test walmode-5.1.3 { execsql { BEGIN; CREATE TABLE t1(a, b); |
︙ | ︙ |