修改海量数据库mysql BulkCopyAsync兼容性问题

This commit is contained in:
陈剑辉
2025-10-28 13:49:35 +08:00
parent 4b4aa7b3be
commit fa7b38119d

View File

@@ -39,7 +39,9 @@ namespace SqlSugar
lsColNames.Add($"\"{dt.Columns[i].ColumnName}\"");
}
string copyString = $"COPY {dt.TableName} ( {string.Join(",", lsColNames)} ) FROM STDIN (FORMAT BINARY)";
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.OpenGauss)
var innertemp = this.Context.CurrentConnectionConfig?.MoreSettings?.InnerTemp as DbType?;
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.OpenGauss ||
(this.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.Vastbase && innertemp == DbType.MySql))
{
copyString = copyString.Replace("(FORMAT BINARY)", "(FORMAT 'BINARY')");
}