public interface AsyncResultSet
Modifier and Type | Method and Description |
---|---|
Iterable<Row> |
currentPage()
The rows in the current page.
|
CompletionStage<? extends AsyncResultSet> |
fetchNextPage()
Fetch the next page of results asynchronously.
|
ColumnDefinitions |
getColumnDefinitions()
Returns metadata about the columns contained in this row.
|
ExecutionInfo |
getExecutionInfo()
Returns information about the execution of this page of results.
|
boolean |
hasMorePages()
Whether there are more pages of results.
|
default Row |
one()
Returns the next row, or
null if the result set is exhausted. |
int |
remaining()
How many rows are left before the current page is exhausted.
|
boolean |
wasApplied()
If the query that produced this result was a conditional update, indicate whether it was
successfully applied.
|
@NonNull ColumnDefinitions getColumnDefinitions()
@NonNull ExecutionInfo getExecutionInfo()
int remaining()
@NonNull Iterable<Row> currentPage()
hasMorePages()
and
fetchNextPage()
.
Note that this method always returns the same object, and that that object can only be iterated once: rows are "consumed" as they are read.
@Nullable default Row one()
null
if the result set is exhausted.
This is convenient for queries that are known to return exactly one row, for example count queries.
boolean hasMorePages()
fetchNextPage()
to fetch the next
one asynchronously.@NonNull CompletionStage<? extends AsyncResultSet> fetchNextPage() throws IllegalStateException
IllegalStateException
- if there are no more pages. Use hasMorePages()
to check
if you can call this method.boolean wasApplied()
This is equivalent to calling:
this.iterator().next().getBoolean("[applied]")Except that this method peeks at the next row without consuming it.
For consistency, this method always returns true
for non-conditional queries
(although there is no reason to call the method in that case). This is also the case for
conditional DDL statements (CREATE KEYSPACE... IF NOT EXISTS
, CREATE TABLE... IF
NOT EXISTS
), for which Cassandra doesn't return an [applied]
column.
Note that, for versions of Cassandra strictly lower than 2.1.0-rc2, a server-side bug (CASSANDRA-7337) causes this
method to always return true
for batches containing conditional queries.
Copyright © 2017–2018. All rights reserved.