Send feedback
Class IntermediateStatement (0.6.1)
Stay organized with collections
Save and categorize content based on your preferences.
Version 0.6.1 keyboard_arrow_down
public class IntermediateStatement
Data type to store simple SQL statement with designated metadata. Allows manipulation of
statement, such as execution, termination, etc. Represented as an intermediate representation for
statements which does not belong directly to Postgres, Spanner, etc.
Static Fields
protected static final PostgreSQLStatementParser PARSER
Field Value
Constructors
protected IntermediateStatement ( ConnectionHandler connectionHandler , OptionsMetadata options , AbstractStatementParser . ParsedStatement parsedStatement , Statement originalStatement )
Parameters
public IntermediateStatement ( OptionsMetadata options , AbstractStatementParser . ParsedStatement parsedStatement , Statement originalStatement , ConnectionHandler connectionHandler )
Parameters
Fields
protected final String command
Field Value
protected String commandTag
Field Value
protected final Connection connection
Field Value
protected final ConnectionHandler connectionHandler
Field Value
protected SpannerException exception
Field Value
Type Description com.google.cloud.spanner.SpannerException
protected boolean executed
Field Value
protected Future<StatementResult> futureStatementResult
Field Value
protected boolean hasMoreData
Field Value
protected final OptionsMetadata options
Field Value
protected final Statement originalStatement
Field Value
Type Description com.google.cloud.spanner.Statement
protected final DataOutputStream outputStream
Field Value
protected final AbstractStatementParser . ParsedStatement parsedStatement
Field Value
protected StatementResult statementResult
Field Value
Methods
Cleanly close the statement. Does nothing if the statement has not been executed or has no
result.
Exceptions
Type Description Exception if closing fails server-side.
public boolean containsResultSet ()
Returns
Type Description boolean True if this is a select statement, false otherwise.
public WireOutput createDataRowResponse ( ResultSet resultSet , ConnectionHandler . QueryMode mode )
Parameters
Returns
public WireOutput [] createResultPrefix ( ResultSet resultSet )
Parameter
Name Description resultSet com.google.cloud.spanner.ResultSet
Returns
public WireOutput [] createResultSuffix ()
Returns
public DescribeMetadata <? > describe ()
Moreso meant for inherited classes, allows one to call describe on a statement. Since raw
statements cannot be described, throw an error.
Returns
public Future <? extends DescribeMetadata <? >> describeAsync ( BackendConnection backendConnection )
Parameter
Returns
Type Description Future <? extends com.google.cloud.spanner.pgadapter.metadata.DescribeMetadata <? >>
public void executeAsync ( BackendConnection backendConnection )
Parameter
public String getCommand ()
Returns
Type Description String the extracted command (first word) from the SQL statement.
public String getCommandTag ()
Returns
Type Description String the extracted command (first word) from the really executed SQL statement.
public Connection getConnection ()
Returns
public SpannerException getException ()
Returns any execution exception registered for this statement.
Returns
Type Description com.google.cloud.spanner.SpannerException
public short getResultFormatCode ( int index )
Moreso intended for inherited classes (prepared statements et al) which allow the setting of
result format codes. Here we dafault to string.
Parameter
Returns
Returns
public String getStatement ()
Returns
public StatementResult getStatementResult ()
Returns the result of this statement as a StatementResult . Fails if the result is not
yet available.
Returns
public AbstractStatementParser . StatementType getStatementType ()
Returns
public long getUpdateCount ()
Returns
Type Description long The number of items that were modified by this execution for DML. 0 for DDL and -1 for
QUERY. Fails if the result is not yet available.
public long getUpdateCount ( IntermediateStatement . ResultNotReadyBehavior resultNotReadyBehavior )
Parameter
Returns
Type Description long The number of items that were modified by this execution for DML. 0 for DDL and -1 for
QUERY. Will block or fail depending on the given ResultNotReadyBehavior if the
result is not yet available.
public void handleExecutionException ( SpannerException exception )
Clean up and save metadata when an exception occurs.
Parameter
Name Description exception com.google.cloud.spanner.SpannerException
The exception to store.
public boolean hasException ()
Returns
Type Description boolean True if at some point in execution an exception was thrown. Fails if execution has not
yet finished.
public boolean hasException ( IntermediateStatement . ResultNotReadyBehavior resultNotReadyBehavior )
Parameter
Returns
Type Description boolean True if at some point in execution an exception was thrown. Fails or blocks depending
on the given ResultNotReadyBehavior if execution has not yet finished.
Whether this is a bound statement (i.e.: ready to execute)
Returns
Type Description boolean True if bound, false otherwise.
public boolean isExecuted ()
Returns
Type Description boolean True if this statement was executed, False otherwise.
public boolean isHasMoreData ()
Returns
Type Description boolean True if only a subset of the available data has been returned.
protected void setFutureStatementResult ( Future<StatementResult> result )
Parameter
public void setHasMoreData ( boolean hasMoreData )
Parameter
public void setStatementResult ( StatementResult statementResult )
Parameter
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-19 UTC.
Need to tell us more?
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-19 UTC."],[],[]]