bulkInsert method
Copies rows into tableName through BCP.
Not an INSERT: trigger, CHECK, default and NULL handling follow
MssqlBulkOptions, which default to BCP's own (triggers off, CHECKs
off, nulls become defaults). A session that cannot bulk-copy — a
hand-written MssqlSession — throws rather than falling back to
INSERT, because the two are not interchangeable.
Implementation
@override
Future<MssqlBulkResult> bulkInsert({
required String tableName,
required Iterable<Object> rows,
Object? columns,
MssqlBulkOptions options = const MssqlBulkOptions(),
MssqlCancellationToken? cancellationToken,
void Function(int sentRows)? onProgress,
}) => _watch(
'BULK INSERT $tableName',
columns ?? tableName,
MssqlOrmQueryKind.bulkCopy,
() => inner.bulkInsert(
tableName: tableName,
rows: rows,
columns: columns,
options: options,
cancellationToken: cancellationToken,
onProgress: onProgress,
),
affected: (result) => result.insertedRows,
);