mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-04 04:37:58 +08:00
Add SqlFunc.CharIndexNew
This commit is contained in:
parent
b1370c6d7e
commit
27f8069c7e
@ -514,11 +514,15 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
return reslut.ToString();
|
||||
}
|
||||
}
|
||||
public virtual string CharIndex(MethodCallExpressionModel model)
|
||||
{
|
||||
return string.Format("CHARINDEX ({0},{1})", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
}
|
||||
public virtual string CharIndexNew(MethodCallExpressionModel model)
|
||||
{
|
||||
return CharIndex(model);
|
||||
}
|
||||
|
||||
public virtual string ToVarchar(MethodCallExpressionModel model)
|
||||
{
|
||||
|
@ -69,6 +69,7 @@ namespace SqlSugar
|
||||
string GetDate();
|
||||
string GetRandom();
|
||||
string CharIndex(MethodCallExpressionModel model);
|
||||
string CharIndexNew(MethodCallExpressionModel model);
|
||||
string BitwiseAnd(MethodCallExpressionModel model);
|
||||
string BitwiseInclusiveOR(MethodCallExpressionModel model);
|
||||
|
||||
|
@ -345,7 +345,9 @@ namespace SqlSugar
|
||||
/// <returns></returns>
|
||||
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"); }
|
||||
[Obsolete("多库下参数顺序不一至,为了保证多库下更好体验请使用 SqlFunc.CharIndexNew")]
|
||||
public static int CharIndex(string findChar,string searchValue) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static int CharIndexNew(string stringValue, string charValue) { 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"); }
|
||||
public static int BitwiseAnd(long left, long right) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
|
@ -104,6 +104,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class KdbndpMethod : DefaultDbMethod, IDbMethods
|
||||
{
|
||||
public override string CharIndexNew(MethodCallExpressionModel model)
|
||||
{
|
||||
return string.Format(" (strpos ({0},{1}))", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
}
|
||||
public override string CharIndex(MethodCallExpressionModel model)
|
||||
{
|
||||
return string.Format(" (strpos ({1},{0})-1)", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
|
@ -137,6 +137,10 @@ namespace SqlSugar
|
||||
{
|
||||
return string.Format(" (strpos ({1},{0})-1)", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
}
|
||||
public override string CharIndexNew(MethodCallExpressionModel model)
|
||||
{
|
||||
return string.Format(" (strpos ({0},{1}))", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
}
|
||||
public override string TrueValue()
|
||||
{
|
||||
return "true";
|
||||
|
@ -20,6 +20,10 @@ namespace SqlSugar
|
||||
}
|
||||
public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
|
||||
{
|
||||
public override string CharIndexNew(MethodCallExpressionModel model)
|
||||
{
|
||||
return string.Format("CHARINDEX ({1},{0})", model.Args[0].MemberName, model.Args[1].MemberName);
|
||||
}
|
||||
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||
{
|
||||
var parameterNameA = mode.Args[0].MemberName;
|
||||
|
Loading…
Reference in New Issue
Block a user