@ -319,7 +319,7 @@ namespace Emby.Server.Implementations.Data
connection . RunQueries ( postQueries ) ;
}
userDataRepo . Initialize ( WriteLock, _connection , userManager) ;
userDataRepo . Initialize ( userManager) ;
}
private static readonly string [ ] _retriveItemColumns =
@ -551,8 +551,6 @@ namespace Emby.Server.Implementations.Data
CheckDisposed ( ) ;
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
@ -567,7 +565,6 @@ namespace Emby.Server.Implementations.Data
} , TransactionMode ) ;
}
}
}
/// <summary>
/// Saves the items.
@ -605,18 +602,14 @@ namespace Emby.Server.Implementations.Data
tuples . Add ( ( item , ancestorIds , topParent , userdataKey , inheritedTags ) ) ;
}
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
{
SaveItemsInTranscation ( db , tuples ) ;
} , TransactionMode ) ;
}
}
}
private void SaveItemsInTranscation ( IDatabaseConnection db , IEnumerable < ( BaseItem , List < Guid > , BaseItem , string , List < string > ) > tuples )
{
@ -1193,8 +1186,6 @@ namespace Emby.Server.Implementations.Data
CheckDisposed ( ) ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , "select " + string . Join ( "," , _retriveItemColumns ) + " from TypedBaseItems where guid = @guid" ) )
@ -1206,11 +1197,10 @@ namespace Emby.Server.Implementations.Data
return GetItem ( row , new InternalItemsQuery ( ) ) ;
}
}
}
return null ;
}
}
}
private bool TypeRequiresDeserialization ( Type type )
{
@ -1909,8 +1899,6 @@ namespace Emby.Server.Implementations.Data
{
CheckDisposed ( ) ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < ChapterInfo > ( ) ;
@ -1928,7 +1916,6 @@ namespace Emby.Server.Implementations.Data
return list ;
}
}
}
/// <summary>
/// Gets a single chapter for an item
@ -1941,8 +1928,6 @@ namespace Emby.Server.Implementations.Data
{
CheckDisposed ( ) ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , "select StartPositionTicks,Name,ImagePath,ImageDateModified from " + ChaptersTableName + " where ItemId = @ItemId and ChapterIndex=@ChapterIndex" ) )
@ -1956,7 +1941,7 @@ namespace Emby.Server.Implementations.Data
}
}
}
}
return null ;
}
@ -2012,8 +1997,6 @@ namespace Emby.Server.Implementations.Data
throw new ArgumentNullException ( nameof ( chapters ) ) ;
}
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
@ -2028,7 +2011,6 @@ namespace Emby.Server.Implementations.Data
} , TransactionMode ) ;
}
}
}
private void InsertChapters ( byte [ ] idBlob , List < ChapterInfo > chapters , IDatabaseConnection db )
{
@ -2551,8 +2533,6 @@ namespace Emby.Server.Implementations.Data
commandText + = " where " + string . Join ( " AND " , whereClauses ) ;
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , commandText ) )
@ -2573,8 +2553,6 @@ namespace Emby.Server.Implementations.Data
return count ;
}
}
}
}
public List < BaseItem > GetItemList ( InternalItemsQuery query )
@ -2624,8 +2602,6 @@ namespace Emby.Server.Implementations.Data
}
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < BaseItem > ( ) ;
@ -2686,7 +2662,6 @@ namespace Emby.Server.Implementations.Data
return list ;
}
}
}
private string FixUnicodeChars ( string buffer )
{
@ -2845,8 +2820,6 @@ namespace Emby.Server.Implementations.Data
statementTexts . Add ( commandText ) ;
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
return connection . RunInTransaction ( db = >
@ -2915,7 +2888,6 @@ namespace Emby.Server.Implementations.Data
} , ReadTransactionMode ) ;
}
}
}
private string GetOrderByText ( InternalItemsQuery query )
{
@ -3080,8 +3052,6 @@ namespace Emby.Server.Implementations.Data
}
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < Guid > ( ) ;
@ -3110,7 +3080,6 @@ namespace Emby.Server.Implementations.Data
return list ;
}
}
}
public List < Tuple < Guid , string > > GetItemIdsWithPath ( InternalItemsQuery query )
{
@ -3149,8 +3118,6 @@ namespace Emby.Server.Implementations.Data
}
}
using ( WriteLock . Read ( ) )
{
var list = new List < Tuple < Guid , string > > ( ) ;
using ( var connection = CreateConnection ( true ) )
{
@ -3182,7 +3149,6 @@ namespace Emby.Server.Implementations.Data
return list ;
}
}
public QueryResult < Guid > GetItemIds ( InternalItemsQuery query )
{
@ -3265,8 +3231,6 @@ namespace Emby.Server.Implementations.Data
statementTexts . Add ( commandText ) ;
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
return connection . RunInTransaction ( db = >
@ -3324,7 +3288,6 @@ namespace Emby.Server.Implementations.Data
} , ReadTransactionMode ) ;
}
}
}
private bool IsAlphaNumeric ( string str )
{
@ -4898,8 +4861,6 @@ namespace Emby.Server.Implementations.Data
}
private void UpdateInheritedTags ( CancellationToken cancellationToken )
{
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
@ -4921,7 +4882,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} , TransactionMode ) ;
}
}
}
private static Dictionary < string , string [ ] > GetTypeMapDictionary ( )
{
@ -4965,8 +4925,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
CheckDisposed ( ) ;
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
@ -4993,7 +4951,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} , TransactionMode ) ;
}
}
}
private void ExecuteWithSingleParam ( IDatabaseConnection db , string query , byte [ ] value )
{
@ -5025,8 +4982,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
commandText + = " order by ListOrder" ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < string > ( ) ;
@ -5043,7 +4998,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return list ;
}
}
}
public List < PersonInfo > GetPeople ( InternalPeopleQuery query )
{
@ -5065,8 +5019,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
commandText + = " order by ListOrder" ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < PersonInfo > ( ) ;
@ -5085,7 +5037,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return list ;
}
}
}
private List < string > GetPeopleWhereClauses ( InternalPeopleQuery query , IStatement statement )
{
@ -5294,8 +5245,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
commandText + = " Group By CleanValue" ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < string > ( ) ;
@ -5316,7 +5265,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return list ;
}
}
}
private QueryResult < ( BaseItem , ItemCounts ) > GetItemValues ( InternalItemsQuery query , int [ ] itemValueTypes , string returnType )
{
@ -5483,8 +5431,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
statementTexts . Add ( countText ) ;
}
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
return connection . RunInTransaction ( db = >
@ -5578,7 +5524,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} , ReadTransactionMode ) ;
}
}
}
private ItemCounts GetItemCounts ( IReadOnlyList < IResultSetValue > reader , int countStartColumn , string [ ] typesToCount )
{
@ -5753,8 +5698,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
CheckDisposed ( ) ;
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
@ -5767,8 +5710,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
InsertPeople ( itemIdBlob , people , db ) ;
} , TransactionMode ) ;
}
}
}
@ -5874,8 +5815,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
cmdText + = " order by StreamIndex ASC" ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
var list = new List < MediaStream > ( ) ;
@ -5903,7 +5842,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
return list ;
}
}
}
public void SaveMediaStreams ( Guid id , List < MediaStream > streams , CancellationToken cancellationToken )
{
@ -5921,8 +5859,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
cancellationToken . ThrowIfCancellationRequested ( ) ;
using ( WriteLock . Write ( ) )
{
using ( var connection = CreateConnection ( ) )
{
connection . RunInTransaction ( db = >
@ -5937,7 +5873,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
} , TransactionMode ) ;
}
}
}
private void InsertMediaStreams ( byte [ ] idBlob , List < MediaStream > streams , IDatabaseConnection db )
{