3

How to open SQLite connection in WAL mode in iOS. Normally I am using sqlite3_open_v2 to open it.

Here is the C# answer but how to do that in Swift?

How to open SQLite connection in WAL mode

Goppinath
  • 10,569
  • 4
  • 22
  • 45

2 Answers2

9

You can run the pragma statement for WAL mode after opening the database.

sqlite3_exec(dbHandle, "PRAGMA journal_mode=WAL;", 0, 0, 0);
firstinq
  • 772
  • 6
  • 13
  • Sorry I marked @CL's answer as the right answer because it explains more. But I up vote your answer too. Thank you. – Goppinath Jul 21 '17 at 17:00
6

The documentation says:

The WAL journaling mode is persistent; after being set it stays in effect across multiple database connections and after closing and reopening the database.

So it is enough that PRAGMA journal_mode=WAL is executed once after creating the database file. Nothing special is needed when opening it later.

CL.
  • 173,858
  • 17
  • 217
  • 259