Database disk image damaged in MonoTouch

I am using Monotouch 5 to develop a multi-threaded messaging application. After several days of operation, some clients receive a Database disk image is malformed error. I am using SQLite.cs from the Kueger systems I found on the Internet to access the SQLite database.

There seems to be a problem with multiple threads accessing the database (which happens very often). I read somewhere about how the database is compiled (Single thread, multi thread, serialized). Am I pointing somehow?

I want to continue updating the database from background threads without corrupting it. What am I doing wrong?

+3
source share
1 answer

You can tell sqlite how to deal with multi-threaded. The trick is to do this very early on in your application (because as soon as sqlite is initialized, it will be too late to change it).

For SQLite.cs, you can do this with this code.

In Mono.Data.Sqlite.dll you can call Mono.Data.Sqlite.SqliteConnection.SetConfig (Mono.Data.Sqlite.SQLiteConfig.*); to do the same.

In both cases, valid values ​​(for enumerating the configuration) are documented here .

+2
source

Source: https://habr.com/ru/post/1469532/


All Articles