mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-04 13:10:57 +08:00
修复批量新增因未指定Columns导致报错
This commit is contained in:
@@ -77,13 +77,19 @@ namespace FreeSql.ClickHouse.Curd
|
|||||||
internal async Task<int> InternalBulkCopyAsync()
|
internal async Task<int> InternalBulkCopyAsync()
|
||||||
{
|
{
|
||||||
var data = ToDataTable();
|
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 conn = _orm.Ado.MasterPool.Get())
|
||||||
{
|
{
|
||||||
using (var bulkCopyInterface = new ClickHouseBulkCopy(conn.Value as ClickHouseConnection)
|
using (var bulkCopyInterface = new ClickHouseBulkCopy(conn.Value as ClickHouseConnection)
|
||||||
{
|
{
|
||||||
DestinationTableName = data.TableName,
|
DestinationTableName = data.TableName,
|
||||||
BatchSize = _source.Count
|
BatchSize = _source.Count,
|
||||||
})
|
ColumnNames =columns
|
||||||
|
})
|
||||||
{
|
{
|
||||||
await bulkCopyInterface.InitAsync();
|
await bulkCopyInterface.InitAsync();
|
||||||
await bulkCopyInterface.WriteToServerAsync(data, default);
|
await bulkCopyInterface.WriteToServerAsync(data, default);
|
||||||
|
|||||||
Reference in New Issue
Block a user