mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
Use block rather than local using statement.
This commit is contained in:
parent
4f3b883155
commit
74fb63a898
1 changed files with 9 additions and 7 deletions
|
@ -6184,7 +6184,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
cmdText += " order by AttachmentIndex ASC";
|
cmdText += " order by AttachmentIndex ASC";
|
||||||
|
|
||||||
var list = new List<MediaAttachment>();
|
var list = new List<MediaAttachment>();
|
||||||
using var connection = GetConnection(true);
|
using (var connection = GetConnection(true))
|
||||||
using (var statement = PrepareStatement(connection, cmdText))
|
using (var statement = PrepareStatement(connection, cmdText))
|
||||||
{
|
{
|
||||||
statement.TryBind("@ItemId", query.ItemId.ToByteArray());
|
statement.TryBind("@ItemId", query.ItemId.ToByteArray());
|
||||||
|
@ -6218,16 +6218,18 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
using var connection = GetConnection();
|
using (var connection = GetConnection())
|
||||||
connection.RunInTransaction(db =>
|
|
||||||
{
|
{
|
||||||
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)
|
private void InsertMediaAttachments(byte[] idBlob, List<MediaAttachment> attachments, IDatabaseConnection db)
|
||||||
|
|
Loading…
Reference in a new issue