remove readonly

This commit is contained in:
cvium 2023-08-21 21:49:39 +02:00
parent 791413a50f
commit e7016e38b8
3 changed files with 16 additions and 16 deletions

View File

@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Data
} }
} }
protected SqliteConnection GetConnection(bool readOnly = false) protected SqliteConnection GetConnection()
{ {
var connection = new SqliteConnection($"Filename={DbFilePath}"); var connection = new SqliteConnection($"Filename={DbFilePath}");
connection.Open(); connection.Open();

View File

@ -1273,7 +1273,7 @@ namespace Emby.Server.Implementations.Data
CheckDisposed(); CheckDisposed();
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, _retrieveItemColumnsSelectQuery)) using (var statement = PrepareStatement(connection, _retrieveItemColumnsSelectQuery))
{ {
statement.TryBind("@guid", id); statement.TryBind("@guid", id);
@ -1956,7 +1956,7 @@ namespace Emby.Server.Implementations.Data
CheckDisposed(); CheckDisposed();
var chapters = new List<ChapterInfo>(); var chapters = new List<ChapterInfo>();
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId order by ChapterIndex asc")) using (var statement = PrepareStatement(connection, "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId order by ChapterIndex asc"))
{ {
statement.TryBind("@ItemId", item.Id); statement.TryBind("@ItemId", item.Id);
@ -1975,7 +1975,7 @@ namespace Emby.Server.Implementations.Data
{ {
CheckDisposed(); CheckDisposed();
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId and ChapterIndex=@ChapterIndex")) using (var statement = PrepareStatement(connection, "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId and ChapterIndex=@ChapterIndex"))
{ {
statement.TryBind("@ItemId", item.Id); statement.TryBind("@ItemId", item.Id);
@ -2557,7 +2557,7 @@ namespace Emby.Server.Implementations.Data
var commandText = commandTextBuilder.ToString(); var commandText = commandTextBuilder.ToString();
using (new QueryTimeLogger(Logger, commandText)) using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText)) using (var statement = PrepareStatement(connection, commandText))
{ {
if (EnableJoinUserData(query)) if (EnableJoinUserData(query))
@ -2625,7 +2625,7 @@ namespace Emby.Server.Implementations.Data
var commandText = commandTextBuilder.ToString(); var commandText = commandTextBuilder.ToString();
var items = new List<BaseItem>(); var items = new List<BaseItem>();
using (new QueryTimeLogger(Logger, commandText)) using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText)) using (var statement = PrepareStatement(connection, commandText))
{ {
if (EnableJoinUserData(query)) if (EnableJoinUserData(query))
@ -2833,7 +2833,7 @@ namespace Emby.Server.Implementations.Data
var list = new List<BaseItem>(); var list = new List<BaseItem>();
var result = new QueryResult<BaseItem>(); var result = new QueryResult<BaseItem>();
using var connection = GetConnection(true); using var connection = GetConnection();
using var transaction = connection.BeginTransaction(); using var transaction = connection.BeginTransaction();
if (!isReturningZeroItems) if (!isReturningZeroItems)
{ {
@ -3141,7 +3141,7 @@ namespace Emby.Server.Implementations.Data
var commandText = commandTextBuilder.ToString(); var commandText = commandTextBuilder.ToString();
var list = new List<Guid>(); var list = new List<Guid>();
using (new QueryTimeLogger(Logger, commandText)) using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText)) using (var statement = PrepareStatement(connection, commandText))
{ {
if (EnableJoinUserData(query)) if (EnableJoinUserData(query))
@ -4723,7 +4723,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} }
var list = new List<string>(); var list = new List<string>();
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText.ToString())) using (var statement = PrepareStatement(connection, commandText.ToString()))
{ {
// Run this again to bind the params // Run this again to bind the params
@ -4761,7 +4761,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} }
var list = new List<PersonInfo>(); var list = new List<PersonInfo>();
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText)) using (var statement = PrepareStatement(connection, commandText))
{ {
// Run this again to bind the params // Run this again to bind the params
@ -5003,7 +5003,7 @@ AND Type = @InternalPersonType)");
var list = new List<string>(); var list = new List<string>();
using (new QueryTimeLogger(Logger, commandText)) using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText)) using (var statement = PrepareStatement(connection, commandText))
{ {
foreach (var row in statement.ExecuteQuery()) foreach (var row in statement.ExecuteQuery())
@ -5203,8 +5203,8 @@ AND Type = @InternalPersonType)");
var list = new List<(BaseItem, ItemCounts)>(); var list = new List<(BaseItem, ItemCounts)>();
var result = new QueryResult<(BaseItem, ItemCounts)>(); var result = new QueryResult<(BaseItem, ItemCounts)>();
using (new QueryTimeLogger(Logger, commandText)) using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true)) using (var connection = GetConnection())
using (var transaction = connection.BeginTransaction()) using (var transaction = connection.BeginTransaction(deferred: true))
{ {
if (!isReturningZeroItems) if (!isReturningZeroItems)
{ {
@ -5557,7 +5557,7 @@ AND Type = @InternalPersonType)");
cmdText += " order by StreamIndex ASC"; cmdText += " order by StreamIndex ASC";
using (var connection = GetConnection(true)) using (var connection = GetConnection())
{ {
var list = new List<MediaStream>(); var list = new List<MediaStream>();
@ -5945,7 +5945,7 @@ AND Type = @InternalPersonType)");
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())
using (var statement = PrepareStatement(connection, cmdText)) using (var statement = PrepareStatement(connection, cmdText))
{ {
statement.TryBind("@ItemId", query.ItemId); statement.TryBind("@ItemId", query.ItemId);

View File

@ -267,7 +267,7 @@ namespace Emby.Server.Implementations.Data
ArgumentException.ThrowIfNullOrEmpty(key); ArgumentException.ThrowIfNullOrEmpty(key);
using (var connection = GetConnection(true)) using (var connection = GetConnection())
{ {
using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where key =@Key and userId=@UserId")) using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where key =@Key and userId=@UserId"))
{ {