streamQueryBatched method

Stream<ParsedRowBuffer> streamQueryBatched(
  1. int connectionId,
  2. String sql, {
  3. int fetchSize = 1000,
  4. int chunkSize = 64 * 1024,
  5. int? maxBufferBytes,
})

Runs sql in the worker and yields one ParsedRowBuffer.

Fetches the full result in one shot, then parses it. For very large result sets, consider sync mode or a dedicated streaming API. fetchSize and chunkSize are hints; behavior may match sync batching. When maxBufferBytes is set, caps the result buffer size.

Implementation

Stream<ParsedRowBuffer> streamQueryBatched(
  int connectionId,
  String sql, {
  int fetchSize = 1000,
  int chunkSize = 64 * 1024,
  int? maxBufferBytes,
}) async* {
  final data = await executeQueryParams(
    connectionId,
    sql,
    [],
    maxBufferBytes: maxBufferBytes,
  );
  if (data == null || data.isEmpty) return;
  yield BinaryProtocolParser.parse(data);
}