Class CachedPrepareResultPacket

java.lang.Object
org.mariadb.jdbc.message.server.PrepareResultPacket
org.mariadb.jdbc.message.server.CachedPrepareResultPacket
All Implemented Interfaces:
Completion, Prepare, ServerMessage

public final class CachedPrepareResultPacket extends PrepareResultPacket
Prepare packet result with flag indicating use
  • Field Details

  • Constructor Details

    • CachedPrepareResultPacket

      public CachedPrepareResultPacket(ReadableByteBuf buffer, Reader reader, Context context) throws IOException
      Cache prepare result with flag indicating use
      Parameters:
      buffer - prepare packet buffer
      reader - packet reader
      context - connection context
      Throws:
      IOException - if any socket error occurs
  • Method Details

    • close

      public void close(Client con) throws SQLException
      Indicate that a prepare statement must be closed (if not in LRU cache)
      Specified by:
      close in interface Prepare
      Overrides:
      close in class PrepareResultPacket
      Parameters:
      con - current connection
      Throws:
      SQLException - if SQL
    • decrementUse

      public void decrementUse(Client con, BasePreparedStatement preparedStatement) throws SQLException
      Description copied from class: PrepareResultPacket
      Decrement use of prepare packet, so closing it if last used
      Specified by:
      decrementUse in interface Prepare
      Overrides:
      decrementUse in class PrepareResultPacket
      Parameters:
      con - connection
      preparedStatement - current prepared statement that was using prepare object
      Throws:
      SQLException - if exception occurs
    • incrementUse

      public void incrementUse(BasePreparedStatement preparedStatement)
      Increment use of prepare statement.
      Parameters:
      preparedStatement - new statement using prepare result
    • unCache

      public void unCache(Client con)
      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:
      getStatementId in interface Prepare
      Overrides:
      getStatementId in class PrepareResultPacket
      Returns:
      statement id
    • reset

      public void reset()
      Resetting cache in case of failover