|
@@ -1393,6 +1393,8 @@ namespace InABox.Database.SQLite
|
|
|
{
|
|
|
return constant switch
|
|
|
{
|
|
|
+ FilterConstant.Null => "NULL",
|
|
|
+
|
|
|
FilterConstant.Now => "datetime()",
|
|
|
FilterConstant.Today => "datetime(date())",
|
|
|
FilterConstant.Zero => "0",
|
|
@@ -1437,7 +1439,8 @@ namespace InABox.Database.SQLite
|
|
|
FilterConstant.EndOfThisFinancialYear => "datetime(date(), '-6 months', 'start of year', '+18 months', '-000.0001 seconds')",
|
|
|
FilterConstant.StartOfNextFinancialYear => "datetime(date(), '+6 months', 'start of year', '+6 months')",
|
|
|
FilterConstant.EndOfNextFinancialYear => "datetime(date(), '+6 months', 'start of year', '+18 months', '-000.0001 seconds')",
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
_ => throw new Exception($"FilterConstant.{constant} is not implemented!"),
|
|
|
};
|
|
|
}
|
|
@@ -1523,7 +1526,18 @@ namespace InABox.Database.SQLite
|
|
|
else
|
|
|
{
|
|
|
if (filter.Value is FilterConstant constant)
|
|
|
- result = string.Format("(" + operators[filter.Operator] + ")", prop, GetFilterConstant(constant));
|
|
|
+ {
|
|
|
+ if (constant == FilterConstant.Null)
|
|
|
+ {
|
|
|
+ result = string.Format("({0} {1} NULL)", prop,
|
|
|
+ filter.Operator == Operator.IsEqualTo
|
|
|
+ ? "IS"
|
|
|
+ : "IS NOT");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ result = string.Format("(" + operators[filter.Operator] + ")", prop,
|
|
|
+ GetFilterConstant(constant));
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
var value = Encode(filter.Value, mexp.Type);
|