Small change with the return value in the batch insert

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

@ -277,7 +277,8 @@ namespace PlexRequests.Store.Repository
public bool BatchInsert(IEnumerable<T> entities, string tableName, params string[] values)
{
// If we have nothing to update, then it didn't fail...
if (!entities.Any())
var enumerable = entities as T[] ?? entities.ToArray();
if (!enumerable.Any())
{
return true;
}
@ -291,7 +292,7 @@ namespace PlexRequests.Store.Repository
var format = values.AddPrefix("@", ",");
var processQuery = $"INSERT INTO {tableName} VALUES ({format})";
var result = db.Execute(processQuery, entities);
return result == values.Length;
return result == enumerable.Length;
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)

Loading…
Cancel
Save