Synchronization code

This commit is contained in:
sunkaixuan 2024-01-16 12:24:32 +08:00
parent 0a2d7c9e7b
commit 3cfefcf68b

View File

@ -8,7 +8,7 @@ namespace SqlSugar
public abstract partial class SqlBuilderProvider : SqlBuilderAccessory, ISqlBuilder
{
#region Variable
private string[] SqlSplicingOperator = new string[] { ">", ">=", "<", "<=", "(", ")","!=","<>","not", "=", "||", "&&","&","|","null","is","isnot","like","nolike","+","-","*","/","%" };
private string[] SqlSplicingOperator = new string[] { ">", ">=", "<", "<=", "(", ")", "!=", "<>", "not", "=", "||", "&&", "&", "|", "null", "is", "isnot", "like", "nolike", "+", "-", "*", "/", "%" };
#endregion
#region Root
@ -19,7 +19,7 @@ namespace SqlSugar
{
return GetSqlSplicingOperator(value);
}
else if (IsString(value))
else if (IsString(value))
{
return GetSqlPartByString(value, pars);
}
@ -43,7 +43,7 @@ namespace SqlSugar
private static string GetSqlSplicingOperator(object value)
{
var result= value.ObjToString();
var result = value.ObjToString();
if (result == "||") return "OR";
else if (result == "&&") return "AND";
else if (result.EqualCase("isnot")) return " IS NOT ";
@ -104,7 +104,7 @@ namespace SqlSugar
}
return parvalue;
}
private string GetParameterName(List<SugarParameter> pars, string valueString)
private string GetParameterName(List<SugarParameter> pars, string valueString)
{
object parvalue = Json2SqlHelper.GetValue(valueString);
SugarParameter parameter = new SugarParameter("@p" + pars.Count(), parvalue);
@ -115,13 +115,14 @@ namespace SqlSugar
}
internal int GetParameterNameIndex = 100;
private string GetParameterName(List<SugarParameter> pars, object parvalue)
private string GetParameterName(List<SugarParameter> pars, object parvalue)
{
var parname = "@p" + pars.Count()+"_"+(GetParameterNameIndex)+$"{this.QueryBuilder.LambdaExpressions.ParameterIndex}";
var parname = "@p" + pars.Count() + "_" + (GetParameterNameIndex) + $"{this.QueryBuilder?.LambdaExpressions?.ParameterIndex}";
SugarParameter parameter = new SugarParameter(parname, parvalue);
pars.Add(parameter);
GetParameterNameIndex++;
this.QueryBuilder.LambdaExpressions.ParameterIndex++;
if (this.QueryBuilder != null)
this.QueryBuilder.LambdaExpressions.ParameterIndex++;
return parname;
}
#endregion