mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 10:24:55 +08:00
Add sqlfunc tochar todate datediff
This commit is contained in:
@@ -443,5 +443,25 @@ namespace SqlSugar
|
|||||||
var parameter2 = model.Args[1];
|
var parameter2 = model.Args[1];
|
||||||
return string.Format(" ({0} | {1}) ", parameter.MemberName, parameter2.MemberName); ;
|
return string.Format(" ({0} | {1}) ", parameter.MemberName, parameter2.MemberName); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Oracle_ToDate(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameter = model.Args[0];
|
||||||
|
var parameter2 = model.Args[1];
|
||||||
|
return string.Format(" to_date({0},{1}) ", parameter.MemberName, parameter2.MemberName); ;
|
||||||
|
}
|
||||||
|
public string Oracle_ToChar(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameter = model.Args[0];
|
||||||
|
var parameter2 = model.Args[1];
|
||||||
|
return string.Format("to_char({0},{1}) ", parameter.MemberName, parameter2.MemberName); ;
|
||||||
|
}
|
||||||
|
public string SqlServer_DateDiff(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameter = model.Args[0];
|
||||||
|
var parameter2 = model.Args[1];
|
||||||
|
var parameter3 = model.Args[2];
|
||||||
|
return string.Format(" DATEDIFF({0},{1},{2}) ", parameter.MemberName, parameter2.MemberName, parameter3.MemberName); ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,5 +68,9 @@ namespace SqlSugar
|
|||||||
string CharIndex(MethodCallExpressionModel model);
|
string CharIndex(MethodCallExpressionModel model);
|
||||||
string BitwiseAnd(MethodCallExpressionModel model);
|
string BitwiseAnd(MethodCallExpressionModel model);
|
||||||
string BitwiseInclusiveOR(MethodCallExpressionModel model);
|
string BitwiseInclusiveOR(MethodCallExpressionModel model);
|
||||||
|
|
||||||
|
DateTime Oracle_ToDate(MethodCallExpressionModel model);
|
||||||
|
string Oracle_ToChar(MethodCallExpressionModel model);
|
||||||
|
int SqlServer_DateDiff(MethodCallExpressionModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,5 +140,8 @@ namespace SqlSugar
|
|||||||
public static int CharIndex(string findChar,string searchValue) { 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 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 BitwiseInclusiveOR(int left, int right) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||||
|
public static DateTime Oracle_ToDate(object date,string format) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||||
|
public static string Oracle_ToChar(object date, string format) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||||
|
public static int SqlServer_DateDiff(string dateType,DateTime date1,DateTime date2) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -680,6 +680,12 @@ namespace SqlSugar
|
|||||||
return this.Context.DbMehtods.BitwiseInclusiveOR(model);
|
return this.Context.DbMehtods.BitwiseInclusiveOR(model);
|
||||||
case "ToDateShort":
|
case "ToDateShort":
|
||||||
return this.Context.DbMehtods.ToDateShort(model);
|
return this.Context.DbMehtods.ToDateShort(model);
|
||||||
|
case "Oracle_ToChar":
|
||||||
|
return this.Context.DbMehtods.Oracle_ToChar(model);
|
||||||
|
case "Oracle_ToDate":
|
||||||
|
return this.Context.DbMehtods.Oracle_ToDate(model);
|
||||||
|
case "SqlServer_DateDiff":
|
||||||
|
return this.Context.DbMehtods.SqlServer_DateDiff(model);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user