stream method

Stream<R> stream()

Streams projected rows from the native row stream.

Implementation

Stream<R> stream() async* {
  final dialect = await _resolvedDialect();
  final compileWatch = Stopwatch()..start();
  final statement = _select.compile(dialect: dialect);
  compileWatch.stop();
  mssqlNoteCompileElapsed(session, compileWatch.elapsed);
  await for (final event in session.stream(
    statement.sql,
    parameters: statement.parameters,
    options: options,
    timeout: timeout,
    cancellationToken: options.cancellationToken,
    batchRows: options.batchRows,
  )) {
    if (event is MssqlRowBatch) {
      for (final row in event.rows) {
        yield _map(row);
      }
    }
  }
}