add guide optimizations

This commit is contained in:
Luke Pulverenti
2016-08-17 15:28:43 -04:00
parent a69f8ecb3d
commit fd6aa72dac
17 changed files with 172 additions and 24 deletions

View File

@@ -414,6 +414,20 @@ namespace MediaBrowser.Server.Implementations.Sync
whereClauses.Add("TargetId=@TargetId");
cmd.Parameters.Add(cmd, "@TargetId", DbType.String).Value = query.TargetId;
}
if (!string.IsNullOrWhiteSpace(query.ExcludeTargetIds))
{
var excludeIds = (query.ExcludeTargetIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (excludeIds.Length == 1)
{
whereClauses.Add("TargetId<>@ExcludeTargetId");
cmd.Parameters.Add(cmd, "@ExcludeTargetId", DbType.String).Value = excludeIds[0];
}
else if (excludeIds.Length > 1)
{
whereClauses.Add("TargetId<>@ExcludeTargetId");
cmd.Parameters.Add(cmd, "@ExcludeTargetId", DbType.String).Value = excludeIds[0];
}
}
if (!string.IsNullOrWhiteSpace(query.UserId))
{
whereClauses.Add("UserId=@UserId");