Send feedback
Class IntermediateStatement (0.25.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 0.25.0 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
Constructors
protected IntermediateStatement ( ConnectionHandler connectionHandler , OptionsMetadata options , AbstractStatementParser . ParsedStatement parsedStatement , Statement originalStatement )
public IntermediateStatement ( OptionsMetadata options , AbstractStatementParser . ParsedStatement parsedStatement , Statement originalStatement , ConnectionHandler connectionHandler )
Fields
protected final String command
Field Value Type Description String
protected String commandTag
Field Value Type Description String
protected final Connection connection
protected final ConnectionHandler connectionHandler
protected boolean described
protected PGException exception
protected boolean executed
protected Future<StatementResult> futureStatementResult
protected boolean hasMoreData
protected final OptionsMetadata options
protected final Statement originalStatement
Field Value Type Description com.google.cloud.spanner.Statement
protected final DataOutputStream outputStream
protected final AbstractStatementParser . ParsedStatement parsedStatement
protected StatementResult statementResult
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 ( Converter converter )
public WireOutput [] createResultPrefix ( ResultSet resultSet )
Parameter Name Description resultSet
com.google.cloud.spanner.ResultSet
public WireOutput [] createResultSuffix ()
public DescribeResult describe ()
Moreso meant for inherited classes, allows one to call describe on a statement. Since raw
statements cannot be described, throw an error.
public Future<StatementResult> describeAsync ( BackendConnection backendConnection )
public void executeAsync ( BackendConnection backendConnection )
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 ()
public ConnectionHandler getConnectionHandler ()
public PGException getException ()
Returns any execution exception registered for this statement.
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 Name Description index
int
Returns Type Description short
public String getStatement ()
public StatementResult getStatementResult ()
Returns the result of this statement as a StatementResult . Fails if the result is not
yet available.
public AbstractStatementParser . StatementType getStatementType ()
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 )
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 ( PGException exception )
Clean up and save metadata when an exception occurs.
Parameter Name Description exception
PGException
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 )
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 isDescribed ()
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.
public void setCommandTag ( String commandTag )
Parameter Name Description commandTag
String
protected void setFutureStatementResult ( Future<StatementResult> result )
public void setHasMoreData ( boolean hasMoreData )
Parameter Name Description hasMoreData
boolean
public void setStatementResult ( StatementResult statementResult )
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-10-01 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-10-01 UTC."}
[[["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-10-01 UTC."]]