Interface ResultSet
-
- All Superinterfaces:
Iterable<Row>,PagingIterable<ResultSet,Row>
public interface ResultSet extends PagingIterable<ResultSet,Row>
The result of a query.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 withStatement.setFetchSize(int). Though new pages are automatically (and transparently) fetched when needed, it is possible to force the retrieval of the next page early throughPagingIterable.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 throughCluster.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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ColumnDefinitionsgetColumnDefinitions()Returns the columns returned in this ResultSet.booleanwasApplied()If the query that produced this ResultSet was a conditional update, return whether it was successfully applied.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.datastax.driver.core.PagingIterable
all, fetchMoreResults, getAllExecutionInfo, getAvailableWithoutFetching, getExecutionInfo, isExhausted, isFullyFetched, iterator, one
-
-
-
-
Method Detail
-
getColumnDefinitions
ColumnDefinitions getColumnDefinitions()
Returns the columns returned in this ResultSet.- Returns:
- the columns returned in this ResultSet.
-
wasApplied
boolean wasApplied()
If the query that produced this ResultSet was a conditional update, return whether it was successfully applied.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
truefor 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
truefor batches containing conditional queries.- Returns:
- if the query was a conditional update, whether it was applied.
truefor other types of queries. - See Also:
- CASSANDRA-7337
-
-