streamQueryBatched method
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);
}