Package org.mariadb.jdbc.client.context

## Class BaseContext

- java.lang.Object
- - org.mariadb.jdbc.client.context.BaseContext

All Implemented Interfaces:
  `org.mariadb.jdbc.client.Context`

Direct Known Subclasses:
  `RedoContext`

    public class BaseContext
    extends Object
    implements org.mariadb.jdbc.client.Context

Context (current connection state) of a connection

### Field Summary

Fields
`protected int` `serverStatus` Server status context

### Constructor Summary

Constructors
`BaseContext​(InitialHandshakePacket handshake, long clientCapabilities, Configuration conf, ExceptionFactory exceptionFactory, org.mariadb.jdbc.client.PrepareCache prepareCache)` Constructor of connection context

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addStateFlag​(int state)` Indicate connection state (for pooling)
`boolean` `canSkipMeta()` Can server skip prepared statement metadata
`Configuration` `getConf()` Get connection configuration
`String` `getDatabase()` Get current connection database
`ExceptionFactory` `getExceptionFactory()` Get connection exception factory
`org.mariadb.jdbc.client.PrepareCache` `getPrepareCache()` get LRU prepare cache object
`byte[]` `getSeed()` Get connection initial seed
`int` `getServerStatus()` Get server connection state
`int` `getStateFlag()` return connection current state change flag
`long` `getThreadId()` return current thread id
`int` `getTransactionIsolationLevel()` Get connection transaction isolation level
`org.mariadb.jdbc.client.ServerVersion` `getVersion()` Retrieve server version information
`int` `getWarning()` has server warnings
`boolean` `hasClientCapability​(long flag)` has client capability
`boolean` `hasServerCapability​(long flag)` has server capability
`boolean` `isEofDeprecated()` does protocol remove EOF in exchanges
`boolean` `isExtendedInfo()` Does server metadata exchange extended information
`void` `resetPrepareCache()` Reset prepare cache (after a failover)
`void` `resetStateFlag()` reset connection state change flag
`void` `setDatabase​(String database)` set current database context
`void` `setServerStatus​(int serverStatus)` Set server connection state
`void` `setTransactionIsolationLevel​(int transactionIsolationLevel)` Set current connection transaction isolation level
`void` `setWarning​(int warning)` set server state warning number

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### serverStatus

    protected int serverStatus

Server status context

### Constructor Detail

#### BaseContext

    public BaseContext​(InitialHandshakePacket handshake,
                       long clientCapabilities,
                       Configuration conf,
                       ExceptionFactory exceptionFactory,
                       org.mariadb.jdbc.client.PrepareCache prepareCache)

Constructor of connection context

Parameters:
  `handshake` - server handshake
  `clientCapabilities` - client capabilities
  `conf` - connection configuration
  `exceptionFactory` - connection exception factory
  `prepareCache` - LRU prepare cache

### Method Detail

#### getThreadId

    public long getThreadId()

Description copied from interface: `org.mariadb.jdbc.client.Context`
return current thread id

Specified by:
  `getThreadId` in interface `org.mariadb.jdbc.client.Context`
Returns:
  current server thread id

#### getSeed

    public byte[] getSeed()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get connection initial seed

Specified by:
  `getSeed` in interface `org.mariadb.jdbc.client.Context`
Returns:
  initial seed

#### hasServerCapability

    public boolean hasServerCapability​(long flag)

Description copied from interface: `org.mariadb.jdbc.client.Context`
has server capability

Specified by:
  `hasServerCapability` in interface `org.mariadb.jdbc.client.Context`
Returns:
  true if server has capability

#### hasClientCapability

    public boolean hasClientCapability​(long flag)

Description copied from interface: `org.mariadb.jdbc.client.Context`
has client capability

Specified by:
  `hasClientCapability` in interface `org.mariadb.jdbc.client.Context`
Returns:
  true if client has capability

#### getServerStatus

    public int getServerStatus()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get server connection state

Specified by:
  `getServerStatus` in interface `org.mariadb.jdbc.client.Context`
Returns:
  server status

#### setServerStatus

    public void setServerStatus​(int serverStatus)

Description copied from interface: `org.mariadb.jdbc.client.Context`
Set server connection state

Specified by:
  `setServerStatus` in interface `org.mariadb.jdbc.client.Context`
Parameters:
  `serverStatus` - server status

#### getDatabase

    public String getDatabase()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get current connection database

Specified by:
  `getDatabase` in interface `org.mariadb.jdbc.client.Context`
Returns:
  database

#### setDatabase

    public void setDatabase​(String database)

Description copied from interface: `org.mariadb.jdbc.client.Context`
set current database context

Specified by:
  `setDatabase` in interface `org.mariadb.jdbc.client.Context`
Parameters:
  `database` - database

#### getVersion

    public org.mariadb.jdbc.client.ServerVersion getVersion()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Retrieve server version information

Specified by:
  `getVersion` in interface `org.mariadb.jdbc.client.Context`
Returns:
  server version

#### isEofDeprecated

    public boolean isEofDeprecated()

Description copied from interface: `org.mariadb.jdbc.client.Context`
does protocol remove EOF in exchanges

Specified by:
  `isEofDeprecated` in interface `org.mariadb.jdbc.client.Context`
Returns:
  if EOF packet are deprecated

#### isExtendedInfo

    public boolean isExtendedInfo()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Does server metadata exchange extended information

Specified by:
  `isExtendedInfo` in interface `org.mariadb.jdbc.client.Context`
Returns:
  use metadata extended information

#### canSkipMeta

    public boolean canSkipMeta()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Can server skip prepared statement metadata

Specified by:
  `canSkipMeta` in interface `org.mariadb.jdbc.client.Context`
Returns:
  true if possible

#### getWarning

    public int getWarning()

Description copied from interface: `org.mariadb.jdbc.client.Context`
has server warnings

Specified by:
  `getWarning` in interface `org.mariadb.jdbc.client.Context`
Returns:
  has warnings

#### setWarning

    public void setWarning​(int warning)

Description copied from interface: `org.mariadb.jdbc.client.Context`
set server state warning number

Specified by:
  `setWarning` in interface `org.mariadb.jdbc.client.Context`
Parameters:
  `warning` - warning number

#### getExceptionFactory

    public ExceptionFactory getExceptionFactory()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get connection exception factory

Specified by:
  `getExceptionFactory` in interface `org.mariadb.jdbc.client.Context`
Returns:
  exception factory

#### getConf

    public Configuration getConf()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get connection configuration

Specified by:
  `getConf` in interface `org.mariadb.jdbc.client.Context`
Returns:
  configuration

#### getTransactionIsolationLevel

    public int getTransactionIsolationLevel()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Get connection transaction isolation level

Specified by:
  `getTransactionIsolationLevel` in interface `org.mariadb.jdbc.client.Context`
Returns:
  connection transaction isolation level

#### setTransactionIsolationLevel

    public void setTransactionIsolationLevel​(int transactionIsolationLevel)

Description copied from interface: `org.mariadb.jdbc.client.Context`
Set current connection transaction isolation level

Specified by:
  `setTransactionIsolationLevel` in interface `org.mariadb.jdbc.client.Context`
Parameters:
  `transactionIsolationLevel` - new connection transaction isolation level

#### getPrepareCache

    public org.mariadb.jdbc.client.PrepareCache getPrepareCache()

Description copied from interface: `org.mariadb.jdbc.client.Context`
get LRU prepare cache object

Specified by:
  `getPrepareCache` in interface `org.mariadb.jdbc.client.Context`
Returns:
  prepare cache

#### resetPrepareCache

    public void resetPrepareCache()

Description copied from interface: `org.mariadb.jdbc.client.Context`
Reset prepare cache (after a failover)

Specified by:
  `resetPrepareCache` in interface `org.mariadb.jdbc.client.Context`

#### getStateFlag

    public int getStateFlag()

Description copied from interface: `org.mariadb.jdbc.client.Context`
return connection current state change flag

Specified by:
  `getStateFlag` in interface `org.mariadb.jdbc.client.Context`
Returns:
  connection current state change flag

#### resetStateFlag

    public void resetStateFlag()

Description copied from interface: `org.mariadb.jdbc.client.Context`
reset connection state change flag

Specified by:
  `resetStateFlag` in interface `org.mariadb.jdbc.client.Context`

#### addStateFlag

    public void addStateFlag​(int state)

Description copied from interface: `org.mariadb.jdbc.client.Context`
Indicate connection state (for pooling)

Specified by:
  `addStateFlag` in interface `org.mariadb.jdbc.client.Context`
Parameters:
  `state` - indicate that some connection state has changed