streamNativeQueryWithFallback method

Stream<ParsedRowBuffer> streamNativeQueryWithFallback(
  1. int nativeId,
  2. String sql, {
  3. int? maxBufferBytes,
  4. ResultEncoding resultEncoding = ResultEncoding.rowMajor,
  5. bool lazyStrings = false,
  6. Uint8List? paramsBuffer,
  7. int fetchSize = 1000,
  8. int chunkSize = 64 * 1024,
})

Implementation

Stream<ParsedRowBuffer> streamNativeQueryWithFallback(
  int nativeId,
  String sql, {
  int? maxBufferBytes,
  ResultEncoding resultEncoding = ResultEncoding.rowMajor,
  bool lazyStrings = false,
  Uint8List? paramsBuffer,
  int fetchSize = 1000,
  int chunkSize = 64 * 1024,
}) async* {
  final batched = ffi.isAsync
      ? ffi.async.streamQueryBatched(
          nativeId,
          sql,
          fetchSize: fetchSize,
          chunkSize: chunkSize,
          maxBufferBytes: maxBufferBytes,
          resultEncodingWire: resultEncoding.wireCode,
          lazyStrings: lazyStrings,
          paramsBuffer: paramsBuffer,
        )
      : ffi.sync.streamQueryBatched(
          nativeId,
          sql,
          fetchSize: fetchSize,
          chunkSize: chunkSize,
          resultEncoding: resultEncoding,
          lazyStrings: lazyStrings,
          paramsBuffer: paramsBuffer,
        );

  await for (final chunk in batched) {
    yield chunk;
  }
}