Browse Source

Update MySqlConnector

pull/20/head
sunkaixuan 2 years ago
parent
commit
e57e37e006
  1. 4
      Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlBlukCopy.cs
  2. 30
      Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlInsertBuilder.cs
  3. 4
      Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlQueryBuilder.cs
  4. 30
      Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlUpdateBuilder.cs

4
Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlBlukCopy.cs

@ -176,6 +176,10 @@ namespace SqlSugar.MySqlConnector
{
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());
}
sb.AppendLine();

30
Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlInsertBuilder.cs

@ -44,12 +44,11 @@ namespace SqlSugar.MySqlConnector
var type = UtilMethods.GetUnderType(value.GetType());
if (type == UtilConstants.DateType)
{
var date = value.ObjToDate();
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
return GetDateTimeString(value);
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
else if (value is DateTimeOffset)
{
return GetDateTimeOffsetString(value);
}
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)
{
var result = value.ToString();

4
Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlQueryBuilder.cs

@ -66,6 +66,10 @@ namespace SqlSugar.MySqlConnector
{
return "-- No table";
}
if (TranLock != null)
{
result = result + TranLock;
}
return result;
}
private string ToCountSqlString()

30
Src/Asp.NetCore2/SqlSugar.MySqlConnectorCore/MySql/SqlBuilder/MySqlUpdateBuilder.cs

@ -106,12 +106,11 @@ namespace SqlSugar.MySqlConnector
var type = UtilMethods.GetUnderType(value.GetType());
if (type == UtilConstants.DateType)
{
var date = value.ObjToDate();
if (date < UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig))
{
date = UtilMethods.GetMinDate(this.Context.CurrentConnectionConfig);
return GetDateTimeString(value);
}
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
else if (value is DateTimeOffset)
{
return GetDateTimeOffsetString(value);
}
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)
{
var result = value.ToString();

Loading…
Cancel
Save