mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
SqlServer date to string optimization
This commit is contained in:
@@ -899,6 +899,10 @@ namespace SqlSugar
|
|||||||
formatString = formatString.Replace("M", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
formatString = formatString.Replace("M", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
||||||
|
|
||||||
parameters.Args.Last().MemberValue = DateType.Day;
|
parameters.Args.Last().MemberValue = DateType.Day;
|
||||||
|
if (IsSqlServer())
|
||||||
|
{
|
||||||
|
formatString = formatString.Replace("dd",begin+ UtilMethods.ConvertStringToNumbers( string.Format("CASE WHEN LEN({0})=1 THEN '0'+ {0} else {0} end", this.GetMethodValue("DateValue", parameters))) + end);
|
||||||
|
}
|
||||||
formatString = formatString.Replace("dd", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
formatString = formatString.Replace("dd", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
||||||
formatString = formatString.Replace("d", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
formatString = formatString.Replace("d", begin + UtilMethods.ConvertStringToNumbers(this.GetMethodValue("DateValue", parameters).ObjToString()) + end);
|
||||||
|
|
||||||
@@ -951,7 +955,10 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return this.GetMethodValue("MergeString", joinStringParameter).ObjToString();
|
return this.GetMethodValue("MergeString", joinStringParameter).ObjToString();
|
||||||
}
|
}
|
||||||
|
private bool IsSqlServer()
|
||||||
|
{
|
||||||
|
return this.Context is SqlServerExpressionContext;
|
||||||
|
}
|
||||||
private bool IsMySql()
|
private bool IsMySql()
|
||||||
{
|
{
|
||||||
return this.Context is MySqlExpressionContext;
|
return this.Context is MySqlExpressionContext;
|
||||||
|
|||||||
Reference in New Issue
Block a user