Add SqlFunc.BiwiseAnd BiwiselusiveOR

This commit is contained in:
skx 2020-11-07 12:54:42 +08:00
parent 940b15bc17
commit d19b004229
4 changed files with 21 additions and 1 deletions

View File

@ -420,5 +420,17 @@ namespace SqlSugar
var parameter = model.Args[0];
return string.Format(" CAST({0} AS VARCHAR(MAX))", parameter.MemberName);
}
public string BitwiseAnd(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
var parameter2 = model.Args[1];
return string.Format(" ({0} & {1}) ", parameter.MemberName, parameter2.MemberName); ;
}
public string BitwiseInclusiveOR(MethodCallExpressionModel model)
{
var parameter = model.Args[0];
var parameter2 = model.Args[1];
return string.Format(" ({0} | {1}) ", parameter.MemberName, parameter2.MemberName); ;
}
}
}

View File

@ -65,5 +65,7 @@ namespace SqlSugar
string GetDate();
string GetRandom();
string CharIndex(MethodCallExpressionModel model);
string BitwiseAnd(MethodCallExpressionModel model);
string BitwiseInclusiveOR(MethodCallExpressionModel model);
}
}

View File

@ -65,7 +65,7 @@ namespace SqlSugar
{
return thisValue.Equals(parameterValue);
}
public new static bool EqualsNull(object thisValue, object parameterValue)
public static bool EqualsNull(object thisValue, object parameterValue)
{
return thisValue.Equals(parameterValue);
}
@ -137,5 +137,7 @@ namespace SqlSugar
public static Subqueryable<T> Subqueryable<T>() where T:class,new(){ throw new NotSupportedException("Can only be used in expressions");}
public static CaseThen IF(bool condition) { throw new NotSupportedException("Can only be used in expressions"); }
public static int CharIndex(string findChar,string searchValue) { throw new NotSupportedException("Can only be used in expressions"); }
public static int BitwiseAnd(int left, int right) { throw new NotSupportedException("Can only be used in expressions"); }
public static int BitwiseInclusiveOR(int left, int right) { throw new NotSupportedException("Can only be used in expressions"); }
}
}

View File

@ -664,6 +664,10 @@ namespace SqlSugar
return this.Context.DbMehtods.GetRandom();
case "CharIndex":
return this.Context.DbMehtods.CharIndex(model);
case "BitwiseAnd":
return this.Context.DbMehtods.BitwiseAnd(model);
case "BitwiseInclusiveOR":
return this.Context.DbMehtods.BitwiseInclusiveOR(model);
default:
break;
}