瀏覽代碼

Fix SQLiteProvider bug with InList on Guid.Empty

Kenric Nugteren 9 月之前
父節點
當前提交
d01204420c
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      inabox.database.sqlite/SQLiteProvider.cs

+ 7 - 1
inabox.database.sqlite/SQLiteProvider.cs

@@ -1523,7 +1523,13 @@ public class SQLiteProvider : IProvider
                     // 1000-parameter limit by using building the string ourselves
                     if (filter.Value is Guid[] list)
                     {
-                        result = string.Format("(" + operators[filter.Operator] + ")", prop, string.Format("\"{0}\"", string.Join("\",\"", list)));
+                        result = string.Format("(" + operators[filter.Operator] + ")",
+                            prop,
+                            string.Join(',', list.Where(x => x != Guid.Empty).Select(x => $"'{x}'")));
+                        if (list.Contains(Guid.Empty))
+                        {
+                            result = $"({result} or ({prop} IS NULL))";
+                        }
                     }
                     else if (filter.Value is IEnumerable enumerable)
                     {