queryRows method

Future<List<Map<String, Object?>>> queryRows(
  1. String sql, {
  2. Object parameters = const <String, Object?>{},
  3. MssqlQueryOptions options = MssqlQueryOptions.defaults,
  4. Duration? timeout,
  5. MssqlCancellationToken? cancellationToken,
  6. int? batchRows,
  7. int? maximumRows,
  8. int? maximumBytes,
  9. MssqlRetryPolicy? retry,
})
inherited

The first result set as maps.

Retry is disabled by default because returning rows does not prove that a statement is read-only. See MssqlRetryPolicy.

Implementation

Future<List<Map<String, Object?>>> queryRows(
  String sql, {
  Object parameters = const <String, Object?>{},
  MssqlQueryOptions options = MssqlQueryOptions.defaults,
  Duration? timeout,
  MssqlCancellationToken? cancellationToken,
  int? batchRows,
  int? maximumRows,
  int? maximumBytes,
  MssqlRetryPolicy? retry,
}) async {
  final result = await query(
    sql,
    parameters: parameters,
    options: options,
    timeout: timeout,
    cancellationToken: cancellationToken,
    batchRows: batchRows,
    maximumRows: maximumRows,
    maximumBytes: maximumBytes,
    retry: retry,
  );
  return result.resultSets.isEmpty
      ? const <Map<String, Object?>>[]
      : result.resultSets.first.rows;
}