Open
Description
Hi
Rather than to have to fork the lib to integrate this functionality, I'd like to propose to add it to the mainline.
In SQLiteconnection.cs, I've added two methods allowing me to delete more than one item in a transaction, and the item either being identified by its PK, or the object itself. I found that sqlite-net is not very effective when performing mass operations, and those two delete methods allow significant performance gains over doing it one by one.
public int DeleteAll<T>(System.Collections.IEnumerable keys)
{
var c = 0;
RunInTransaction(() =>
{
foreach (var r in keys)
c += Delete<T>(r);
});
return c;
}
/// <summary>
/// deletes all specified objects
/// </summary>
/// <param name="objects">
/// An <see cref="IEnumerable"/> of the bojects to delete
/// </param>
/// <returns>
/// The number of rows deleted
/// </returns>
public int DeleteAll(System.Collections.IEnumerable objects)
{
var c = 0;
RunInTransaction(() =>
{
foreach(var r in objects) {
c += Delete(r);
}
});
return c;
}
perhaps they should be named DeleteMany instead of DeleteAll..