mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 Contains 表达式解析为 where in 自动拆分,防止大于 1000 的 SQL 错误;
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
using FreeSql.Internal.Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FreeSql.Internal.CommonProvider
|
||||
@ -23,5 +25,24 @@ namespace FreeSql.Internal.CommonProvider
|
||||
try { string ret = string.Format(filter, nparms); return ret; } catch { return filter; }
|
||||
}
|
||||
static ConcurrentDictionary<int, Regex> _dicAddslashesReplaceIsNull = new ConcurrentDictionary<int, Regex>();
|
||||
|
||||
protected string AddslashesIEnumerable(object param, Type mapType, ColumnInfo mapColumn)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var ie = param as IEnumerable;
|
||||
var idx = 0;
|
||||
foreach (var z in ie)
|
||||
{
|
||||
sb.Append(",");
|
||||
if (++idx > 500)
|
||||
{
|
||||
sb.Append(" \r\n \r\n"); //500元素分割, 3空格\r\n4空格
|
||||
idx = 1;
|
||||
}
|
||||
sb.Append(AddslashesProcessParam(z, mapType, mapColumn));
|
||||
}
|
||||
|
||||
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "(").Append(")").ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user