mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Optimized code
This commit is contained in:
parent
06470a4a22
commit
9695626416
@ -720,7 +720,7 @@ namespace SqlSugar
|
||||
|
||||
private static bool IsExists(string sql)
|
||||
{
|
||||
return sql.Contains("WHERE (EXISTS") || sql.Contains("((EXISTS (");
|
||||
return UtilMethods.CountSubstringOccurrences(sql,"WHERE")>1;
|
||||
}
|
||||
|
||||
private void ThrowUpdateByExpression()
|
||||
|
@ -18,6 +18,11 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
public static int CountSubstringOccurrences(string mainString, string searchString)
|
||||
{
|
||||
string[] substrings = mainString.Split(new string[] { searchString }, StringSplitOptions.None);
|
||||
return substrings.Length - 1;
|
||||
}
|
||||
public static string RemoveBeforeFirstWhere(string query)
|
||||
{
|
||||
int whereIndex = query.IndexOf("WHERE", StringComparison.OrdinalIgnoreCase);
|
||||
|
Loading…
Reference in New Issue
Block a user