mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 修复 pgsql 表达式解析 Contains ilike 判断;
This commit is contained in:
parent
b3ed610f82
commit
2565dbd819
@ -334,7 +334,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
{
|
{
|
||||||
if (exp.Arguments[1].Type == typeof(bool) ||
|
if (exp.Arguments[1].Type == typeof(bool) ||
|
||||||
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
|
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
||||||
|
@ -356,7 +356,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
{
|
{
|
||||||
if (exp.Arguments[1].Type == typeof(bool) ||
|
if (exp.Arguments[1].Type == typeof(bool) ||
|
||||||
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
|
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
||||||
|
@ -387,7 +387,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
{
|
{
|
||||||
if (exp.Arguments[1].Type == typeof(bool) ||
|
if (exp.Arguments[1].Type == typeof(bool) ||
|
||||||
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
|
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
||||||
|
@ -317,7 +317,7 @@ namespace FreeSql.ShenTong
|
|||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
{
|
{
|
||||||
if (exp.Arguments[1].Type == typeof(bool) ||
|
if (exp.Arguments[1].Type == typeof(bool) ||
|
||||||
exp.Arguments[1].Type == typeof(StringComparison) && getExp(exp.Arguments[0]).Contains("IgnoreCase")) likeOpt = "ILIKE";
|
exp.Arguments[1].Type == typeof(StringComparison)) likeOpt = "ILIKE";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) {likeOpt} {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(({args0Value})::text || '%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) {likeOpt} {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%' || ({args0Value})::text)")}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user