com.datastax.driver.core.ResultSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dse-java-driver-core Show documentation
Show all versions of dse-java-driver-core Show documentation
A driver for DataStax Enterprise (DSE)
and Apache Cassandra 1.2+ clusters that works exclusively with the
Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol,
supporting DSE-specific features such as geospatial types, DSE Graph and DSE authentication.
/*
* Copyright DataStax, Inc.
*
* This software can be used solely with DataStax Enterprise. Please consult the license at
* http://www.datastax.com/terms/datastax-dse-driver-license-terms
*/
package com.datastax.driver.core;
/**
* 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 {@link QueryOptions#setFetchSize} or per-statement
* with {@link Statement#setFetchSize}. Though new pages are automatically (and
* transparently) fetched when needed, it is possible to force the retrieval
* of the next page early through {@link #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 {@link Cluster.Builder#withProtocolVersion}). 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.
*/
public interface ResultSet extends PagingIterable {
// redeclared only to make clirr happy
@Override
Row one();
/**
* Returns the columns returned in this ResultSet.
*
* @return the columns returned in this ResultSet.
*/
public ColumnDefinitions getColumnDefinitions();
/**
* 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]");
*
*
* For consistency, this method always returns {@code 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
* ({@code CREATE KEYSPACE... IF NOT EXISTS}, {@code CREATE TABLE... IF NOT EXISTS}),
* for which Cassandra doesn't return an {@code [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
* {@code true} for batches containing conditional queries.
*
* @return if the query was a conditional update, whether it was applied.
* {@code true} for other types of queries.
* @see CASSANDRA-7337
*/
public boolean wasApplied();
}