How to open SQLite connection in WAL mode

后端 未结 4 2147
青春惊慌失措
青春惊慌失措 2020-12-17 16:03

In C#, how to open an SQLite connection in WAL mode?

Here is how I open in normal mode:

SQLiteConnection connection = new SQLiteConnection(\"Data Sou         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-17 16:26

    Here is my less-than-perfect solution:

    SQLiteConnection connection = new SQLiteConnection("Data Source=" + file);
    connection.Open();
    using (var command = new SQLiteCommand(sqliteConnection))
    {
        command.CommandText = "PRAGMA journal_mode=WAL";
        command.ExecuteNonQuery();
    }
    // (Perform my query)
    

    If you know something less verbose, I would be happy to hear about it!

提交回复
热议问题