Method GetQueryAsyncEnumerable
GetQueryAsyncEnumerable(string, QueryOptions, CancellationToken)
Declaration
public IAsyncEnumerable<QueryResult<RecordValue>> GetQueryAsyncEnumerable(string statement, QueryOptions options = null, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| string |
statement |
Query SQL statement. |
| QueryOptions |
options |
(Optional) Options for the Query
operation. If not specified or null, appropriate defaults
will be used. See QueryOptions. |
| CancellationToken |
cancellationToken |
(Optional) Cancellation token. |
Returns
Examples
Asynchronously iterating over
GetQueryAsyncEnumerable.
await foreach(var result in client.GetQueryAsyncEnumerable(
"SELECT * FROM myTable"))
{
foreach(var row in result.Rows)
{
// row is an instance of
Console.WriteLine($"Id: {row["id"]}, Name: {row["name"]}");
}
}
Exceptions
See Also
GetQueryAsyncEnumerable(PreparedStatement, QueryOptions, CancellationToken)
Declaration
public IAsyncEnumerable<QueryResult<RecordValue>> GetQueryAsyncEnumerable(PreparedStatement preparedStatement, QueryOptions options = null, CancellationToken cancellationToken = default)
Parameters
| Type |
Name |
Description |
| PreparedStatement |
preparedStatement |
Prepared query statement. |
| QueryOptions |
options |
(Optional) Options for the Query
operation. If not specified or null, appropriate defaults
will be used. See QueryOptions. |
| CancellationToken |
cancellationToken |
(Optional) Cancellation token. |
Returns
Exceptions
| Type |
Condition |
| ArgumentException |
If
preparedStatement is null or invalid or
options contains invalid values or if the
statement uses external variables and there is a variable that
was not bound or if a variable was bound that is not present in
the query. |
| TimeoutException |
Operation has timed out. |
| InvalidOperationException |
The table or
the service is not in a valid state to perform this operation. |
| NoSQLException |
NoSQLException or
one of its subclasses is thrown if operation cannot be performed
for any other reason. See documentation for corresponding
subclass of NoSQLException. |
| PrepareQueryException |
During iteration, the
required topology is unavailable or the negotiated protocol cannot
represent this statement's store identity. Prepare the query again
using this client and start a new execution without a continuation
key. |
See Also