streamQuery method

Stream<ParsedRowBuffer> streamQuery(
  1. int connectionId,
  2. String sql, {
  3. int chunkSize = 1000,
})
inherited

Executes a SQL query and returns results as a batched stream.

Since v4.1.0 this delegates to streamQueryBatched (cursor-based odbc_stream_start_batched) so memory stays bounded to one fetch batch. chunkSize is interpreted as fetchSize (rows per yielded chunk).

Example:

await for (final chunk in native.streamQuery(
  connId,
  'SELECT * FROM users',
)) {
  // Process chunk
}

Implementation

Stream<ParsedRowBuffer> streamQuery(
  int connectionId,
  String sql, {
  int chunkSize = 1000,
}) =>
    streamQueryBatched(
      connectionId,
      sql,
      fetchSize: chunkSize,
    );