- private string getOracleSQLIn(string[] ids, string field)
- {
- int count = Math.Min(ids.Length, 1000);
- int len = ids.Length;
- int size = len % count;
- if (size == 0)
- {
- size = len / count;
- }
- else
- {
- size = (len / count) + 1;
- }
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < size; i++)
- {
- int fromIndex = i * count;
- int toIndex = Math.Min(fromIndex + count, len);
- string productId = string.Join("','", getArrayValues(fromIndex, toIndex, ids).ToArray());
- if (i != 0)
- {
- builder.Append(" or ");
- }
- builder.Append(field).Append(" in ('").Append(productId).Append("')");
- }
- return " ("+builder.ToString()+") ";
- }
-
- public List<string> getArrayValues(int fromindex, int toindex, string[] array)
- {
- List<string> listret = new List<string>();
- for (int i = fromindex; i < toindex; i++)
- {
- listret.Add(array[i]);
- }
- return listret;
- }
posted @
2019-06-10 17:11
凌心缘
阅读(
1622)
评论()
编辑
收藏
举报