Package com.mysql.cj.protocol.a
Class NativeServerSession
java.lang.Object
com.mysql.cj.protocol.a.NativeServerSession
- All Implemented Interfaces:
ServerSession
public class NativeServerSession extends java.lang.Object implements ServerSession
-
Field Summary
Fields inherited from interface com.mysql.cj.protocol.ServerSession
LOCAL_CHARACTER_SET_RESULTS, TRANSACTION_COMPLETED, TRANSACTION_IN_PROGRESS, TRANSACTION_NOT_STARTED, TRANSACTION_STARTED
-
Constructor Summary
Constructors Constructor Description NativeServerSession(PropertySet propertySet)
-
Method Summary
Modifier and Type Method Description boolean
characterSetNamesMatches(java.lang.String mysqlEncodingName)
void
configureCharacterSets()
boolean
cursorExists()
Server will only open a cursor and set this flag if it can, otherwise it punts and goes back to mysql_store_results() behavior.NativeCapabilities
getCapabilities()
java.lang.String
getCharacterSetMetadata()
java.lang.String
getCharacterSetResultsOnServer()
long
getClientParam()
java.util.TimeZone
getDefaultTimeZone()
The default time zone used to marshall date/time values to/from the server.java.lang.String
getEncodingForIndex(int charsetIndex)
Returns the Java character encoding name for the given MySQL server collation indexjava.lang.String
getErrorMessageEncoding()
int
getMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName)
int
getMaxBytesPerChar(java.lang.String javaCharsetName)
int
getMetadataCollationIndex()
int
getOldStatusFlags()
java.lang.String
getServerDefaultCharset()
int
getServerDefaultCollationIndex()
java.lang.String
getServerVariable(java.lang.String name)
int
getServerVariable(java.lang.String variableName, int fallbackValue)
java.util.Map<java.lang.String,java.lang.String>
getServerVariables()
ServerVersion
getServerVersion()
Get the version of the MySQL server we are talking to.java.util.TimeZone
getSessionTimeZone()
int
getStatusFlags()
long
getThreadId()
int
getTransactionState()
boolean
hasLongColumnInfo()
boolean
hasMoreResults()
boolean
inTransactionOnServer()
boolean
isAutocommit()
boolean
isAutoCommit()
boolean
isEOFDeprecated()
boolean
isLastRowSent()
boolean
isLowerCaseTableNames()
Is the server configured to use lower-case table names only?boolean
isNoBackslashEscapesSet()
Is the server in a sql_mode that does not allow us to use \\ to escape things?boolean
isQueryCacheEnabled()
boolean
isServerTruncatesFracSecs()
boolean
isSetNeededForAutoCommitMode(boolean autoCommitFlag, boolean elideSetAutoCommitsFlag)
Should SET AUTOCOMMIT be sent to server if we are going to set autoCommitFlag in driverboolean
isVersion(ServerVersion version)
Is the version of the MySQL server we are connected to the given version?boolean
noGoodIndexUsed()
boolean
noIndexUsed()
void
preserveOldTransactionState()
boolean
queryWasSlow()
void
setAutoCommit(boolean autoCommit)
void
setCapabilities(ServerCapabilities capabilities)
void
setCharacterSetMetadata(java.lang.String characterSetMetadata)
void
setCharacterSetResultsOnServer(java.lang.String characterSetResultsOnServer)
void
setClientParam(long clientParam)
void
setErrorMessageEncoding(java.lang.String errorMessageEncoding)
void
setMetadataCollationIndex(int metadataCollationIndex)
void
setOldStatusFlags(int oldStatusFlags)
void
setServerDefaultCollationIndex(int serverDefaultCollationIndex)
Stores collation index which server provided in handshake greeting packet.void
setServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables)
void
setSessionTimeZone(java.util.TimeZone sessionTimeZone)
void
setStatusFlags(int statusFlags)
Sets new server status (from response) without saving it's old statevoid
setStatusFlags(int statusFlags, boolean saveOldStatus)
Sets new server status (from response)void
setThreadId(long threadId)
boolean
storesLowerCaseTableNames()
boolean
useAnsiQuotedIdentifiers()
boolean
useMultiResults()
-
Field Details
-
SERVER_STATUS_IN_TRANS
public static final int SERVER_STATUS_IN_TRANS- See Also:
- Constant Field Values
-
SERVER_STATUS_AUTOCOMMIT
public static final int SERVER_STATUS_AUTOCOMMIT- See Also:
- Constant Field Values
-
SERVER_MORE_RESULTS_EXISTS
public static final int SERVER_MORE_RESULTS_EXISTS- See Also:
- Constant Field Values
-
SERVER_QUERY_NO_GOOD_INDEX_USED
public static final int SERVER_QUERY_NO_GOOD_INDEX_USED- See Also:
- Constant Field Values
-
SERVER_QUERY_NO_INDEX_USED
public static final int SERVER_QUERY_NO_INDEX_USED- See Also:
- Constant Field Values
-
SERVER_STATUS_CURSOR_EXISTS
public static final int SERVER_STATUS_CURSOR_EXISTS- See Also:
- Constant Field Values
-
SERVER_STATUS_LAST_ROW_SENT
public static final int SERVER_STATUS_LAST_ROW_SENT- See Also:
- Constant Field Values
-
SERVER_QUERY_WAS_SLOW
public static final int SERVER_QUERY_WAS_SLOW- See Also:
- Constant Field Values
-
CLIENT_LONG_PASSWORD
public static final int CLIENT_LONG_PASSWORD- See Also:
- Constant Field Values
-
CLIENT_FOUND_ROWS
public static final int CLIENT_FOUND_ROWS- See Also:
- Constant Field Values
-
CLIENT_LONG_FLAG
public static final int CLIENT_LONG_FLAG- See Also:
- Constant Field Values
-
CLIENT_CONNECT_WITH_DB
public static final int CLIENT_CONNECT_WITH_DB- See Also:
- Constant Field Values
-
CLIENT_COMPRESS
public static final int CLIENT_COMPRESS- See Also:
- Constant Field Values
-
CLIENT_LOCAL_FILES
public static final int CLIENT_LOCAL_FILES- See Also:
- Constant Field Values
-
CLIENT_PROTOCOL_41
public static final int CLIENT_PROTOCOL_41- See Also:
- Constant Field Values
-
CLIENT_INTERACTIVE
public static final int CLIENT_INTERACTIVE- See Also:
- Constant Field Values
-
CLIENT_SSL
public static final int CLIENT_SSL- See Also:
- Constant Field Values
-
CLIENT_TRANSACTIONS
public static final int CLIENT_TRANSACTIONS- See Also:
- Constant Field Values
-
CLIENT_RESERVED
public static final int CLIENT_RESERVED- See Also:
- Constant Field Values
-
CLIENT_SECURE_CONNECTION
public static final int CLIENT_SECURE_CONNECTION- See Also:
- Constant Field Values
-
CLIENT_MULTI_STATEMENTS
public static final int CLIENT_MULTI_STATEMENTS- See Also:
- Constant Field Values
-
CLIENT_MULTI_RESULTS
public static final int CLIENT_MULTI_RESULTS- See Also:
- Constant Field Values
-
CLIENT_PS_MULTI_RESULTS
public static final int CLIENT_PS_MULTI_RESULTS- See Also:
- Constant Field Values
-
CLIENT_PLUGIN_AUTH
public static final int CLIENT_PLUGIN_AUTH- See Also:
- Constant Field Values
-
CLIENT_CONNECT_ATTRS
public static final int CLIENT_CONNECT_ATTRS- See Also:
- Constant Field Values
-
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA
public static final int CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA- See Also:
- Constant Field Values
-
CLIENT_CAN_HANDLE_EXPIRED_PASSWORD
public static final int CLIENT_CAN_HANDLE_EXPIRED_PASSWORD- See Also:
- Constant Field Values
-
CLIENT_SESSION_TRACK
public static final int CLIENT_SESSION_TRACK- See Also:
- Constant Field Values
-
CLIENT_DEPRECATE_EOF
public static final int CLIENT_DEPRECATE_EOF- See Also:
- Constant Field Values
-
indexToCustomMysqlCharset
public java.util.Map<java.lang.Integer,java.lang.String> indexToCustomMysqlCharset -
mysqlCharsetToCustomMblen
public java.util.Map<java.lang.String,java.lang.Integer> mysqlCharsetToCustomMblen
-
-
Constructor Details
-
Method Details
-
getCapabilities
- Specified by:
getCapabilities
in interfaceServerSession
-
setCapabilities
- Specified by:
setCapabilities
in interfaceServerSession
-
getStatusFlags
public int getStatusFlags()- Specified by:
getStatusFlags
in interfaceServerSession
-
setStatusFlags
public void setStatusFlags(int statusFlags)Description copied from interface:ServerSession
Sets new server status (from response) without saving it's old state- Specified by:
setStatusFlags
in interfaceServerSession
- Parameters:
statusFlags
- server status flags
-
setStatusFlags
public void setStatusFlags(int statusFlags, boolean saveOldStatus)Description copied from interface:ServerSession
Sets new server status (from response)- Specified by:
setStatusFlags
in interfaceServerSession
- Parameters:
statusFlags
- new server status flagssaveOldStatus
- true if old server status flags should be preserved
-
getOldStatusFlags
public int getOldStatusFlags()- Specified by:
getOldStatusFlags
in interfaceServerSession
-
setOldStatusFlags
public void setOldStatusFlags(int oldStatusFlags)- Specified by:
setOldStatusFlags
in interfaceServerSession
-
getTransactionState
public int getTransactionState()- Specified by:
getTransactionState
in interfaceServerSession
- Returns:
- TRANSACTION_NOT_STARTED, TRANSACTION_IN_PROGRESS, TRANSACTION_STARTED or TRANSACTION_COMPLETED
-
inTransactionOnServer
public boolean inTransactionOnServer()- Specified by:
inTransactionOnServer
in interfaceServerSession
-
cursorExists
public boolean cursorExists()Description copied from interface:ServerSession
Server will only open a cursor and set this flag if it can, otherwise it punts and goes back to mysql_store_results() behavior.- Specified by:
cursorExists
in interfaceServerSession
- Returns:
- SERVER_STATUS_CURSOR_EXISTS status flag value.
-
isAutocommit
public boolean isAutocommit()- Specified by:
isAutocommit
in interfaceServerSession
-
hasMoreResults
public boolean hasMoreResults()- Specified by:
hasMoreResults
in interfaceServerSession
-
noGoodIndexUsed
public boolean noGoodIndexUsed()- Specified by:
noGoodIndexUsed
in interfaceServerSession
-
noIndexUsed
public boolean noIndexUsed()- Specified by:
noIndexUsed
in interfaceServerSession
-
queryWasSlow
public boolean queryWasSlow()- Specified by:
queryWasSlow
in interfaceServerSession
-
isLastRowSent
public boolean isLastRowSent()- Specified by:
isLastRowSent
in interfaceServerSession
-
getClientParam
public long getClientParam()- Specified by:
getClientParam
in interfaceServerSession
-
setClientParam
public void setClientParam(long clientParam)- Specified by:
setClientParam
in interfaceServerSession
-
useMultiResults
public boolean useMultiResults()- Specified by:
useMultiResults
in interfaceServerSession
-
isEOFDeprecated
public boolean isEOFDeprecated()- Specified by:
isEOFDeprecated
in interfaceServerSession
-
getServerDefaultCollationIndex
public int getServerDefaultCollationIndex()- Specified by:
getServerDefaultCollationIndex
in interfaceServerSession
- Returns:
- Collation index which server provided in handshake greeting packet
-
setServerDefaultCollationIndex
public void setServerDefaultCollationIndex(int serverDefaultCollationIndex)Description copied from interface:ServerSession
Stores collation index which server provided in handshake greeting packet.- Specified by:
setServerDefaultCollationIndex
in interfaceServerSession
- Parameters:
serverDefaultCollationIndex
- collation index
-
hasLongColumnInfo
public boolean hasLongColumnInfo()- Specified by:
hasLongColumnInfo
in interfaceServerSession
-
getServerVariables
public java.util.Map<java.lang.String,java.lang.String> getServerVariables()- Specified by:
getServerVariables
in interfaceServerSession
-
getServerVariable
public java.lang.String getServerVariable(java.lang.String name)- Specified by:
getServerVariable
in interfaceServerSession
-
getServerVariable
public int getServerVariable(java.lang.String variableName, int fallbackValue)- Specified by:
getServerVariable
in interfaceServerSession
-
setServerVariables
public void setServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables)- Specified by:
setServerVariables
in interfaceServerSession
-
characterSetNamesMatches
public boolean characterSetNamesMatches(java.lang.String mysqlEncodingName)- Specified by:
characterSetNamesMatches
in interfaceServerSession
-
getServerVersion
Description copied from interface:ServerSession
Get the version of the MySQL server we are talking to.- Specified by:
getServerVersion
in interfaceServerSession
- Returns:
ServerVersion
-
isVersion
Description copied from interface:ServerSession
Is the version of the MySQL server we are connected to the given version?- Specified by:
isVersion
in interfaceServerSession
- Parameters:
version
- the version to check for- Returns:
- true if the version of the MySQL server we are connected is the given version
-
isSetNeededForAutoCommitMode
public boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag, boolean elideSetAutoCommitsFlag)Should SET AUTOCOMMIT be sent to server if we are going to set autoCommitFlag in driver- Parameters:
autoCommitFlag
- autocommit status we are going to set in driverelideSetAutoCommitsFlag
- 'elideSetAutoCommits' property value- Returns:
- true if SET AUTOCOMMIT to be sent
-
getErrorMessageEncoding
public java.lang.String getErrorMessageEncoding()- Specified by:
getErrorMessageEncoding
in interfaceServerSession
-
setErrorMessageEncoding
public void setErrorMessageEncoding(java.lang.String errorMessageEncoding)- Specified by:
setErrorMessageEncoding
in interfaceServerSession
-
getServerDefaultCharset
public java.lang.String getServerDefaultCharset()- Specified by:
getServerDefaultCharset
in interfaceServerSession
- Returns:
- the server's default character set name according to collation index from server greeting, or value of 'character_set_server' variable if there is no mapping for that index
-
getMaxBytesPerChar
public int getMaxBytesPerChar(java.lang.String javaCharsetName)- Specified by:
getMaxBytesPerChar
in interfaceServerSession
-
getMaxBytesPerChar
public int getMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName)- Specified by:
getMaxBytesPerChar
in interfaceServerSession
-
getEncodingForIndex
public java.lang.String getEncodingForIndex(int charsetIndex)Description copied from interface:ServerSession
Returns the Java character encoding name for the given MySQL server collation index- Specified by:
getEncodingForIndex
in interfaceServerSession
- Parameters:
charsetIndex
- collation index- Returns:
- the Java character encoding name for the given MySQL server collation index
-
configureCharacterSets
public void configureCharacterSets()- Specified by:
configureCharacterSets
in interfaceServerSession
-
getCharacterSetMetadata
public java.lang.String getCharacterSetMetadata()- Specified by:
getCharacterSetMetadata
in interfaceServerSession
-
setCharacterSetMetadata
public void setCharacterSetMetadata(java.lang.String characterSetMetadata)- Specified by:
setCharacterSetMetadata
in interfaceServerSession
-
getMetadataCollationIndex
public int getMetadataCollationIndex()- Specified by:
getMetadataCollationIndex
in interfaceServerSession
-
setMetadataCollationIndex
public void setMetadataCollationIndex(int metadataCollationIndex)- Specified by:
setMetadataCollationIndex
in interfaceServerSession
-
getCharacterSetResultsOnServer
public java.lang.String getCharacterSetResultsOnServer()- Specified by:
getCharacterSetResultsOnServer
in interfaceServerSession
-
setCharacterSetResultsOnServer
public void setCharacterSetResultsOnServer(java.lang.String characterSetResultsOnServer)- Specified by:
setCharacterSetResultsOnServer
in interfaceServerSession
-
preserveOldTransactionState
public void preserveOldTransactionState() -
isLowerCaseTableNames
public boolean isLowerCaseTableNames()Description copied from interface:ServerSession
Is the server configured to use lower-case table names only?- Specified by:
isLowerCaseTableNames
in interfaceServerSession
- Returns:
- true if lower_case_table_names is 'on'
-
storesLowerCaseTableNames
public boolean storesLowerCaseTableNames()- Specified by:
storesLowerCaseTableNames
in interfaceServerSession
-
isQueryCacheEnabled
public boolean isQueryCacheEnabled()- Specified by:
isQueryCacheEnabled
in interfaceServerSession
-
isNoBackslashEscapesSet
public boolean isNoBackslashEscapesSet()Is the server in a sql_mode that does not allow us to use \\ to escape things?- Specified by:
isNoBackslashEscapesSet
in interfaceServerSession
- Returns:
- Returns the noBackslashEscapes.
-
useAnsiQuotedIdentifiers
public boolean useAnsiQuotedIdentifiers()- Specified by:
useAnsiQuotedIdentifiers
in interfaceServerSession
-
isServerTruncatesFracSecs
public boolean isServerTruncatesFracSecs()- Specified by:
isServerTruncatesFracSecs
in interfaceServerSession
-
getThreadId
public long getThreadId()- Specified by:
getThreadId
in interfaceServerSession
-
setThreadId
public void setThreadId(long threadId)- Specified by:
setThreadId
in interfaceServerSession
-
isAutoCommit
public boolean isAutoCommit()- Specified by:
isAutoCommit
in interfaceServerSession
-
setAutoCommit
public void setAutoCommit(boolean autoCommit)- Specified by:
setAutoCommit
in interfaceServerSession
-
getSessionTimeZone
public java.util.TimeZone getSessionTimeZone()- Specified by:
getSessionTimeZone
in interfaceServerSession
-
setSessionTimeZone
public void setSessionTimeZone(java.util.TimeZone sessionTimeZone)- Specified by:
setSessionTimeZone
in interfaceServerSession
-
getDefaultTimeZone
public java.util.TimeZone getDefaultTimeZone()Description copied from interface:ServerSession
The default time zone used to marshall date/time values to/from the server. This is used when getDate(), etc methods are called without a calendar argument.- Specified by:
getDefaultTimeZone
in interfaceServerSession
- Returns:
- The default JVM time zone
-