queryStream method

Stream<PostgreSQLResultRow> queryStream(
  1. String fmtString, {
  2. dynamic substitutionValues,
  3. PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign,
  4. int fetchSize = 1000,
  5. int? timeoutInSeconds,
})

PostgreSQLConnection.queryStream com uma conexão do pool, que fica ocupada até o stream terminar ou ser cancelado.

Implementation

Stream<PostgreSQLResultRow> queryStream(
  String fmtString, {
  dynamic substitutionValues,
  PlaceholderIdentifier placeholderIdentifier = PlaceholderIdentifier.atSign,
  int fetchSize = 1000,
  int? timeoutInSeconds,
}) async* {
  if (fetchSize < 1) {
    throw ArgumentError.value(fetchSize, 'fetchSize', 'Must be positive');
  }
  final lease = await _core.acquire();
  Object? error;
  try {
    yield* lease.connection.queryStream(fmtString,
        substitutionValues: substitutionValues,
        placeholderIdentifier: placeholderIdentifier,
        fetchSize: fetchSize,
        timeoutInSeconds: timeoutInSeconds);
  } catch (e) {
    error = e;
    rethrow;
  } finally {
    lease.release(error: error);
  }
}