mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
remove transaction from GetItemList
This commit is contained in:
parent
dbba636290
commit
0f1a542c1f
@ -2548,57 +2548,53 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
return connection.RunInTransaction(db =>
|
var list = new List<BaseItem>();
|
||||||
|
|
||||||
|
using (var statement = PrepareStatementSafe(connection, commandText))
|
||||||
{
|
{
|
||||||
var list = new List<BaseItem>();
|
if (EnableJoinUserData(query))
|
||||||
|
|
||||||
using (var statement = PrepareStatementSafe(db, commandText))
|
|
||||||
{
|
{
|
||||||
if (EnableJoinUserData(query))
|
statement.TryBind("@UserId", query.User.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindSimilarParams(query, statement);
|
||||||
|
|
||||||
|
// Running this again will bind the params
|
||||||
|
GetWhereClauses(query, statement);
|
||||||
|
|
||||||
|
foreach (var row in statement.ExecuteQuery())
|
||||||
|
{
|
||||||
|
var item = GetItem(row, query);
|
||||||
|
if (item != null)
|
||||||
{
|
{
|
||||||
statement.TryBind("@UserId", query.User.Id);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BindSimilarParams(query, statement);
|
// Hack for right now since we currently don't support filtering out these duplicates within a query
|
||||||
|
if (query.EnableGroupByMetadataKey)
|
||||||
|
{
|
||||||
|
var limit = query.Limit ?? int.MaxValue;
|
||||||
|
limit -= 4;
|
||||||
|
var newList = new List<BaseItem>();
|
||||||
|
|
||||||
// Running this again will bind the params
|
foreach (var item in list)
|
||||||
GetWhereClauses(query, statement);
|
{
|
||||||
|
AddItem(newList, item);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
if (newList.Count >= limit)
|
||||||
{
|
{
|
||||||
var item = GetItem(row, query);
|
break;
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
list.Add(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack for right now since we currently don't support filtering out these duplicates within a query
|
list = newList;
|
||||||
if (query.EnableGroupByMetadataKey)
|
}
|
||||||
{
|
|
||||||
var limit = query.Limit ?? int.MaxValue;
|
|
||||||
limit -= 4;
|
|
||||||
var newList = new List<BaseItem>();
|
|
||||||
|
|
||||||
foreach (var item in list)
|
LogQueryTime("GetItemList", commandText, now);
|
||||||
{
|
|
||||||
AddItem(newList, item);
|
|
||||||
|
|
||||||
if (newList.Count >= limit)
|
return list;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list = newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogQueryTime("GetItemList", commandText, now);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
|
|
||||||
}, ReadTransactionMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user