Top Description Inners Fields Constructors Methods
com.mysql.cj.xdevapi

public abstract Class PreparableStatement<RES_T>

extends Object
Class Inheritance
Known Direct Subclasses
com.mysql.cj.xdevapi.FilterableStatement
Type Parameters
<RES_T>
result interface
Imports
java.lang.ref.PhantomReference, .ReferenceQueue, com.mysql.cj.MysqlxSession, com.mysql.cj.protocol.x.XMessage, .XMessageBuilder, .XProtocolError

Abstract class, common to all X DevAPI statement classes that can be prepared.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
protected static enum

Field Summary

Modifier and TypeField and Description
protected MysqlxSession
protected PreparableStatement.PreparedState
protected int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
deallocatePrepared()

Deallocate this prepared statement from current MysqlxSession.

public RES_T

Returns:

the object returned from the low level statement execution
execute
()

Executes synchronously this statement either directly or using prepared statements if: 1.

protected abstract RES_T

Returns:

the object returned from the lower level statement execution
executePreparedStatement
()

Executes a previously server-prepared statement.

protected abstract RES_T

Returns:

the object returned from the lower level statement execution
executeStatement
()

Executes the statement directly (non-prepared).

protected XMessageBuilder

Returns:

the XMessageBuilder instance from current MysqlxSession
getMessageBuilder
()

Helper method to return an XMessageBuilder instance from MysqlxSession in use.

protected abstract XMessage

Returns:

the XMessage that prepares this statement
getPrepareStatementXMessage
()

Returns the XMessage needed to prepare this statement.

private boolean

Returns:

true if the statement was successfully prepared, false otherwise
prepareStatement
()

Prepares a statement on the server to be later executed.

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mysqlxSessionback to summary
protected MysqlxSession mysqlxSession
preparedStateback to summary
protected PreparableStatement.PreparedState preparedState
preparedStatementIdback to summary
protected int preparedStatementId

Constructor Detail

PreparableStatementback to summary
public PreparableStatement()

Method Detail

deallocatePreparedback to summary
protected void deallocatePrepared()

Deallocate this prepared statement from current MysqlxSession.

executeback to summary
public RES_T 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:RES_T

the object returned from the low level statement execution

executePreparedStatementback to summary
protected abstract RES_T executePreparedStatement()

Executes a previously server-prepared statement. Implementation is dependent on the statement type.

Returns:RES_T

the object returned from the lower level statement execution

executeStatementback to summary
protected abstract RES_T executeStatement()

Executes the statement directly (non-prepared). Implementation is dependent on the statement type.

Returns:RES_T

the object returned from the lower level statement execution

getMessageBuilderback to summary
protected XMessageBuilder getMessageBuilder()

Helper method to return an XMessageBuilder instance from MysqlxSession in use.

Returns:XMessageBuilder

the XMessageBuilder instance from current MysqlxSession

getPrepareStatementXMessageback to summary
protected abstract XMessage getPrepareStatementXMessage()

Returns the XMessage needed to prepare this statement. Implementation is dependent on the statement type.

Returns:XMessage

the XMessage that prepares this statement

prepareStatementback to summary
private boolean prepareStatement()

Prepares a statement on the server to be later executed.

Returns:boolean

true if the statement was successfully prepared, false otherwise

resetPrepareStateback to summary
protected void resetPrepareState()

Mark this preparable statement to be deallocated on next execution, if it is currently prepared, or cancel the next prepare.

setReprepareStateback to summary
protected void setReprepareState()

Mark this preparable statement to be deallocated and re-prepared on next execution, if it is currently prepared.

com.mysql.cj.xdevapi back to summary

public Class PreparableStatement.PreparableStatementFinalizer

extends PhantomReference<PreparableStatement<?>>
Class Inheritance

PhantomReference to track prepared statement ids. An instance of this class must be kept until the prepared statement is properly deallocated. If proper deallocation does not happen, this is used to identify abandoned prepared statements and proceed with its deallocation after the object is destructed by using a ReferenceQueue.

Field Summary

Modifier and TypeField and Description
pack-priv int

Constructor Summary

AccessConstructor and Description
public
PreparableStatementFinalizer(PreparableStatement<?> referent, ReferenceQueue<? super PreparableStatement<?>> q, int preparedStatementId)

Method Summary

Modifier and TypeMethod and Description
public int
Inherited from java.lang.ref.PhantomReference:
get

Field Detail

prepredStatementIdback to summary
pack-priv int prepredStatementId

Constructor Detail

PreparableStatementFinalizerback to summary
public PreparableStatementFinalizer(PreparableStatement<?> referent, ReferenceQueue<? super PreparableStatement<?>> q, int preparedStatementId)

Method Detail

getPreparedStatementIdback to summary
public int getPreparedStatementId()
com.mysql.cj.xdevapi back to summary

protected final Enum PreparableStatement.PreparedState

extends Enum<PreparableStatement.PreparedState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState
public static final PreparableStatement.PreparedState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PreparableStatement.PreparedState
public static PreparableStatement.PreparedState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DEALLOCATEback to summary
public static final PreparableStatement.PreparedState DEALLOCATE
PREPAREback to summary
public static final PreparableStatement.PreparedState PREPARE
PREPAREDback to summary
public static final PreparableStatement.PreparedState PREPARED
REPREPAREback to summary
public static final PreparableStatement.PreparedState REPREPARE
SUSPENDEDback to summary
public static final PreparableStatement.PreparedState SUSPENDED
UNPREPAREDback to summary
public static final PreparableStatement.PreparedState UNPREPARED
UNSUPPORTEDback to summary
public static final PreparableStatement.PreparedState UNSUPPORTED

Constructor Detail

PreparedStateback to summary
private PreparedState()

Method Detail

valueOfback to summary
public static PreparableStatement.PreparedState valueOf(String name)
valuesback to summary
public static PreparableStatement.PreparedState[] values()