Interface Context

All Known Implementing Classes:
BaseContext, RedoContext

public interface Context
  • Method Details

    • getThreadId

      long getThreadId()
      return current thread id
      Returns:
      current server thread id
    • isLoopbackAddress

      Boolean isLoopbackAddress()
      return if host is a local address
      Returns:
      true if host is local
    • setThreadId

      void setThreadId(long connectionId)
      Indicate server connection Id (not truncated)
      Parameters:
      connectionId - connection id
    • getAutoIncrement

      Long getAutoIncrement()
      Get server current auto_increment value
      Returns:
      server auto increment
    • setAutoIncrement

      void setAutoIncrement(long autoIncrement)
      Set server autoincrement value
      Parameters:
      autoIncrement - current server autoincrement value
    • setMaxscaleVersion

      void setMaxscaleVersion(String maxscaleVersion)
      Set Maxscale version.
      Parameters:
      maxscaleVersion - maxscale version
    • getMaxscaleVersion

      String getMaxscaleVersion()
      Retrieve maxscaleVersion or null if not the case
      Returns:
      maxscale version
    • setRedirectUrl

      void setRedirectUrl(String redirectUrl)
      Set server redirection url
      Parameters:
      redirectUrl - redirect url
    • getRedirectUrl

      String getRedirectUrl()
      get redirect Url if server indicate reconnection url
      Returns:
      null if no redirection required, value if so
    • getSeed

      byte[] getSeed()
      Get connection initial seed
      Returns:
      initial seed
    • hasServerCapability

      boolean hasServerCapability(long flag)
      has server capability
      Parameters:
      flag - capability to check
      Returns:
      true if server has capability
    • hasClientCapability

      boolean hasClientCapability(long flag)
      has client capability
      Parameters:
      flag - capability to check
      Returns:
      true if client has capability
    • permitPipeline

      boolean permitPipeline()
      Does server and client permit pipeline
      Returns:
      true if permitted
    • getServerStatus

      int getServerStatus()
      Get server connection state
      Returns:
      server status
    • setServerStatus

      void setServerStatus(int serverStatus)
      Set server connection state
      Parameters:
      serverStatus - server status
    • getDatabase

      String getDatabase()
      Get current connection database
      Returns:
      database
    • setDatabase

      void setDatabase(String database)
      set current database context
      Parameters:
      database - database
    • getVersion

      ServerVersion getVersion()
      Retrieve server version information
      Returns:
      server version
    • isEofDeprecated

      boolean isEofDeprecated()
      does protocol remove EOF in exchanges
      Returns:
      if EOF packet are deprecated
    • canSkipMeta

      boolean canSkipMeta()
      Can server skip prepared statement metadata
      Returns:
      true if possible
    • getColumnDecoderFunction

      Function<ReadableByteBuf, ColumnDecoder> getColumnDecoderFunction()
      Column decoder function
      Returns:
      Column decoder function
    • getWarning

      int getWarning()
      has server warnings
      Returns:
      has warnings
    • setWarning

      void setWarning(int warning)
      set server state warning number
      Parameters:
      warning - warning number
    • getExceptionFactory

      ExceptionFactory getExceptionFactory()
      Get connection exception factory
      Returns:
      exception factory
    • getConf

      Configuration getConf()
      Get connection configuration
      Returns:
      configuration
    • canUseTransactionIsolation

      boolean canUseTransactionIsolation()
      Can rely on transaction_isolation or keep using deprecated tx_isolation variable
      Returns:
      true if you can use transaction_isolation
    • getTransactionIsolationLevel

      Integer getTransactionIsolationLevel()
      Get connection transaction isolation level
      Returns:
      connection transaction isolation level
    • setTransactionIsolationLevel

      void setTransactionIsolationLevel(Integer transactionIsolationLevel)
      Set current connection transaction isolation level
      Parameters:
      transactionIsolationLevel - new connection transaction isolation level
    • getPrepareCacheCmd

      Prepare getPrepareCacheCmd(String sql, BasePreparedStatement preparedStatement)
      Return cached prepare if key match
      Parameters:
      sql - sql command
      preparedStatement - current statement
      Returns:
      Prepare if found, null if not
    • putPrepareCacheCmd

      Prepare putPrepareCacheCmd(String sql, Prepare result, BasePreparedStatement preparedStatement)
      Put prepare result in cache
      Parameters:
      sql - sql command
      result - prepare result
      preparedStatement - current statement
      Returns:
      Prepare if was already cached
    • resetPrepareCache

      void resetPrepareCache()
      Reset prepare cache (after a failover)
    • getStateFlag

      int getStateFlag()
      return connection current state change flag
      Returns:
      connection current state change flag
    • resetStateFlag

      void resetStateFlag()
      reset connection state change flag
    • addStateFlag

      void addStateFlag(int state)
      Indicate connection state (for pooling)
      Parameters:
      state - indicate that some connection state has changed
    • isServerReadOnly

      boolean isServerReadOnly()
      Read-only state currently applied on the server session, i.e. whether the last effective SET SESSION TRANSACTION READ ONLY / READ WRITE left the session read-only. Used with the readOnlyPropagatesToServer option to avoid issuing redundant statements and to replay the state on failover.
      Returns:
      true if the server session is currently in read-only mode
    • setServerReadOnly

      void setServerReadOnly(boolean serverReadOnly)
      Record the read-only state currently applied on the server session.
      Parameters:
      serverReadOnly - true if the server session is read-only
    • setTreadsConnected

      void setTreadsConnected(long threadsConnected)
      Indicate the number of connection on this server
      Parameters:
      threadsConnected - number of connected threads
    • getCharset

      String getCharset()
      Retrieve current charset if session state get it
      Returns:
      current charset
    • setCharset

      void setCharset(String charset) throws SQLException
      Indicate server charset change. Throws when the new charset isn't compatible with the driver's UTF-8 assumption (only utf8 / utf8mb3 / utf8mb4 are accepted post-init).
      Parameters:
      charset - server charset
      Throws:
      SQLException - if the change is rejected; the connection is also closed
    • setCharsetResults

      void setCharsetResults(String charset) throws SQLException
      Indicate server character_set_results change. Throws when the new charset isn't compatible with the driver's UTF-8 result decoding (only utf8 / utf8mb3 / utf8mb4, or no conversion, are accepted post-init).
      Parameters:
      charset - results charset, empty when results are sent without conversion
      Throws:
      SQLException - if the change is rejected; the connection is also closed
    • getConnectionTimeZone

      TimeZone getConnectionTimeZone()
      Get current connection timezone
      Returns:
      connection timezone
    • setConnectionTimeZone

      void setConnectionTimeZone(TimeZone connectionTimeZone)
      Set current connection timezone
      Parameters:
      connectionTimeZone - connection timezone
    • getDefaultCalendar

      Calendar getDefaultCalendar()
      Get calendar depending on configuration
      Returns:
      calendar
    • setInitialized

      void setInitialized()
      Indicate that connection is initialized and ready to handle commands. Used to avoid accepting server