-2

I am porgramming a c# program with sqlite database for windows mobile 6.5 devices. Here is how I create a database:

SQLiteConnection cn = new SQLiteConnection("Data source =" + dbPath + ";PRAGMA journal_mode=WAL;");

My question is how can I know whether the SQLite database is working in WAL mode?

  • Literally the first two results from google: [Pragma statements supported by SQLite](https://sqlite.org/pragma.html) and [function to check if SQLite is using journal_mode=WAL or journal_mode=DELETE](http://stackoverflow.com/questions/21901814/function-to-check-if-sqlite-is-using-journal-mode-wal-or-journal-mode-delete) – mrun Mar 22 '17 at 05:42

1 Answers1

1

What do you mean by knowing whether the SQLite database is working in WAL mode? Can't you simply read the value of the journal mode pragma?

I think that would work, assuming your connection is opened and valid (though I did not test it).

string sql = "PRAGMA journal_mode";
SqlCommand cmd = new SqlCommand(sql, cn);
var journalMode = cmd.ExecuteScalar()

journalMode should be set to "WAL", or maybe a corresponding number.

Good luck! Antoine

Antoine Boisier-Michaud
  • 1,575
  • 2
  • 16
  • 30