aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs b/MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs
index 897ece764..6aeb63d9b 100644
--- a/MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs
+++ b/MediaBrowser.Server.Implementations/Sqlite/SQLiteRepository.cs
@@ -121,13 +121,14 @@ namespace MediaBrowser.Server.Implementations.Sqlite
{
try
{
- var cmd = connection.CreateCommand();
-
- foreach (var query in queries)
+ using (var cmd = connection.CreateCommand())
{
- cmd.Transaction = tran;
- cmd.CommandText = query;
- cmd.ExecuteNonQuery();
+ foreach (var query in queries)
+ {
+ cmd.Transaction = tran;
+ cmd.CommandText = query;
+ cmd.ExecuteNonQuery();
+ }
}
tran.Commit();
@@ -268,6 +269,9 @@ namespace MediaBrowser.Server.Implementations.Sqlite
command.Transaction = tran;
command.ExecuteNonQuery();
+
+ command.Dispose();
+
numCommands++;
}