QueryResult class
Represents the result of a SQL query execution.
Contains the column names, row data, and row count. Each row is a list of dynamic values corresponding to the columns in the same order.
Example:
final result = QueryResult(
columns: ['id', 'name', 'age'],
rows: [
[1, 'Alice', 30],
[2, 'Bob', 25],
],
rowCount: 2,
);
- Available extensions
Constructors
-
QueryResult({required List<
String> columns, required List<List> rows, required int rowCount, List outputParamValues = const <dynamic>[], List<QueryResult> refCursorResults = const <QueryResult>[], List<DirectedMultiItem> additionalResults = const <DirectedMultiItem>[], List<ColumnMetadata> ? columnsMetadata}) -
Creates a new QueryResult instance.
const
Properties
-
additionalResults
→ List<
DirectedMultiItem> -
Additional result sets and row-counts returned by a directed OUT call
when the stored procedure / batch produced more than one ODBC result after
SQLMoreResults(theMULTenvelope path).final -
columns
→ List<
String> -
Column names in the order they appear in the query result.
final
-
columnsMetadata
→ List<
ColumnMetadata> ? -
Optional rich metadata per column (name + protocol type
discriminant). Populated when the result came through the binary
protocol parser; remains
nullfor results constructed from streams that don't carry metadata or for tests/ad-hoc callers.final -
firstRowOrNull
→ Map<
String, Object?> ? -
Available on QueryResult, provided by the QueryResultAccess extension
First row as a map, ornullwhen isEmpty.no setter - hasAdditionalResults → bool
-
True when additionalResults is non-empty.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasOutputParamValues → bool
-
True when outputParamValues is non-empty.
no setter
- hasRefCursorResults → bool
-
True when refCursorResults is non-empty.
no setter
- isEmpty → bool
-
Returns true if the result set contains no rows.
no setter
- isNotEmpty → bool
-
Returns true if the result set contains at least one row.
no setter
- outputParamValues → List
-
Values for
OUT/INOUTparameters, when a directed (DRT1) execute is used and the engine appends theOUT1footer. Empty when the query used onlyINPUTparameters or a legacy v0 parameter buffer. Entries are typically the sealedParamValuetypes from the package'sparam_valueprotocol — scalarOUT/INOUTonly (noParamValueRefCursorOut); seedoc/notes/TYPE_MAPPING.md§3.1.1.final -
refCursorResults
→ List<
QueryResult> -
When the native
RC1\0trailer is present, each entry is a full result set materialized from aSYS_REFCURSOR(or similar)OUTparameter.final - rowCount → int
-
Total number of rows in the result set.
final
-
rows
→ List<
List> -
Row data as a list of lists, where each inner list represents one row.
final
-
rowsAsMaps
→ List<
Map< String, Object?> > -
Available on QueryResult, provided by the QueryResultAccess extension
All rows as name → value maps aligned with columns.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cell(
int row, String column, {bool ignoreCase = false}) → Object? -
Available on QueryResult, provided by the QueryResultAccess extension
Returns the value atrow/column, ornullwhen out of range. -
cellAs<
T> (int row, String column, {bool ignoreCase = false}) → T? -
Available on QueryResult, provided by the QueryResultAccess extension
Returns the value atrow/columncast toT, ornullwhen absent or not assignable toT. -
columnIndex(
String column, {bool ignoreCase = false}) → int? -
Available on QueryResult, provided by the QueryResultAccess extension
Returns the zero-based index ofcolumn, ornullwhen absent. -
columnValues<
T> (String column, {bool ignoreCase = false, bool includeNulls = true}) → List< T?> -
Available on QueryResult, provided by the QueryResultAccess extension
Returns all values forcolumnas a typed list. -
firstValue<
T> (String column, {bool ignoreCase = false}) → T? -
Available on QueryResult, provided by the QueryResultAccess extension
Returns the first row's value forcolumn, ornullwhen empty. -
hasColumn(
String column, {bool ignoreCase = false}) → bool -
Available on QueryResult, provided by the QueryResultAccess extension
Returns true whencolumnexists in columns. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rowAsMap(
int row) → Map< String, Object?> -
Available on QueryResult, provided by the QueryResultAccess extension
Returns rowrowas a name → value map aligned with columns. -
scalar<
T> (String column, {bool ignoreCase = false}) → T? -
Available on QueryResult, provided by the QueryResultAccess extension
Single scalar from the first row forcolumn, ornullwhen empty or not assignable toT. Alias for firstValue. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited