- edited description
SQLite.Net.SQLiteException: Busy & SQLite.Net.SQLiteException: Database is locked
Issue #118
new
I got These two errors (SQLite.Net.SQLiteException: Busy & SQLite.Net.SQLiteException: Database is locked) while calling different SQLite requests (UpdateWithChildrenAsync & InsertWithChildrenAsync) at the same time.
This is how I create the database:
private static SQLiteAsyncConnection _connProper = null;
public static SQLiteAsyncConnection DbConnectionProper
{
get
{
if (_connProper == null)
{
Debug.WriteLine("CREATE DATABASE CONNECTION!!!");
string databasePath = Path.Combine(SQLDBPath(), "Storage.sqlite");
var connectionFactory = new Func<SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(new SQLitePlatformWinRT(), new SQLiteConnectionString(databasePath, storeDateTimeAsTicks: false)));
_connProper = new SQLiteAsyncConnection(connectionFactory);
};
return _connProper;
}
}
And here are the functions which I call:
public async Task InsertWithChildrenAsync(T model)
{
using (await Lock.LockAsync())
{
try
{
await Context.InsertWithChildrenAsync(model, recursive: true);
}
catch (SQLite.Net.SQLiteException ex)
{
Debug.WriteLine("InsertWithChildrenAsync error" + typeof(T) + ": " + ex);
}
}
}
public async Task UpdateWithChildrenAsync(T model)
{
using (await Lock.LockAsync())
{
try
{
await Context.UpdateWithChildrenAsync(model);
}
catch (SQLite.Net.SQLiteException ex)
{
Debug.WriteLine("UpdateWithChildrenAsync error of " + typeof(T) + ": " + ex);
}
}
}
Is there a problem on my side or on yours?
Comments (1)
-
reporter - Log in to comment