mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-09 18:00:56 +08:00
- 修复 Lambda .Contains 通配符解析为非 Like 问题;
This commit is contained in:
@@ -288,7 +288,7 @@ namespace FreeSql.Dameng
|
||||
var leftLike = exp.Object.NodeType == ExpressionType.MemberAccess ? left : $"({left})";
|
||||
var args0Value = getExp(exp.Arguments[0]);
|
||||
if (args0Value == "NULL") return $"{leftLike} IS NULL";
|
||||
if (args0Value.Contains("%"))
|
||||
if (new[] { '%', '_', '[', ']', '*' }.Any(wildcard => args0Value.Contains(wildcard)))
|
||||
{
|
||||
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||
|
||||
Reference in New Issue
Block a user