Browse Source

Update mysql bulkcopy

SqlSugar5
sunkaixuan 2 years ago
parent
commit
04fcf8afa9
  1. 14
      Src/Asp.Net/SqlSugar/Abstract/FastestProvider/Private.cs

14
Src/Asp.Net/SqlSugar/Abstract/FastestProvider/Private.cs

@ -175,6 +175,14 @@ namespace SqlSugar
}
}
).Copy();
List<string> uInt64TypeName = new List<string>();
foreach (DataColumn item in tempDataTable.Columns)
{
if (item.DataType == typeof(UInt64))
{
uInt64TypeName.Add(item.ColumnName);
}
}
var temColumnsList = tempDataTable.Columns.Cast<DataColumn>().Select(it => it.ColumnName.ToLower()).ToList();
var columns = dt.Columns.Cast<DataColumn>().Where(it => temColumnsList.Contains(it.ColumnName.ToLower())).ToList();
foreach (DataRow item in dt.Rows)
@ -184,13 +192,13 @@ namespace SqlSugar
{
dr[column.ColumnName] = item[column.ColumnName];
if (dr[column.ColumnName] == null)
if (dr[column.ColumnName] == null|| dr[column.ColumnName] == DBNull.Value)
{
dr[column.ColumnName] = DBNull.Value;
}
if (column.DataType==UtilConstants.BoolType&&this.context.CurrentConnectionConfig.DbType.IsIn(DbType.MySql, DbType.MySqlConnector))
else if(column.DataType==UtilConstants.BoolType&&this.context.CurrentConnectionConfig.DbType.IsIn(DbType.MySql, DbType.MySqlConnector))
{
if (Convert.ToBoolean(dr[column.ColumnName]) == false)
if (Convert.ToBoolean(dr[column.ColumnName]) == false&&uInt64TypeName.Any(z => z.EqualCase(column.ColumnName)))
{
dr[column.ColumnName] = DBNull.Value;
}

Loading…
Cancel
Save