Class IntermediateStatement (0.15.0)
Stay organized with collections
Save and categorize content based on your preferences.
publicclass IntermediateStatementData 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.
Inherited Members
Static Fields
PARSER
protectedstaticfinalPostgreSQLStatementParserPARSERConstructors
IntermediateStatement(ConnectionHandler connectionHandler, OptionsMetadata options, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement)
protectedIntermediateStatement(ConnectionHandlerconnectionHandler,OptionsMetadataoptions,AbstractStatementParser.ParsedStatementparsedStatement,StatementoriginalStatement)originalStatement
com.google.cloud.spanner.StatementIntermediateStatement(OptionsMetadata options, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement, ConnectionHandler connectionHandler)
publicIntermediateStatement(OptionsMetadataoptions,AbstractStatementParser.ParsedStatementparsedStatement,StatementoriginalStatement,ConnectionHandlerconnectionHandler)originalStatement
com.google.cloud.spanner.StatementFields
command
protectedfinalStringcommandcommandTag
protectedStringcommandTagconnection
protectedfinalConnectionconnectionconnectionHandler
protectedfinalConnectionHandlerconnectionHandlerdescribed
protectedbooleandescribedexception
protectedPGExceptionexceptionexecuted
protectedbooleanexecutedfutureStatementResult
protectedFuture<StatementResult>futureStatementResulthasMoreData
protectedbooleanhasMoreDataoptions
protectedfinalOptionsMetadataoptionsoriginalStatement
protectedfinalStatementoriginalStatementcom.google.cloud.spanner.Statement
outputStream
protectedfinalDataOutputStreamoutputStreamparsedStatement
protectedfinalAbstractStatementParser.ParsedStatementparsedStatementstatementResult
protectedStatementResultstatementResultMethods
close()
publicvoidclose()Cleanly close the statement. Does nothing if the statement has not been executed or has no result.
Exception
if closing fails server-side.
containsResultSet()
publicbooleancontainsResultSet()boolean
True if this is a select statement, false otherwise.
createDataRowResponse(Converter converter)
publicWireOutputcreateDataRowResponse(Converterconverter)createResultPrefix(ResultSet resultSet)
publicWireOutput[]createResultPrefix(ResultSetresultSet)resultSet
com.google.cloud.spanner.ResultSetcreateResultSuffix()
publicWireOutput[]createResultSuffix()describe()
publicDescribeResultdescribe()Moreso meant for inherited classes, allows one to call describe on a statement. Since raw statements cannot be described, throw an error.
describeAsync(BackendConnection backendConnection)
publicFuture<StatementResult>describeAsync(BackendConnectionbackendConnection)executeAsync(BackendConnection backendConnection)
publicvoidexecuteAsync(BackendConnectionbackendConnection)getCommand()
publicStringgetCommand()String
the extracted command (first word) from the SQL statement.
getCommandTag()
publicStringgetCommandTag()String
the extracted command (first word) from the really executed SQL statement.
getConnection()
publicConnectiongetConnection()getConnectionHandler()
publicConnectionHandlergetConnectionHandler()getException()
publicPGExceptiongetException()Returns any execution exception registered for this statement.
getResultFormatCode(int index)
publicshortgetResultFormatCode(intindex)Moreso intended for inherited classes (prepared statements et al) which allow the setting of result format codes. Here we dafault to string.
getSql()
publicStringgetSql()getStatement()
publicStringgetStatement()getStatementResult()
publicStatementResultgetStatementResult()Returns the result of this statement as a StatementResult. Fails if the result is not yet available.
getStatementType()
publicAbstractStatementParser.StatementTypegetStatementType()getUpdateCount()
publiclonggetUpdateCount()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.
getUpdateCount(IntermediateStatement.ResultNotReadyBehavior resultNotReadyBehavior)
publiclonggetUpdateCount(IntermediateStatement.ResultNotReadyBehaviorresultNotReadyBehavior)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.
handleExecutionException(PGException exception)
publicvoidhandleExecutionException(PGExceptionexception)Clean up and save metadata when an exception occurs.
hasException()
publicbooleanhasException()boolean
True if at some point in execution an exception was thrown. Fails if execution has not yet finished.
hasException(IntermediateStatement.ResultNotReadyBehavior resultNotReadyBehavior)
publicbooleanhasException(IntermediateStatement.ResultNotReadyBehaviorresultNotReadyBehavior)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.
isBound()
publicbooleanisBound()Whether this is a bound statement (i.e.: ready to execute)
boolean
True if bound, false otherwise.
isDescribed()
publicbooleanisDescribed()isExecuted()
publicbooleanisExecuted()boolean
True if this statement was executed, False otherwise.
isHasMoreData()
publicbooleanisHasMoreData()boolean
True if only a subset of the available data has been returned.
setFutureStatementResult(Future<StatementResult> result)
protectedvoidsetFutureStatementResult(Future<StatementResult>result)setHasMoreData(boolean hasMoreData)
publicvoidsetHasMoreData(booleanhasMoreData)setStatementResult(StatementResult statementResult)
publicvoidsetStatementResult(StatementResultstatementResult)