Package com.google.cloud.spanner
Class ForwardingResultSet
- java.lang.Object
-
- com.google.cloud.spanner.ForwardingStructReader
-
- com.google.cloud.spanner.ForwardingResultSet
-
- All Implemented Interfaces:
ResultSet,StructReader,AutoCloseable
- Direct Known Subclasses:
ForwardingAsyncResultSet
public class ForwardingResultSet extends ForwardingStructReader implements ResultSet
Forwarding implementation of ResultSet that forwards all calls to a delegate.
-
-
Constructor Summary
Constructors Constructor Description ForwardingResultSet(ResultSet delegate)ForwardingResultSet(com.google.common.base.Supplier<ResultSet> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Explicitly close the result set, releasing any associated resources.StructgetCurrentRowAsStruct()Creates an immutable version of the row that the result set is positioned over.ResultSetMetadatagetMetadata()Returns theResultSetMetadatafor thisResultSet.ResultSetStatsgetStats()Returns theResultSetStatsfor the query only if the query was executed in either thePLANor thePROFILEmode via theReadContext.analyzeQuery(Statement, com.google.cloud.spanner.ReadContext.QueryAnalyzeMode)method or for DML statements inReadContext.executeQuery(Statement, QueryOption...).booleannext()Advances the result set to the next row, returning false if no such row exists.-
Methods inherited from class com.google.cloud.spanner.ForwardingStructReader
checkValidState, getBigDecimal, getBigDecimal, getBigDecimalList, getBigDecimalList, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getBooleanList, getBooleanList, getBytes, getBytes, getBytesList, getBytesList, getColumnCount, getColumnIndex, getColumnType, getColumnType, getDate, getDate, getDateList, getDateList, getDouble, getDouble, getDoubleArray, getDoubleArray, getDoubleList, getDoubleList, getJson, getJson, getJsonList, getJsonList, getLong, getLong, getLongArray, getLongArray, getLongList, getLongList, getPgJsonb, getPgJsonb, getPgJsonbList, getPgJsonbList, getString, getString, getStringList, getStringList, getStructList, getStructList, getTimestamp, getTimestamp, getTimestampList, getTimestampList, getType, getValue, getValue, isNull, isNull
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.spanner.StructReader
getBigDecimal, getBigDecimal, getBigDecimalList, getBigDecimalList, getBoolean, getBoolean, getBooleanArray, getBooleanArray, getBooleanList, getBooleanList, getBytes, getBytes, getBytesList, getBytesList, getColumnCount, getColumnIndex, getColumnType, getColumnType, getDate, getDate, getDateList, getDateList, getDouble, getDouble, getDoubleArray, getDoubleArray, getDoubleList, getDoubleList, getJson, getJson, getJsonList, getJsonList, getLong, getLong, getLongArray, getLongArray, getLongList, getLongList, getPgJsonb, getPgJsonb, getPgJsonbList, getPgJsonbList, getString, getString, getStringList, getStringList, getStructList, getStructList, getTimestamp, getTimestamp, getTimestampList, getTimestampList, getType, getValue, getValue, isNull, isNull
-
-
-
-
Method Detail
-
next
public boolean next() throws SpannerExceptionDescription copied from interface:ResultSetAdvances the result set to the next row, returning false if no such row exists. This method may block.- Specified by:
nextin interfaceResultSet- Throws:
SpannerException
-
getCurrentRowAsStruct
public Struct getCurrentRowAsStruct()
Description copied from interface:ResultSetCreates an immutable version of the row that the result set is positioned over. This may involve copying internal data structures, and so converting all rows toStructobjects is generally more expensive than processing theResultSetdirectly.- Specified by:
getCurrentRowAsStructin interfaceResultSet
-
close
public void close()
Description copied from interface:ResultSetExplicitly close the result set, releasing any associated resources. This must always be called when disposing of aResultSetbeforeResultSet.next()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- Specified by:
closein interfaceResultSet
-
getStats
public ResultSetStats getStats()
Description copied from interface:ResultSetReturns theResultSetStatsfor the query only if the query was executed in either thePLANor thePROFILEmode via theReadContext.analyzeQuery(Statement, com.google.cloud.spanner.ReadContext.QueryAnalyzeMode)method or for DML statements inReadContext.executeQuery(Statement, QueryOption...). Attempts to call this method on aResultSetnot obtained fromanalyzeQueryorexecuteQuerywill return anullResultSetStats. This method must be called afterResultSet.next()has returned @{code false}. Calling it before that will result innullResultSetStatstoo.
-
getMetadata
public ResultSetMetadata getMetadata()
Description copied from interface:ResultSetReturns theResultSetMetadatafor thisResultSet. This is method may only be called after callingResultSet.next()at least once.- Specified by:
getMetadatain interfaceResultSet
-
-