mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 16:18:47 +08:00
Update MySqlConnector
This commit is contained in:
parent
81fceb8247
commit
e57e37e006
@ -176,6 +176,10 @@ namespace SqlSugar.MySqlConnector
|
|||||||
{
|
{
|
||||||
sb.Append(row[colum].ObjToDate().ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
sb.Append(row[colum].ObjToDate().ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||||
}
|
}
|
||||||
|
else if (colum.DataType == UtilConstants.DateType && row[colum] != null && row[colum] == DBNull.Value)
|
||||||
|
{
|
||||||
|
sb.Append("NULL");
|
||||||
|
}
|
||||||
else sb.Append(row[colum].ToString());
|
else sb.Append(row[colum].ToString());
|
||||||
}
|
}
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
@ -44,12 +44,11 @@ namespace SqlSugar.MySqlConnector
|
|||||||
var type = UtilMethods.GetUnderType(value.GetType());
|
var type = UtilMethods.GetUnderType(value.GetType());
|
||||||
if (type == UtilConstants.DateType)
|
if (type == UtilConstants.DateType)
|
||||||
{
|
{
|
||||||
var date = value.ObjToDate();
|
return GetDateTimeString(value);
|
||||||
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
|
||||||
{
|
|
||||||
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
|
||||||
}
|
}
|
||||||
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
else if (value is DateTimeOffset)
|
||||||
|
{
|
||||||
|
return GetDateTimeOffsetString(value);
|
||||||
}
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
@ -84,6 +83,27 @@ namespace SqlSugar.MySqlConnector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeOffsetString(object value)
|
||||||
|
{
|
||||||
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeString(object value)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
private string GetString(object value)
|
private string GetString(object value)
|
||||||
{
|
{
|
||||||
var result = value.ToString();
|
var result = value.ToString();
|
||||||
|
@ -66,6 +66,10 @@ namespace SqlSugar.MySqlConnector
|
|||||||
{
|
{
|
||||||
return "-- No table";
|
return "-- No table";
|
||||||
}
|
}
|
||||||
|
if (TranLock != null)
|
||||||
|
{
|
||||||
|
result = result + TranLock;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private string ToCountSqlString()
|
private string ToCountSqlString()
|
||||||
|
@ -106,12 +106,11 @@ namespace SqlSugar.MySqlConnector
|
|||||||
var type = UtilMethods.GetUnderType(value.GetType());
|
var type = UtilMethods.GetUnderType(value.GetType());
|
||||||
if (type == UtilConstants.DateType)
|
if (type == UtilConstants.DateType)
|
||||||
{
|
{
|
||||||
var date = value.ObjToDate();
|
return GetDateTimeString(value);
|
||||||
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
|
||||||
{
|
|
||||||
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
|
||||||
}
|
}
|
||||||
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
else if (value is DateTimeOffset)
|
||||||
|
{
|
||||||
|
return GetDateTimeOffsetString(value);
|
||||||
}
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
@ -154,6 +153,27 @@ namespace SqlSugar.MySqlConnector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeString(object value)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetDateTimeOffsetString(object value)
|
||||||
|
{
|
||||||
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
|
||||||
|
{
|
||||||
|
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
|
||||||
private string GetString(object value)
|
private string GetString(object value)
|
||||||
{
|
{
|
||||||
var result = value.ToString();
|
var result = value.ToString();
|
||||||
|
Loading…
Reference in New Issue
Block a user