|
|
@@ -95,7 +95,7 @@ public class SQLiteRegExp : SQLiteFunction
|
|
|
[SQLiteFunction(Name = "DECIMAL_SUM", Arguments = 1, FuncType = FunctionType.Aggregate)]
|
|
|
public class SQLiteDecimalSum : SQLiteFunction
|
|
|
{
|
|
|
- public override void Step(object[] args, int stepNumber, ref object contextData)
|
|
|
+ public override void Step(object[] args, int stepNumber, ref object? contextData)
|
|
|
{
|
|
|
if (args.Length < 1 || args[0] == DBNull.Value)
|
|
|
return;
|
|
|
@@ -104,9 +104,9 @@ public class SQLiteDecimalSum : SQLiteFunction
|
|
|
contextData = d;
|
|
|
}
|
|
|
|
|
|
- public override object Final(object contextData)
|
|
|
+ public override object? Final(object? contextData)
|
|
|
{
|
|
|
- return contextData;
|
|
|
+ return contextData ?? 0M;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2458,7 +2458,9 @@ public class SQLiteProvider : IProvider
|
|
|
tables.Add(tuple);
|
|
|
}
|
|
|
|
|
|
- return string.Format("{0}.[{1}]", tuple.Item2, aggCol);
|
|
|
+ // If there were no rows to aggregate over, then the LEFT OUTER JOIN will fill the row with NULL,
|
|
|
+ // and so we need to coerce into a reasonable value.
|
|
|
+ return $"IFNULL({tuple.Item2}.[{aggCol}],{EscapeValue(GetColumnDefaultValue(agg.TResult))})";
|
|
|
case IComplexFormulaConstantNode constantNode:
|
|
|
var constant = constantNode.GetConstant();
|
|
|
if (constant is FilterConstant filterConstant)
|