mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 修复 .Contains('b%') 部分数据库函数参数位置错误;#1826
This commit is contained in:
parent
6bf4c21af0
commit
20b88248e9
@ -316,7 +316,7 @@ namespace FreeSql.Custom.MySql
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"locate({args0Value}, {left}) > 0";
|
return $"locate({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
||||||
|
@ -318,9 +318,9 @@ namespace FreeSql.Custom.Oracle
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}, 1, 1) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
||||||
|
@ -407,9 +407,9 @@ namespace FreeSql.Custom.PostgreSQL
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -339,7 +339,7 @@ namespace FreeSql.Custom.SqlServer
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({left})-len({args0Value})+1";
|
||||||
return $"charindex({args0Value}, {left}) > 0";
|
return $"charindex({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
||||||
|
@ -318,9 +318,9 @@ namespace FreeSql.Dameng
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}, 1, 1) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
||||||
|
@ -306,7 +306,7 @@ namespace FreeSql.Firebird
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"position({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"position({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"position({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"position({args0Value}, {left}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"position({args0Value}, {left}) > 0";
|
return $"position({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
||||||
|
@ -306,7 +306,7 @@ namespace FreeSql.GBase
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
||||||
|
@ -385,9 +385,9 @@ namespace FreeSql.KingbaseES
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -279,9 +279,9 @@ namespace FreeSql.MsAccess
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = len({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}) = len({left})-len({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value}+'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value}+'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'+{args0Value})")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'+{args0Value})")}";
|
||||||
|
@ -318,7 +318,7 @@ namespace FreeSql.MySql
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"locate({args0Value}, {left}) > 0";
|
return $"locate({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
||||||
|
@ -318,9 +318,9 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}, 1, 1) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
||||||
|
@ -385,9 +385,9 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -316,7 +316,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"locate({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"locate({args0Value}, {left}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"locate({args0Value}, {left}) > 0";
|
return $"locate({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"concat({args0Value}, '%')")}";
|
||||||
|
@ -318,9 +318,9 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}, 1, 1) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
||||||
|
@ -407,9 +407,9 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -339,7 +339,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({left})-len({args0Value})+1";
|
||||||
return $"charindex({args0Value}, {left}) > 0";
|
return $"charindex({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
||||||
|
@ -318,9 +318,9 @@ namespace FreeSql.Oracle
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}, 1, 1) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(to_char({args0Value})||'%')")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"('%'||to_char({args0Value}))")}";
|
||||||
|
@ -438,9 +438,9 @@ namespace FreeSql.PostgreSQL
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -345,10 +345,9 @@ namespace FreeSql.QuestDb
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith")
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = length({left})-length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) = length({args0Value})";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
|
@ -362,9 +362,9 @@ namespace FreeSql.ShenTong
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
@ -338,7 +338,7 @@ namespace FreeSql.SqlServer
|
|||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"charindex({args0Value}, {left}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"charindex({args0Value}, {left}) = len({left})-len({args0Value})+1";
|
||||||
return $"charindex({args0Value}, {left}) > 0";
|
return $"charindex({args0Value}, {left}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"(cast({args0Value} as nvarchar(max))+'%')")}";
|
||||||
|
@ -314,9 +314,9 @@ namespace FreeSql.Sqlite
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"instr({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"instr({args0Value}, {left}) = length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}) = length({left})-length({args0Value})+1";
|
||||||
return $"instr({args0Value}, {left}) > 0";
|
return $"instr({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
if (exp.Method.Name == "StartsWith") return $"({left}) LIKE {(args0Value.EndsWith("'") ? args0Value.Insert(args0Value.Length - 1, "%") : $"({args0Value})||'%'")}";
|
||||||
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"'%'||({args0Value})")}";
|
if (exp.Method.Name == "EndsWith") return $"({left}) LIKE {(args0Value.StartsWith("'") ? args0Value.Insert(1, "%") : $"'%'||({args0Value})")}";
|
||||||
|
@ -363,9 +363,9 @@ namespace FreeSql.Xugu
|
|||||||
if (args0Value == "NULL") return $"({left}) IS NULL";
|
if (args0Value == "NULL") return $"({left}) IS NULL";
|
||||||
if (args0Value.Contains("%"))
|
if (args0Value.Contains("%"))
|
||||||
{
|
{
|
||||||
if (exp.Method.Name == "StartsWith") return $"strpos({args0Value}, {left}) = 1";
|
if (exp.Method.Name == "StartsWith") return $"strpos({left}, {args0Value}) = 1";
|
||||||
if (exp.Method.Name == "EndsWith") return $"strpos({args0Value}, {left}) = char_length({args0Value})";
|
if (exp.Method.Name == "EndsWith") return $"strpos({left}, {args0Value}) = char_length({left})-char_length({args0Value})+1";
|
||||||
return $"strpos({args0Value}, {left}) > 0";
|
return $"strpos({left}, {args0Value}) > 0";
|
||||||
}
|
}
|
||||||
var likeOpt = "LIKE";
|
var likeOpt = "LIKE";
|
||||||
if (exp.Arguments.Count > 1)
|
if (exp.Arguments.Count > 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user