Package org.mariadb.jdbc.message.server
Class CachedPrepareResultPacket
java.lang.Object
org.mariadb.jdbc.message.server.PrepareResultPacket
org.mariadb.jdbc.message.server.CachedPrepareResultPacket
- All Implemented Interfaces:
Completion,Prepare,ServerMessage
Prepare packet result with flag indicating use
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate final AtomicBooleanprivate final List<BasePreparedStatement> Fields inherited from class org.mariadb.jdbc.message.server.PrepareResultPacket
CONSTANT_PARAMETER, statementId -
Constructor Summary
ConstructorsConstructorDescriptionCachedPrepareResultPacket(ReadableByteBuf buffer, Reader reader, Context context) Cache prepare result with flag indicating use -
Method Summary
Modifier and TypeMethodDescriptionbooleancache()indicate that result is in LRU cachevoidIndicate that a prepare statement must be closed (if not in LRU cache)voiddecrementUse(Client con, BasePreparedStatement preparedStatement) Decrement use of prepare packet, so closing it if last usedintReturn prepare statement id.voidincrementUse(BasePreparedStatement preparedStatement) Increment use of prepare statement.voidreset()Resetting cache in case of failovervoidIndicate that Prepare command is not on LRU cache anymore.Methods inherited from class org.mariadb.jdbc.message.server.PrepareResultPacket
getColumns, getParameters, setColumns
-
Field Details
-
closing
-
cached
-
statements
-
-
Constructor Details
-
CachedPrepareResultPacket
public CachedPrepareResultPacket(ReadableByteBuf buffer, Reader reader, Context context) throws IOException Cache prepare result with flag indicating use- Parameters:
buffer- prepare packet bufferreader- packet readercontext- connection context- Throws:
IOException- if any socket error occurs
-
-
Method Details
-
close
Indicate that a prepare statement must be closed (if not in LRU cache)- Specified by:
closein interfacePrepare- Overrides:
closein classPrepareResultPacket- Parameters:
con- current connection- Throws:
SQLException- if SQL
-
decrementUse
Description copied from class:PrepareResultPacketDecrement use of prepare packet, so closing it if last used- Specified by:
decrementUsein interfacePrepare- Overrides:
decrementUsein classPrepareResultPacket- Parameters:
con- connectionpreparedStatement- current prepared statement that was using prepare object- Throws:
SQLException- if exception occurs
-
incrementUse
Increment use of prepare statement.- Parameters:
preparedStatement- new statement using prepare result
-
unCache
Indicate that Prepare command is not on LRU cache anymore. closing prepare command if not used- Parameters:
con- current connection
-
cache
public boolean cache()indicate that result is in LRU cache- Returns:
- true if cached
-
getStatementId
public int getStatementId()Return prepare statement id.- Specified by:
getStatementIdin interfacePrepare- Overrides:
getStatementIdin classPrepareResultPacket- Returns:
- statement id
-
reset
public void reset()Resetting cache in case of failover
-