streamBatches method
Stream<List<Map<String, Object?> > >
streamBatches(
- String sql, {
- Object parameters = const <String, Object?>{},
- MssqlQueryOptions options = MssqlQueryOptions.defaults,
- Duration? timeout,
- MssqlCancellationToken? cancellationToken,
- int? batchRows,
- int? maximumRows,
- int? maximumBytes,
inherited
Batches of maps from a single row-producing result set.
Implementation
Stream<List<Map<String, Object?>>> streamBatches(
String sql, {
Object parameters = const <String, Object?>{},
MssqlQueryOptions options = MssqlQueryOptions.defaults,
Duration? timeout,
MssqlCancellationToken? cancellationToken,
int? batchRows,
int? maximumRows,
int? maximumBytes,
}) async* {
var resultSets = 0;
await for (final event in stream(
sql,
parameters: parameters,
options: options,
timeout: timeout,
cancellationToken: cancellationToken,
batchRows: batchRows,
maximumRows: maximumRows,
maximumBytes: maximumBytes,
)) {
if (event is MssqlResultSetStart && ++resultSets > 1) {
throw const MssqlException(
type: MssqlErrorType.protocol,
message: 'streamBatches supports one row-producing result set.',
);
}
if (event is MssqlRowBatch) {
yield event.rows.map((row) => row.toMap()).toList(growable: false);
}
}
}