I have a couple restful requests running, which insert the results into a sqlite-net db.
The database insert part looks like:
int id = SelectOne(select);
if (id == 0)
return connection.Insert(obj);
else
return connection.Update(obj);
I have had to wrap this with a lock(), because if I don't, I sometimes get a sqlite "busy" error on the update part. Any thoughts on what might cause the busy error?
SQLite allows only one writer at a time.
I had a lot of "busy" errors and app crashes until I added FullMutex flag to the connection:
_connection = new SQLiteConnection(path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex)
I also keep this connection unique and open during the whole app life cycle
Most helpful comment
I had a lot of "busy" errors and app crashes until I added
FullMutexflag to the connection:I also keep this connection unique and open during the whole app life cycle