Class ForwardingResultSet (6.83.0)

public class ForwardingResultSet extends ForwardingStructReader implements ProtobufResultSet, StreamingResultSet

Forwarding implementation of ResultSet that forwards all calls to a delegate.

Inheritance

java.lang.Object > ForwardingStructReader > ForwardingResultSet

Implements

ProtobufResultSet, com.google.cloud.spanner.StreamingResultSet

Constructors

ForwardingResultSet(ResultSet delegate)

public ForwardingResultSet(ResultSet delegate)
Parameter
Name Description
delegate ResultSet

ForwardingResultSet(Supplier<? extends ResultSet> supplier)

public ForwardingResultSet(Supplier<? extends ResultSet> supplier)
Parameter
Name Description
supplier com.google.common.base.Supplier<? extends com.google.cloud.spanner.ResultSet>

Methods

canGetProtobufValue(int columnIndex)

public boolean canGetProtobufValue(int columnIndex)

Returns true if the protobuf value for the given column is still available.

Parameter
Name Description
columnIndex int
Returns
Type Description
boolean

close()

public void close()

Explicitly close the result set, releasing any associated resources. This must always be called when disposing of a ResultSet before #next() has returned false or raised an exception. Calling close() 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.

getCurrentRowAsStruct()

public Struct getCurrentRowAsStruct()

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 to Struct objects is generally more expensive than processing the ResultSet directly.

Returns
Type Description
Struct

getMetadata()

public ResultSetMetadata getMetadata()

Returns the ResultSetMetadata for this ResultSet. This is method may only be called after calling ResultSet#next() at least once.

Returns
Type Description
ResultSetMetadata

getProtobufValue(int columnIndex)

public Value getProtobufValue(int columnIndex)

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 the ResultSet must be one of DecodeMode#LAZY_PER_ROW and DecodeMode#LAZY_PER_COL, and that the corresponding ResultSet#getValue(int), ResultSet#getBoolean(int), ... method may not yet have been called for the column.

Parameter
Name Description
columnIndex int
Returns
Type Description
Value

getStats()

public ResultSetStats getStats()

Returns the ResultSetStats for the query only if the query was executed in either the PLAN or the PROFILE mode via the ReadContext#analyzeQuery(Statement, com.google.cloud.spanner.ReadContext.QueryAnalyzeMode) method or for DML statements in ReadContext#executeQuery(Statement, QueryOption...). Attempts to call this method on a ResultSet not obtained from analyzeQuery or executeQuery will return a null ResultSetStats. This method must be called after #next() has returned @{code false}. Calling it before that will result in null ResultSetStats too.

Returns
Type Description
ResultSetStats

initiateStreaming(AsyncResultSet.StreamMessageListener streamMessageListener)

public boolean initiateStreaming(AsyncResultSet.StreamMessageListener streamMessageListener)

Returns the boolean for this ResultSet. This method will be used by AsyncResultSet internally to initiate gRPC streaming. This method should not be called by the users.

Parameter
Name Description
streamMessageListener AsyncResultSet.StreamMessageListener
Returns
Type Description
boolean

next()

public boolean next()

Advances the result set to the next row, returning false if no such row exists. This method may block.

Returns
Type Description
boolean
Exceptions
Type Description
SpannerException