From 554c967dd6a0e7e75e737912e869b7269cd72081 Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Fri, 13 Dec 2019 10:29:38 +0000 Subject: [PATCH] Add Excluded Tags using SQLite parameters --- .../Data/SqliteItemRepository.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 69cfcb67b5..3f96b43b3b 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -4593,10 +4593,26 @@ namespace Emby.Server.Implementations.Data if (query.ExcludeInheritedTags.Length > 0) { - var tagValues = query.ExcludeInheritedTags.Select(i => "'" + GetCleanValue(i) + "'"); - var tagValuesList = string.Join(",", tagValues); + var paramName = "@ExcludeInheritedTags"; - whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + tagValuesList + ")) is null)"); + if (statement == null) + { + List tagParamList = new List(); + + for (int index = 0; index < query.ExcludeInheritedTags.Length; index++) + { + tagParamList.Add(paramName + index); + } + + whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + string.Join(",", tagParamList) + ")) is null)"); + } + else + { + for (int index = 0; index < query.ExcludeInheritedTags.Length; index++) + { + statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[0])); + } + } } if (query.SeriesStatuses.Length > 0)