Skip to content

Commit

Permalink
remove readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
cvium committed Aug 21, 2023
1 parent 791413a commit e7016e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/Data/BaseSqliteRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public virtual void Initialize()
}
}

protected SqliteConnection GetConnection(bool readOnly = false)
protected SqliteConnection GetConnection()
{
var connection = new SqliteConnection($"Filename={DbFilePath}");
connection.Open();
Expand Down
28 changes: 14 additions & 14 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ public BaseItem RetrieveItem(Guid id)

CheckDisposed();

using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, _retrieveItemColumnsSelectQuery))
{
statement.TryBind("@guid", id);
Expand Down Expand Up @@ -1956,7 +1956,7 @@ public List<ChapterInfo> GetChapters(BaseItem item)
CheckDisposed();

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"))
{
statement.TryBind("@ItemId", item.Id);
Expand All @@ -1975,7 +1975,7 @@ public ChapterInfo GetChapter(BaseItem item, int index)
{
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"))
{
statement.TryBind("@ItemId", item.Id);
Expand Down Expand Up @@ -2557,7 +2557,7 @@ public int GetCount(InternalItemsQuery query)
var commandText = commandTextBuilder.ToString();

using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText))
{
if (EnableJoinUserData(query))
Expand Down Expand Up @@ -2625,7 +2625,7 @@ public List<BaseItem> GetItemList(InternalItemsQuery query)
var commandText = commandTextBuilder.ToString();
var items = new List<BaseItem>();
using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText))
{
if (EnableJoinUserData(query))
Expand Down Expand Up @@ -2833,7 +2833,7 @@ public QueryResult<BaseItem> GetItems(InternalItemsQuery query)

var list = new List<BaseItem>();
var result = new QueryResult<BaseItem>();
using var connection = GetConnection(true);
using var connection = GetConnection();
using var transaction = connection.BeginTransaction();
if (!isReturningZeroItems)
{
Expand Down Expand Up @@ -3141,7 +3141,7 @@ public List<Guid> GetItemIdsList(InternalItemsQuery query)
var commandText = commandTextBuilder.ToString();
var list = new List<Guid>();
using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText))
{
if (EnableJoinUserData(query))
Expand Down Expand Up @@ -4723,7 +4723,7 @@ public List<string> GetPeopleNames(InternalPeopleQuery query)
}

var list = new List<string>();
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText.ToString()))
{
// Run this again to bind the params
Expand Down Expand Up @@ -4761,7 +4761,7 @@ public List<PersonInfo> GetPeople(InternalPeopleQuery query)
}

var list = new List<PersonInfo>();
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText))
{
// Run this again to bind the params
Expand Down Expand Up @@ -5003,7 +5003,7 @@ private List<string> GetItemValueNames(int[] itemValueTypes, IReadOnlyList<strin

var list = new List<string>();
using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, commandText))
{
foreach (var row in statement.ExecuteQuery())
Expand Down Expand Up @@ -5203,8 +5203,8 @@ private QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetItemValues(Intern
var list = new List<(BaseItem, ItemCounts)>();
var result = new QueryResult<(BaseItem, ItemCounts)>();
using (new QueryTimeLogger(Logger, commandText))
using (var connection = GetConnection(true))
using (var transaction = connection.BeginTransaction())
using (var connection = GetConnection())
using (var transaction = connection.BeginTransaction(deferred: true))
{
if (!isReturningZeroItems)
{
Expand Down Expand Up @@ -5557,7 +5557,7 @@ public List<MediaStream> GetMediaStreams(MediaStreamQuery query)

cmdText += " order by StreamIndex ASC";

using (var connection = GetConnection(true))
using (var connection = GetConnection())
{
var list = new List<MediaStream>();

Expand Down Expand Up @@ -5945,7 +5945,7 @@ public List<MediaAttachment> GetMediaAttachments(MediaAttachmentQuery query)
cmdText += " order by AttachmentIndex ASC";

var list = new List<MediaAttachment>();
using (var connection = GetConnection(true))
using (var connection = GetConnection())
using (var statement = PrepareStatement(connection, cmdText))
{
statement.TryBind("@ItemId", query.ItemId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public UserItemData GetUserData(long userId, string 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"))
{
Expand Down

0 comments on commit e7016e3

Please sign in to comment.