diff options
| author | Andrew Mahone <andrew.mahone@gmail.com> | 2019-11-06 10:43:14 -0500 |
|---|---|---|
| committer | Andrew Mahone <andrew.mahone@gmail.com> | 2019-11-06 10:43:14 -0500 |
| commit | 74fb63a8989fe19c5e985a09f9cb45e42022320f (patch) | |
| tree | 3863b4a8e8fd648592ac41db2a46db8e12a5d669 | |
| parent | 4f3b8831552db1d376198384cfe42894883286dd (diff) | |
Use block rather than local using statement.
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteItemRepository.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index dd8620f9f..f7774000c 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -6184,7 +6184,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type cmdText += " order by AttachmentIndex ASC"; var list = new List<MediaAttachment>(); - using var connection = GetConnection(true); + using (var connection = GetConnection(true)) using (var statement = PrepareStatement(connection, cmdText)) { statement.TryBind("@ItemId", query.ItemId.ToByteArray()); @@ -6218,16 +6218,18 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type cancellationToken.ThrowIfCancellationRequested(); - using var connection = GetConnection(); - connection.RunInTransaction(db => + using (var connection = GetConnection()) { - var itemIdBlob = id.ToByteArray(); + connection.RunInTransaction(db => + { + var itemIdBlob = id.ToByteArray(); - db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob); + db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob); - InsertMediaAttachments(itemIdBlob, attachments, db); + InsertMediaAttachments(itemIdBlob, attachments, db); - }, TransactionMode); + }, TransactionMode); + } } private void InsertMediaAttachments(byte[] idBlob, List<MediaAttachment> attachments, IDatabaseConnection db) |
