Skip to content

Commit 2565dbd

Browse files
2881028810
authored andcommitted
- 修复 pgsql 表达式解析 Contains ilike 判断;
1 parent b3ed610 commit 2565dbd

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Providers/FreeSql.Provider.Odbc/KingbaseES/OdbcKingbaseESExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp,
334334
if (exp.Arguments.Count > 1)
335335
{
336336
if (exp.Arguments[1].Type == typeof(bool) ||
337-
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
337+
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
338338
}
339339
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
340340
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";

Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp,
356356
if (exp.Arguments.Count > 1)
357357
{
358358
if (exp.Arguments[1].Type == typeof(bool) ||
359-
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
359+
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
360360
}
361361
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
362362
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";

Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp,
387387
if (exp.Arguments.Count > 1)
388388
{
389389
if (exp.Arguments[1].Type == typeof(bool) ||
390-
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
390+
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
391391
}
392392
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
393393
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";

Providers/FreeSql.Provider.ShenTong/ShenTongExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp,
317317
if (exp.Arguments.Count > 1)
318318
{
319319
if (exp.Arguments[1].Type == typeof(bool) ||
320-
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
320+
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
321321
}
322322
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
323323
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";

0 commit comments

Comments
 (0)