Changed the query slightly

pull/470/head
tidusjar 8 years ago
parent 94f8cee015
commit c4a96e311c

@ -60,7 +60,7 @@ namespace PlexRequests.Store.Repository
private IDbConnection Connection => Config.DbConnection(); private IDbConnection Connection => Config.DbConnection();
public IEnumerable<T> Custom(Func<IDbConnection , IEnumerable<T>> func) public IEnumerable<T> Custom(Func<IDbConnection, IEnumerable<T>> func)
{ {
using (var cnn = Connection) using (var cnn = Connection)
{ {
@ -291,9 +291,14 @@ namespace PlexRequests.Store.Repository
var format = values.AddPrefix("@", ","); var format = values.AddPrefix("@", ",");
var processQuery = $"INSERT INTO {tableName} VALUES ({format})"; var processQuery = $"INSERT INTO {tableName} VALUES ({format})";
var result = db.Execute(processQuery, entities); var result = 0;
foreach (var e in enumerable)
{
result += db.Execute(processQuery, e);
}
return result == enumerable.Length; return result == enumerable.Length;
} }
} }
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt) catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{ {
@ -302,6 +307,7 @@ namespace PlexRequests.Store.Repository
} }
} }
public void DeleteAll(string tableName) public void DeleteAll(string tableName)
{ {
try try

Loading…
Cancel
Save