|
|
|
@ -1914,19 +1914,35 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
whereClauses.Add("LocationType not in (" + val + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var enableItemsByName = query.IncludeItemsByName ?? query.IncludeItemTypes.Length > 0;
|
|
|
|
|
|
|
|
|
|
if (query.TopParentIds.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
if (enableItemsByName)
|
|
|
|
|
{
|
|
|
|
|
whereClauses.Add("(TopParentId=@TopParentId or IsItemByName=@IsItemByName)");
|
|
|
|
|
cmd.Parameters.Add(cmd, "@TopParentId", DbType.String).Value = query.TopParentIds[0];
|
|
|
|
|
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
whereClauses.Add("(TopParentId=@TopParentId)");
|
|
|
|
|
}
|
|
|
|
|
cmd.Parameters.Add(cmd, "@TopParentId", DbType.String).Value = query.TopParentIds[0];
|
|
|
|
|
}
|
|
|
|
|
if (query.TopParentIds.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
var val = string.Join(",", query.TopParentIds.Select(i => "'" + i + "'").ToArray());
|
|
|
|
|
|
|
|
|
|
if (enableItemsByName)
|
|
|
|
|
{
|
|
|
|
|
whereClauses.Add("(IsItemByName=@IsItemByName or TopParentId in (" + val + "))");
|
|
|
|
|
cmd.Parameters.Add(cmd, "@IsItemByName", DbType.Boolean).Value = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
whereClauses.Add("(TopParentId in (" + val + "))");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (query.AncestorIds.Length == 1)
|
|
|
|
|
{
|
|
|
|
|