@ -123,17 +123,10 @@ namespace Emby.Server.Implementations.Data
}
}
private SQLiteDatabaseConnection _backgroundConnection ;
protected override void CloseConnection ( )
{
base . CloseConnection ( ) ;
if ( _backgroundConnection ! = null )
{
_backgroundConnection . Dispose ( ) ;
_backgroundConnection = null ;
}
if ( _shrinkMemoryTimer ! = null )
{
_shrinkMemoryTimer . Dispose ( ) ;
@ -379,8 +372,6 @@ namespace Emby.Server.Implementations.Data
userDataRepo . Initialize ( WriteLock ) ;
//_backgroundConnection = CreateConnection(true);
_shrinkMemoryTimer = _timerFactory . Create ( OnShrinkMemoryTimerCallback , null , TimeSpan . FromMinutes ( 1 ) , TimeSpan . FromMinutes ( 30 ) ) ;
}
@ -1370,6 +1361,10 @@ namespace Emby.Server.Implementations.Data
{
return false ;
}
if ( type = = typeof ( AudioBook ) )
{
return false ;
}
if ( type = = typeof ( MusicAlbum ) )
{
return false ;
@ -2691,7 +2686,9 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
var statements = PrepareAllSafe ( connection , string . Join ( ";" , statementTexts . ToArray ( ) ) )
connection . RunInTransaction ( db = >
{
var statements = PrepareAllSafe ( db , string . Join ( ";" , statementTexts . ToArray ( ) ) )
. ToList ( ) ;
if ( ! isReturningZeroItems )
@ -2717,7 +2714,6 @@ namespace Emby.Server.Implementations.Data
}
}
}
}
if ( query . EnableTotalRecordCount )
{
@ -2736,6 +2732,9 @@ namespace Emby.Server.Implementations.Data
totalRecordCount = statement . ExecuteQuery ( ) . SelectScalarInt ( ) . First ( ) ;
}
}
}
} , ReadTransactionMode ) ;
LogQueryTime ( "GetItems" , commandText , now ) ;
@ -3095,11 +3094,13 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
var statements = PrepareAllSafe ( connection , string . Join ( ";" , statementTexts . ToArray ( ) ) )
. ToList ( ) ;
var totalRecordCount = 0 ;
connection . RunInTransaction ( db = >
{
var statements = PrepareAllSafe ( db , string . Join ( ";" , statementTexts . ToArray ( ) ) )
. ToList ( ) ;
if ( ! isReturningZeroItems )
{
using ( var statement = statements [ 0 ] )
@ -3139,6 +3140,8 @@ namespace Emby.Server.Implementations.Data
}
}
} , ReadTransactionMode ) ;
LogQueryTime ( "GetItemIds" , commandText , now ) ;
return new QueryResult < Guid > ( )
@ -4426,6 +4429,7 @@ namespace Emby.Server.Implementations.Data
typeof ( Movie ) ,
typeof ( Playlist ) ,
typeof ( AudioPodcast ) ,
typeof ( AudioBook ) ,
typeof ( Trailer ) ,
typeof ( BoxSet ) ,
typeof ( Episode ) ,
@ -4594,12 +4598,13 @@ namespace Emby.Server.Implementations.Data
commandText + = " order by ListOrder" ;
var list = new List < string > ( ) ;
using ( WriteLock . Read ( ) )
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , commandText ) )
connection . RunInTransaction ( db = >
{
using ( var statement = PrepareStatementSafe ( db , commandText ) )
{
// Run this again to bind the params
GetPeopleWhereClauses ( query , statement ) ;
@ -4609,6 +4614,7 @@ namespace Emby.Server.Implementations.Data
list . Add ( row . GetString ( 0 ) ) ;
}
}
} , ReadTransactionMode ) ;
}
return list ;
}
@ -4640,7 +4646,9 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , commandText ) )
connection . RunInTransaction ( db = >
{
using ( var statement = PrepareStatementSafe ( db , commandText ) )
{
// Run this again to bind the params
GetPeopleWhereClauses ( query , statement ) ;
@ -4650,6 +4658,7 @@ namespace Emby.Server.Implementations.Data
list . Add ( GetPerson ( row ) ) ;
}
}
} , ReadTransactionMode ) ;
}
}
@ -4855,7 +4864,9 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , commandText ) )
connection . RunInTransaction ( db = >
{
using ( var statement = PrepareStatementSafe ( db , commandText ) )
{
foreach ( var row in statement . ExecuteQuery ( ) )
{
@ -4865,6 +4876,7 @@ namespace Emby.Server.Implementations.Data
}
}
}
} , ReadTransactionMode ) ;
}
}
LogQueryTime ( "GetItemValueNames" , commandText , now ) ;
@ -5034,7 +5046,9 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
var statements = PrepareAllSafe ( connection , string . Join ( ";" , statementTexts . ToArray ( ) ) ) . ToList ( ) ;
connection . RunInTransaction ( db = >
{
var statements = PrepareAllSafe ( db , string . Join ( ";" , statementTexts . ToArray ( ) ) ) . ToList ( ) ;
if ( ! isReturningZeroItems )
{
@ -5097,6 +5111,7 @@ namespace Emby.Server.Implementations.Data
LogQueryTime ( "GetItemValues" , commandText , now ) ;
}
}
} , ReadTransactionMode ) ;
}
}
@ -5344,7 +5359,9 @@ namespace Emby.Server.Implementations.Data
{
using ( var connection = CreateConnection ( true ) )
{
using ( var statement = PrepareStatementSafe ( connection , cmdText ) )
connection . RunInTransaction ( db = >
{
using ( var statement = PrepareStatementSafe ( db , cmdText ) )
{
statement . TryBind ( "@ItemId" , query . ItemId . ToGuidParamValue ( ) ) ;
@ -5363,6 +5380,7 @@ namespace Emby.Server.Implementations.Data
list . Add ( GetMediaStream ( row ) ) ;
}
}
} , ReadTransactionMode ) ;
}
}