streamRows method
Stream<MssqlRow>
streamRows(
- String sql, {
- Object parameters = const <String, Object?>{},
- MssqlQueryOptions options = MssqlQueryOptions.defaults,
- Duration? timeout,
- MssqlCancellationToken? cancellationToken,
- int? batchRows,
- int? maximumRows,
- int? maximumBytes,
inherited
Typed rows from a single row-producing result set, as they arrive.
Implementation
Stream<MssqlRow> streamRows(
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: 'streamRows supports one row-producing result set.',
);
}
if (event is MssqlRowBatch) {
for (final row in event.rows) {
yield row;
}
}
}
}