Package com.mysql.cj.xdevapi
Class PreparableStatement<RES_T>
java.lang.Object
com.mysql.cj.xdevapi.PreparableStatement<RES_T>
- Type Parameters:
RES_T- result interface
- Direct Known Subclasses:
FilterableStatement
public abstract class PreparableStatement<RES_T>
extends java.lang.Object
Abstract class, common to all X DevAPI statement classes that can be prepared.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPreparableStatement.PreparableStatementFinalizerPhantomReferenceto track prepared statement ids.protected static classPreparableStatement.PreparedState -
Field Summary
Fields Modifier and Type Field Description protected MysqlxSessionmysqlxSessionprotected PreparableStatement.PreparedStatepreparedStateprotected intpreparedStatementId -
Constructor Summary
Constructors Constructor Description PreparableStatement() -
Method Summary
Modifier and Type Method Description protected voiddeallocatePrepared()Deallocate this prepared statement from currentMysqlxSession.RES_Texecute()Executes synchronously this statement either directly or using prepared statements if: 1.protected abstract RES_TexecutePreparedStatement()Executes a previously server-prepared statement.protected abstract RES_TexecuteStatement()Executes the statement directly (non-prepared).protected XMessageBuildergetMessageBuilder()Helper method to return anXMessageBuilderinstance fromMysqlxSessionin use.protected abstract XMessagegetPrepareStatementXMessage()Returns theXMessageneeded to prepare this statement.protected voidresetPrepareState()Mark this preparable statement to be deallocated on next execution, if it is currently prepared, or cancel the next prepare.protected voidsetReprepareState()Mark this preparable statement to be deallocated and re-prepared on next execution, if it is currently prepared.
-
Field Details
-
preparedStatementId
protected int preparedStatementId -
preparedState
-
mysqlxSession
-
-
Constructor Details
-
PreparableStatement
public PreparableStatement()
-
-
Method Details
-
getMessageBuilder
Helper method to return anXMessageBuilderinstance fromMysqlxSessionin use.- Returns:
- the
XMessageBuilderinstance from currentMysqlxSession
-
resetPrepareState
protected void resetPrepareState()Mark this preparable statement to be deallocated on next execution, if it is currently prepared, or cancel the next prepare. -
setReprepareState
protected void setReprepareState()Mark this preparable statement to be deallocated and re-prepared on next execution, if it is currently prepared. -
execute
Executes synchronously this statement either directly or using prepared statements if: 1. Prepared statements are supported by the server. 2. The statement is executed repeatedly without changing its structure.- Returns:
- the object returned from the low level statement execution
-
executeStatement
Executes the statement directly (non-prepared). Implementation is dependent on the statement type.- Returns:
- the object returned from the lower level statement execution
-
getPrepareStatementXMessage
Returns theXMessageneeded to prepare this statement. Implementation is dependent on the statement type.- Returns:
- the
XMessagethat prepares this statement
-
executePreparedStatement
Executes a previously server-prepared statement. Implementation is dependent on the statement type.- Returns:
- the object returned from the lower level statement execution
-
deallocatePrepared
protected void deallocatePrepared()Deallocate this prepared statement from currentMysqlxSession.
-