mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2025-12-19 09:56:51 +08:00
修复批量新增因未指定Columns导致报错
This commit is contained in:
@@ -77,13 +77,19 @@ namespace FreeSql.ClickHouse.Curd
|
||||
internal async Task<int> InternalBulkCopyAsync()
|
||||
{
|
||||
var data = ToDataTable();
|
||||
var columns = new string[_table.ColumnsByPosition.Length];
|
||||
for ( var i = 0; i < columns.Length; i++ )
|
||||
{
|
||||
columns[i] = _table.ColumnsByPosition[i].CsName;
|
||||
}
|
||||
using (var conn = _orm.Ado.MasterPool.Get())
|
||||
{
|
||||
using (var bulkCopyInterface = new ClickHouseBulkCopy(conn.Value as ClickHouseConnection)
|
||||
{
|
||||
DestinationTableName = data.TableName,
|
||||
BatchSize = _source.Count
|
||||
})
|
||||
BatchSize = _source.Count,
|
||||
ColumnNames =columns
|
||||
})
|
||||
{
|
||||
await bulkCopyInterface.InitAsync();
|
||||
await bulkCopyInterface.WriteToServerAsync(data, default);
|
||||
|
||||
Reference in New Issue
Block a user