streamFetch method
Fetches the next chunk of data from a streaming query.
The streamId must be a valid stream identifier from streamStart.
Pass bufferSize equal to the stream chunkSize so the FFI allocation
matches the native copy budget on the first attempt.
Returns a StreamFetchResult with success status, data, and hasMore flag.
Implementation
StreamFetchResult streamFetch(
int streamId, {
int? bufferSize,
}) {
final fetched = streamCallWithBuffer(
(buf, bufLen, outWritten, hasMore) => _bindings.odbc_stream_fetch(
streamId,
buf,
bufLen,
outWritten,
hasMore,
),
initialSize: bufferSize,
);
if (fetched != null) {
return StreamFetchResult(
success: true,
data: fetched.data,
hasMore: fetched.hasMore,
);
}
return StreamFetchResult(
success: false,
data: null,
hasMore: false,
);
}