Commit dd500934 authored by salix5's avatar salix5

Enforce rollback-journal mode for WAL-mode databases

parent d009f753
...@@ -100,10 +100,8 @@ bool DataManager::LoadDB(const char* file) { ...@@ -100,10 +100,8 @@ bool DataManager::LoadDB(const char* file) {
reader->read(buffer, sz); reader->read(buffer, sz);
reader->drop(); reader->drop();
// Workaround for sqlite3_deserialize() with possible WAL-mode databases:
// force rollback-journal mode by setting header bytes 18 and 19 to 0x01 // force rollback-journal mode by setting header bytes 18 and 19 to 0x01
// when the buffer is large enough, as recommended by SQLite documentation. if (sz >= 20 && buffer[18] == 0x02) {
if (sz >= 20) {
buffer[18] = 0x01; buffer[18] = 0x01;
buffer[19] = 0x01; buffer[19] = 0x01;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment