Browse Source

Fixing index error & split out code for readability

Neil Burrows 5 years ago
parent
commit
55317b5c74
1 changed files with 8 additions and 3 deletions
  1. 8 3
      Emby.Server.Implementations/Data/SqliteItemRepository.cs

+ 8 - 3
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -4596,14 +4596,19 @@ namespace Emby.Server.Implementations.Data
                 var paramName = "@ExcludeInheritedTags";
                 var paramName = "@ExcludeInheritedTags";
                 if (statement == null)
                 if (statement == null)
                 {
                 {
-                    int index = 0;
-                    whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + string.Join(",", query.ExcludeInheritedTags.Select(t => paramName + index++)) + ")) is null)");
+                    List<string> paramList = new List<string>();
+                    for (int index = 0; index < query.ExcludeInheritedTags.Length; index++)
+                    {
+                        paramList.Add(paramName + index);
+                    }
+
+                    whereClauses.Add("((select CleanValue from itemvalues where ItemId=Guid and Type=6 and cleanvalue in (" + string.Join(",", paramList) + ")) is null)");
                 }
                 }
                 else
                 else
                 {
                 {
                     for (int index = 0; index < query.ExcludeInheritedTags.Length; index++)
                     for (int index = 0; index < query.ExcludeInheritedTags.Length; index++)
                     {
                     {
-                        statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[0]));
+                        statement.TryBind(paramName + index, GetCleanValue(query.ExcludeInheritedTags[index]));
                     }
                     }
                 }
                 }
             }
             }