Package org.mariadb.jdbc.client
Interface Context
-
- All Known Implementing Classes:
BaseContext,RedoContext
public interface Context
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddStateFlag(int state)Indicate connection state (for pooling)booleancanSkipMeta()Can server skip prepared statement metadatabooleancanUseTransactionIsolation()Can rely on transaction_isolation or keep using deprecated tx_isolation variablejava.lang.LonggetAutoIncrement()Get server current auto_increment valuejava.lang.StringgetCharset()Retrieve current charset if session state get itjava.util.function.Function<ReadableByteBuf,ColumnDecoder>getColumnDecoderFunction()Column decoder functionConfigurationgetConf()Get connection configurationjava.util.TimeZonegetConnectionTimeZone()Get current connection timezonejava.lang.StringgetDatabase()Get current connection databasejava.util.CalendargetDefaultCalendar()Get calendar depending on configurationExceptionFactorygetExceptionFactory()Get connection exception factoryjava.lang.StringgetMaxscaleVersion()Retrieve maxscaleVersion or null if not the casePreparegetPrepareCacheCmd(java.lang.String sql, BasePreparedStatement preparedStatement)Return cached prepare if key matchjava.lang.StringgetRedirectUrl()get redirect Url if server indicate reconnection urlbyte[]getSeed()Get connection initial seedintgetServerStatus()Get server connection stateintgetStateFlag()return connection current state change flaglonggetThreadId()return current thread idjava.lang.IntegergetTransactionIsolationLevel()Get connection transaction isolation levelServerVersiongetVersion()Retrieve server version informationintgetWarning()has server warningsbooleanhasClientCapability(long flag)has client capabilitybooleanhasServerCapability(long flag)has server capabilitybooleanisEofDeprecated()does protocol remove EOF in exchangesjava.lang.BooleanisLoopbackAddress()return if host is a local addressbooleanisServerReadOnly()Read-only state currently applied on the server session, i.e.booleanpermitPipeline()Does server and client permit pipelinePrepareputPrepareCacheCmd(java.lang.String sql, Prepare result, BasePreparedStatement preparedStatement)Put prepare result in cachevoidresetPrepareCache()Reset prepare cache (after a failover)voidresetStateFlag()reset connection state change flagvoidsetAutoIncrement(long autoIncrement)Set server autoincrement valuevoidsetCharset(java.lang.String charset)Indicate server charset change.voidsetCharsetResults(java.lang.String charset)Indicate server character_set_results change.voidsetConnectionTimeZone(java.util.TimeZone connectionTimeZone)Set current connection timezonevoidsetDatabase(java.lang.String database)set current database contextvoidsetInitialized()Indicate that connection is initialized and ready to handle commands.voidsetMaxscaleVersion(java.lang.String maxscaleVersion)Set Maxscale version.voidsetRedirectUrl(java.lang.String redirectUrl)Set server redirection urlvoidsetServerReadOnly(boolean serverReadOnly)Record the read-only state currently applied on the server session.voidsetServerStatus(int serverStatus)Set server connection statevoidsetThreadId(long connectionId)Indicate server connection Id (not truncated)voidsetTransactionIsolationLevel(java.lang.Integer transactionIsolationLevel)Set current connection transaction isolation levelvoidsetTreadsConnected(long threadsConnected)Indicate the number of connection on this servervoidsetWarning(int warning)set server state warning number
-
-
-
Method Detail
-
getThreadId
long getThreadId()
return current thread id- Returns:
- current server thread id
-
isLoopbackAddress
java.lang.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
java.lang.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(java.lang.String maxscaleVersion)
Set Maxscale version.- Parameters:
maxscaleVersion- maxscale version
-
getMaxscaleVersion
java.lang.String getMaxscaleVersion()
Retrieve maxscaleVersion or null if not the case- Returns:
- maxscale version
-
setRedirectUrl
void setRedirectUrl(java.lang.String redirectUrl)
Set server redirection url- Parameters:
redirectUrl- redirect url
-
getRedirectUrl
java.lang.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
java.lang.String getDatabase()
Get current connection database- Returns:
- database
-
setDatabase
void setDatabase(java.lang.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
java.util.function.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
java.lang.Integer getTransactionIsolationLevel()
Get connection transaction isolation level- Returns:
- connection transaction isolation level
-
setTransactionIsolationLevel
void setTransactionIsolationLevel(java.lang.Integer transactionIsolationLevel)
Set current connection transaction isolation level- Parameters:
transactionIsolationLevel- new connection transaction isolation level
-
getPrepareCacheCmd
Prepare getPrepareCacheCmd(java.lang.String sql, BasePreparedStatement preparedStatement)
Return cached prepare if key match- Parameters:
sql- sql commandpreparedStatement- current statement- Returns:
- Prepare if found, null if not
-
putPrepareCacheCmd
Prepare putPrepareCacheCmd(java.lang.String sql, Prepare result, BasePreparedStatement preparedStatement)
Put prepare result in cache- Parameters:
sql- sql commandresult- prepare resultpreparedStatement- 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 effectiveSET SESSION TRANSACTION READ ONLY / READ WRITEleft the session read-only. Used with thereadOnlyPropagatesToServeroption 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
java.lang.String getCharset()
Retrieve current charset if session state get it- Returns:
- current charset
-
setCharset
void setCharset(java.lang.String charset) throws java.sql.SQLExceptionIndicate 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:
java.sql.SQLException- if the change is rejected; the connection is also closed
-
setCharsetResults
void setCharsetResults(java.lang.String charset) throws java.sql.SQLExceptionIndicate 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:
java.sql.SQLException- if the change is rejected; the connection is also closed
-
getConnectionTimeZone
java.util.TimeZone getConnectionTimeZone()
Get current connection timezone- Returns:
- connection timezone
-
setConnectionTimeZone
void setConnectionTimeZone(java.util.TimeZone connectionTimeZone)
Set current connection timezone- Parameters:
connectionTimeZone- connection timezone
-
getDefaultCalendar
java.util.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
-
-