Skip to content

Commit bcd1163

Browse files
committed
修复批量新增因未指定Columns导致报错
1 parent 94c9dc3 commit bcd1163

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseInsert.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,19 @@ protected override int RawExecuteAffrows()
7777
internal async Task<int> InternalBulkCopyAsync()
7878
{
7979
var data = ToDataTable();
80+
var columns = new string[_table.ColumnsByPosition.Length];
81+
for ( var i = 0; i < columns.Length; i++ )
82+
{
83+
columns[i] = _table.ColumnsByPosition[i].CsName;
84+
}
8085
using (var conn = _orm.Ado.MasterPool.Get())
8186
{
8287
using (var bulkCopyInterface = new ClickHouseBulkCopy(conn.Value as ClickHouseConnection)
8388
{
8489
DestinationTableName = data.TableName,
85-
BatchSize = _source.Count
86-
})
90+
BatchSize = _source.Count,
91+
ColumnNames =columns
92+
})
8793
{
8894
await bulkCopyInterface.InitAsync();
8995
await bulkCopyInterface.WriteToServerAsync(data, default);

0 commit comments

Comments
 (0)