mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 表达式树函数解析 byte[] Length;#505
This commit is contained in:
@ -19,6 +19,12 @@ namespace FreeSql.Odbc.KingbaseES
|
||||
Func<Expression, string> getExp = exparg => ExpressionLambdaToSql(exparg, tsc);
|
||||
switch (exp.NodeType)
|
||||
{
|
||||
case ExpressionType.ArrayLength:
|
||||
var arrOper = (exp as UnaryExpression)?.Operand;
|
||||
var arrOperExp = getExp(arrOper);
|
||||
if (arrOperExp.StartsWith("(") || arrOperExp.EndsWith(")")) return $"array_length(array[{arrOperExp.TrimStart('(').TrimEnd(')')}],1)";
|
||||
if (arrOper.Type == typeof(byte[])) return $"octet_length({getExp(arrOper)})";
|
||||
return $"case when {arrOperExp} is null then 0 else array_length({arrOperExp},1) end";
|
||||
case ExpressionType.Convert:
|
||||
var operandExp = (exp as UnaryExpression)?.Operand;
|
||||
var gentype = exp.Type.NullableTypeOrThis();
|
||||
@ -45,10 +51,6 @@ namespace FreeSql.Odbc.KingbaseES
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ExpressionType.ArrayLength:
|
||||
var arrOperExp = getExp((exp as UnaryExpression).Operand);
|
||||
if (arrOperExp.StartsWith("(") || arrOperExp.EndsWith(")")) return $"array_length(array[{arrOperExp.TrimStart('(').TrimEnd(')')}],1)";
|
||||
return $"case when {arrOperExp} is null then 0 else array_length({arrOperExp},1) end";
|
||||
case ExpressionType.Call:
|
||||
var callExp = exp as MethodCallExpression;
|
||||
|
||||
|
Reference in New Issue
Block a user