public interface ResultSet extends PagingIterable<ResultSet,Row>
The retrieval of the rows of a ResultSet is generally paged (a first page of result is fetched
and the next one is only fetched once all the results of the first one has been consumed). The
size of the pages can be configured either globally through QueryOptions.setFetchSize(int)
or
per-statement with Statement.setFetchSize(int)
. Though new pages are automatically (and
transparently) fetched when needed, it is possible to force the retrieval of the next page early
through PagingIterable.fetchMoreResults()
. Please note however that this ResultSet paging is not
available with the version 1 of the native protocol (i.e. with Cassandra 1.2 or if version 1 has
been explicitly requested through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
). If the protocol
version 1 is in use, a ResultSet is always fetched in it's entirely and it's up to the client to
make sure that no query can yield ResultSet that won't hold in memory.
Note that this class is not thread-safe.
Modifier and Type | Method and Description |
---|---|
ColumnDefinitions |
getColumnDefinitions()
Returns the columns returned in this ResultSet.
|
Row |
one()
Returns the next result from this result set.
|
boolean |
wasApplied()
If the query that produced this ResultSet was a conditional update, return whether it was
successfully applied.
|
all, fetchMoreResults, getAllExecutionInfo, getAvailableWithoutFetching, getExecutionInfo, isExhausted, isFullyFetched, iterator
forEach, spliterator
Row one()
PagingIterable
one
in interface PagingIterable<ResultSet,Row>
ColumnDefinitions getColumnDefinitions()
boolean wasApplied()
This is equivalent to calling:
rs.one().getBool("[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.0.9 and 2.1.0-rc2, a server-side
bug (CASSANDRA-7337) causes this method to always return true
for batches containing
conditional queries.
true
for other
types of queries.Copyright © 2012–2019. All rights reserved.