Releases the resources associated with the query result.
The query engine delivers the rows asynchronously. The query may become inactive even before all rows are consumed. The invocation of this command will cancel the execution of the query on all members if the query is still active. Otherwise it is no-op. For a result with an update count it is always no-op.
Returns row metadata of the result.
SQL row metadata if rows exist in the result; otherwise null.
Returns the number of rows updated by the statement or -1
if this result is a row set.
update count
Return whether this result has rows to iterate. False if update count is returned, true if rows are returned.
whether this result is a row set
Returns next SqlRowType iteration result. You should not call this method when result does not contain rows.
an object including value
and done
keys. The done
key indicates if
iteration is ended, i.e when there are no more results. value
holds iteration values which are in SqlRowType type.
value
has undefined value if iteration has ended.
Generated using TypeDoc
SQL query result. Depending on the statement type it represents a stream of rows or an update count.
Iteration
The SqlResult is an async iterable of SqlRowType which is either an SqlRow or regular objects. By default it returns regular JavaScript objects, containing key and values. Keys represent column names, whereas values represent row values. The default object returning behavior can be changed via the option SqlStatementOptions.returnRawResult. If it is true, SqlRow objects are returned instead of regular objects.
Use close to release the resources associated with the result.
for-await... of
Refer to for-await... of page for more information.
next()
Another approach to iterating rows is using next. Next returns an object with
done
andvalue
properties.done
is false when there are more rows to iterate, false otherwise.value
holds the current row value. Refer to iterators for more information.Usage for update count
You don't need to call close in this case.