Package com.google.cloud.spanner
Class ForwardingResultSet
java.lang.Object
com.google.cloud.spanner.ForwardingStructReader
com.google.cloud.spanner.ForwardingResultSet
- All Implemented Interfaces:
ProtobufResultSet
,ResultSet
,StructReader
,AutoCloseable
- Direct Known Subclasses:
ForwardingAsyncResultSet
Forwarding implementation of ResultSet that forwards all calls to a delegate.
-
Constructor Summary
ConstructorDescriptionForwardingResultSet
(ResultSet delegate) ForwardingResultSet
(com.google.common.base.Supplier<ResultSet> supplier) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canGetProtobufValue
(int columnIndex) Returns true if the protobuf value for the given column is still available.void
close()
Explicitly close the result set, releasing any associated resources.Creates an immutable version of the row that the result set is positioned over.Returns theResultSetMetadata
for thisResultSet
.com.google.protobuf.Value
getProtobufValue
(int columnIndex) Returns the column value as a protobuf value.getStats()
Returns theResultSetStats
for the query only if the query was executed in either thePLAN
or thePROFILE
mode via theReadContext.analyzeQuery(Statement, com.google.cloud.spanner.ReadContext.QueryAnalyzeMode)
method or for DML statements inReadContext.executeQuery(Statement, QueryOption...)
.boolean
next()
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, getFloat, getFloat, getFloatArray, getFloatArray, getFloatList, getFloatList, getJson, getJson, getJsonList, getJsonList, getLong, getLong, getLongArray, getLongArray, getLongList, getLongList, getPgJsonb, getPgJsonb, getPgJsonbList, getPgJsonbList, getProtoEnum, getProtoEnum, getProtoEnumList, getProtoEnumList, getProtoMessage, getProtoMessage, getProtoMessageList, getProtoMessageList, 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, getFloat, getFloat, getFloatArray, getFloatArray, getFloatList, getFloatList, getJson, getJson, getJsonList, getJsonList, getLong, getLong, getLongArray, getLongArray, getLongList, getLongList, getPgJsonb, getPgJsonb, getPgJsonbList, getPgJsonbList, getProtoEnum, getProtoEnum, getProtoEnumList, getProtoEnumList, getProtoMessage, getProtoMessage, getProtoMessageList, getProtoMessageList, getString, getString, getStringList, getStringList, getStructList, getStructList, getTimestamp, getTimestamp, getTimestampList, getTimestampList, getType, getValue, getValue, isNull, isNull
-
Constructor Details
-
ForwardingResultSet
-
ForwardingResultSet
-
-
Method Details
-
next
Description copied from interface:ResultSet
Advances the result set to the next row, returning false if no such row exists. This method may block.- Specified by:
next
in interfaceResultSet
- Throws:
SpannerException
-
canGetProtobufValue
public boolean canGetProtobufValue(int columnIndex) Description copied from interface:ProtobufResultSet
Returns true if the protobuf value for the given column is still available.- Specified by:
canGetProtobufValue
in interfaceProtobufResultSet
-
getProtobufValue
public com.google.protobuf.Value getProtobufValue(int columnIndex) Description copied from interface:ProtobufResultSet
Returns the column value as a protobuf value.This is an internal method not intended for external usage.
This method may only be called before the column value has been decoded to a plain Java object. This means that the
DecodeMode
that is used for theResultSet
must be one ofDecodeMode.LAZY_PER_ROW
andDecodeMode.LAZY_PER_COL
, and that the correspondingStructReader.getValue(int)
,StructReader.getBoolean(int)
, ... method may not yet have been called for the column.- Specified by:
getProtobufValue
in interfaceProtobufResultSet
-
getCurrentRowAsStruct
Description copied from interface:ResultSet
Creates 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 toStruct
objects is generally more expensive than processing theResultSet
directly.- Specified by:
getCurrentRowAsStruct
in interfaceResultSet
-
close
public void close()Description copied from interface:ResultSet
Explicitly close the result set, releasing any associated resources. This must always be called when disposing of aResultSet
beforeResultSet.next()
has returnedfalse
or 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResultSet
-
getStats
Description copied from interface:ResultSet
Returns theResultSetStats
for the query only if the query was executed in either thePLAN
or thePROFILE
mode 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 aResultSet
not obtained fromanalyzeQuery
orexecuteQuery
will return anull
ResultSetStats
. This method must be called afterResultSet.next()
has returned @{code false}. Calling it before that will result innull
ResultSetStats
too. -
getMetadata
Description copied from interface:ResultSet
Returns theResultSetMetadata
for thisResultSet
. This is method may only be called after callingResultSet.next()
at least once.- Specified by:
getMetadata
in interfaceResultSet
-