- 优化 Contains 表达式解析为 where in 自动拆分,防止大于 1000 的 SQL 错误;

This commit is contained in:
28810
2019-11-20 16:06:45 +08:00
parent d42b2fc2b8
commit 9f97d67cb2
32 changed files with 201 additions and 86 deletions

View File

@ -137,9 +137,9 @@ namespace FreeSql.Odbc.PostgreSQL
tsc.SetMapColumnTmp(null).SetMapTypeReturnOld(oldMapType);
//判断 in 或 array @> array
if (left.StartsWith("array[") || left.EndsWith("]"))
return $"{args1} in ({left.Substring(6, left.Length - 7)})";
if (left.StartsWith("(") || left.EndsWith(")"))
return $"{args1} in {left}";
return $"({args1}) in ({left.Substring(6, left.Length - 7)})";
if (left.StartsWith("(") || left.EndsWith(")")) //在各大 Provider AdoProvider 中已约定500元素分割, 3空格\r\n4空格
return $"(({args1}) in {left.Replace(", \r\n \r\n", $") \r\n OR ({args1}) in (")})";
if (args1.StartsWith("(") || args1.EndsWith(")")) args1 = $"array[{args1.TrimStart('(').TrimEnd(')')}]";
args1 = $"array[{args1}]";
if (objExp != null)