Merge pull request #2144 from neilsb/feature/Add-Excluded-Tags-to-SQLite-query-using-parameters

Add Excluded Tags to SQLite query using parameters
This commit is contained in:
dkanada 2020-01-02 15:32:25 +09:00 committed by GitHub
commit d756233f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4593,10 +4593,20 @@ namespace Emby.Server.Implementations.Data
if (query.ExcludeInheritedTags.Length > 0) if (query.ExcludeInheritedTags.Length > 0)
{ {
var tagValues = query.ExcludeInheritedTags.Select(i => "'" + GetCleanValue(i) + "'"); var paramName = "@ExcludeInheritedTags";
var tagValuesList = string.Join(",", tagValues); if (statement == null)
{
whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + tagValuesList + ")) is null)"); int index = 0;
string excludedTags = string.Join(",", query.ExcludeInheritedTags.Select(t => paramName + index++));
whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + excludedTags + ")) is null)");
}
else
{
for (int index = 0; index < query.ExcludeInheritedTags.Length; index++)
{
statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[index]));
}
}
} }
if (query.SeriesStatuses.Length > 0) if (query.SeriesStatuses.Length > 0)