Interface ResultSet
- All Superinterfaces:
AutoCloseable,StructReader
This allows access to the data of one row at a time using the methods from the
StructReader interface. The rows are read in the order of the query results. To advance to the
next row call next(). This returns false once all the rows have been iterated
over. The result set is initially positioned before the first row, so next() must be
called before reading any data.
getMetadata() may be called before calling next. It will block until the metadata has
been received.
ResultSet implementations may buffer data ahead and/or maintain a persistent streaming
connection to the remote service until all data has been returned or the resultSet closed. As
such, it is important that all uses of ResultSet either fully consume it (that is, call
next() until false is returned or it throws an exception) or explicitly call
close(): failure to do so may result in wasted work or leaked resources.
ResultSet implementations are not required to be thread-safe: the thread that asked
for a ResultSet must be the one that interacts with it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the result set and cancels the underlying request if it is still open.Returns theResultSetMetadatafor the ResultSet.booleannext()Advances the result set to the next row, returningfalseif no such row exists.Methods inherited from interface com.google.cloud.bigtable.data.v2.models.sql.StructReader
getBoolean, getBoolean, getBytes, getBytes, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getList, getList, getLong, getLong, getMap, getMap, getString, getString, getStruct, getStruct, getTimestamp, getTimestamp, isNull, isNull
-
Method Details
-
next
boolean next()Advances the result set to the next row, returningfalseif no such row exists. Calls to data access methods will throw an exception after next has returnedFalse. -
getMetadata
ResultSetMetadata getMetadata()Returns theResultSetMetadatafor the ResultSet. Blocks until the underlying request receives the metadata. -
close
void close()Closes the result set and cancels the underlying request if it is still open. This must always be called when disposing of aResultSetbeforenext()has returnedfalseor raised an exception. Callingclose()is also allowed if the result set has been fully consumed, so a recommended practice is to unconditionally close the result set once it is done with, typically using a try-with-resources construct.- Specified by:
closein interfaceAutoCloseable
-