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 class
PreparableStatement.PreparableStatementFinalizer
PhantomReference
to track prepared statement ids.protected static class
PreparableStatement.PreparedState
-
Field Summary
Fields Modifier and Type Field Description protected MysqlxSession
mysqlxSession
protected PreparableStatement.PreparedState
preparedState
protected int
preparedStatementId
-
Constructor Summary
Constructors Constructor Description PreparableStatement()
-
Method Summary
Modifier and Type Method Description protected void
deallocatePrepared()
Deallocate this prepared statement from currentMysqlxSession
.RES_T
execute()
Executes synchronously this statement either directly or using prepared statements if: 1.protected abstract RES_T
executePreparedStatement()
Executes a previously server-prepared statement.protected abstract RES_T
executeStatement()
Executes the statement directly (non-prepared).protected XMessageBuilder
getMessageBuilder()
Helper method to return anXMessageBuilder
instance fromMysqlxSession
in use.protected abstract XMessage
getPrepareStatementXMessage()
Returns theXMessage
needed to prepare this statement.protected void
resetPrepareState()
Mark this preparable statement to be deallocated on next execution, if it is currently prepared, or cancel the next prepare.protected void
setReprepareState()
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 anXMessageBuilder
instance fromMysqlxSession
in use.- Returns:
- the
XMessageBuilder
instance 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 theXMessage
needed to prepare this statement. Implementation is dependent on the statement type.- Returns:
- the
XMessage
that 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
.
-