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 booleancharacterSetNamesMatches(java.lang.String mysqlEncodingName)voidconfigureCharacterSets()booleancursorExists()Server will only open a cursor and set this flag if it can, otherwise it punts and goes back to mysql_store_results() behavior.NativeCapabilitiesgetCapabilities()java.lang.StringgetCharacterSetMetadata()java.lang.StringgetCharacterSetResultsOnServer()longgetClientParam()java.util.TimeZonegetDefaultTimeZone()The default time zone used to marshall date/time values to/from the server.java.lang.StringgetEncodingForIndex(int charsetIndex)Returns the Java character encoding name for the given MySQL server collation indexjava.lang.StringgetErrorMessageEncoding()intgetMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName)intgetMaxBytesPerChar(java.lang.String javaCharsetName)intgetMetadataCollationIndex()intgetOldStatusFlags()java.lang.StringgetServerDefaultCharset()intgetServerDefaultCollationIndex()java.lang.StringgetServerVariable(java.lang.String name)intgetServerVariable(java.lang.String variableName, int fallbackValue)java.util.Map<java.lang.String,java.lang.String>getServerVariables()ServerVersiongetServerVersion()Get the version of the MySQL server we are talking to.java.util.TimeZonegetSessionTimeZone()intgetStatusFlags()longgetThreadId()intgetTransactionState()booleanhasLongColumnInfo()booleanhasMoreResults()booleaninTransactionOnServer()booleanisAutocommit()booleanisAutoCommit()booleanisEOFDeprecated()booleanisLastRowSent()booleanisLowerCaseTableNames()Is the server configured to use lower-case table names only?booleanisNoBackslashEscapesSet()Is the server in a sql_mode that does not allow us to use \\ to escape things?booleanisQueryCacheEnabled()booleanisServerTruncatesFracSecs()booleanisSetNeededForAutoCommitMode(boolean autoCommitFlag, boolean elideSetAutoCommitsFlag)Should SET AUTOCOMMIT be sent to server if we are going to set autoCommitFlag in driverbooleanisVersion(ServerVersion version)Is the version of the MySQL server we are connected to the given version?booleannoGoodIndexUsed()booleannoIndexUsed()voidpreserveOldTransactionState()booleanqueryWasSlow()voidsetAutoCommit(boolean autoCommit)voidsetCapabilities(ServerCapabilities capabilities)voidsetCharacterSetMetadata(java.lang.String characterSetMetadata)voidsetCharacterSetResultsOnServer(java.lang.String characterSetResultsOnServer)voidsetClientParam(long clientParam)voidsetErrorMessageEncoding(java.lang.String errorMessageEncoding)voidsetMetadataCollationIndex(int metadataCollationIndex)voidsetOldStatusFlags(int oldStatusFlags)voidsetServerDefaultCollationIndex(int serverDefaultCollationIndex)Stores collation index which server provided in handshake greeting packet.voidsetServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables)voidsetSessionTimeZone(java.util.TimeZone sessionTimeZone)voidsetStatusFlags(int statusFlags)Sets new server status (from response) without saving it's old statevoidsetStatusFlags(int statusFlags, boolean saveOldStatus)Sets new server status (from response)voidsetThreadId(long threadId)booleanstoresLowerCaseTableNames()booleanuseAnsiQuotedIdentifiers()booleanuseMultiResults()
-
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:
getCapabilitiesin interfaceServerSession
-
setCapabilities
- Specified by:
setCapabilitiesin interfaceServerSession
-
getStatusFlags
public int getStatusFlags()- Specified by:
getStatusFlagsin interfaceServerSession
-
setStatusFlags
public void setStatusFlags(int statusFlags)Description copied from interface:ServerSessionSets new server status (from response) without saving it's old state- Specified by:
setStatusFlagsin interfaceServerSession- Parameters:
statusFlags- server status flags
-
setStatusFlags
public void setStatusFlags(int statusFlags, boolean saveOldStatus)Description copied from interface:ServerSessionSets new server status (from response)- Specified by:
setStatusFlagsin interfaceServerSession- Parameters:
statusFlags- new server status flagssaveOldStatus- true if old server status flags should be preserved
-
getOldStatusFlags
public int getOldStatusFlags()- Specified by:
getOldStatusFlagsin interfaceServerSession
-
setOldStatusFlags
public void setOldStatusFlags(int oldStatusFlags)- Specified by:
setOldStatusFlagsin interfaceServerSession
-
getTransactionState
public int getTransactionState()- Specified by:
getTransactionStatein interfaceServerSession- Returns:
- TRANSACTION_NOT_STARTED, TRANSACTION_IN_PROGRESS, TRANSACTION_STARTED or TRANSACTION_COMPLETED
-
inTransactionOnServer
public boolean inTransactionOnServer()- Specified by:
inTransactionOnServerin interfaceServerSession
-
cursorExists
public boolean cursorExists()Description copied from interface:ServerSessionServer 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:
cursorExistsin interfaceServerSession- Returns:
- SERVER_STATUS_CURSOR_EXISTS status flag value.
-
isAutocommit
public boolean isAutocommit()- Specified by:
isAutocommitin interfaceServerSession
-
hasMoreResults
public boolean hasMoreResults()- Specified by:
hasMoreResultsin interfaceServerSession
-
noGoodIndexUsed
public boolean noGoodIndexUsed()- Specified by:
noGoodIndexUsedin interfaceServerSession
-
noIndexUsed
public boolean noIndexUsed()- Specified by:
noIndexUsedin interfaceServerSession
-
queryWasSlow
public boolean queryWasSlow()- Specified by:
queryWasSlowin interfaceServerSession
-
isLastRowSent
public boolean isLastRowSent()- Specified by:
isLastRowSentin interfaceServerSession
-
getClientParam
public long getClientParam()- Specified by:
getClientParamin interfaceServerSession
-
setClientParam
public void setClientParam(long clientParam)- Specified by:
setClientParamin interfaceServerSession
-
useMultiResults
public boolean useMultiResults()- Specified by:
useMultiResultsin interfaceServerSession
-
isEOFDeprecated
public boolean isEOFDeprecated()- Specified by:
isEOFDeprecatedin interfaceServerSession
-
getServerDefaultCollationIndex
public int getServerDefaultCollationIndex()- Specified by:
getServerDefaultCollationIndexin interfaceServerSession- Returns:
- Collation index which server provided in handshake greeting packet
-
setServerDefaultCollationIndex
public void setServerDefaultCollationIndex(int serverDefaultCollationIndex)Description copied from interface:ServerSessionStores collation index which server provided in handshake greeting packet.- Specified by:
setServerDefaultCollationIndexin interfaceServerSession- Parameters:
serverDefaultCollationIndex- collation index
-
hasLongColumnInfo
public boolean hasLongColumnInfo()- Specified by:
hasLongColumnInfoin interfaceServerSession
-
getServerVariables
public java.util.Map<java.lang.String,java.lang.String> getServerVariables()- Specified by:
getServerVariablesin interfaceServerSession
-
getServerVariable
public java.lang.String getServerVariable(java.lang.String name)- Specified by:
getServerVariablein interfaceServerSession
-
getServerVariable
public int getServerVariable(java.lang.String variableName, int fallbackValue)- Specified by:
getServerVariablein interfaceServerSession
-
setServerVariables
public void setServerVariables(java.util.Map<java.lang.String,java.lang.String> serverVariables)- Specified by:
setServerVariablesin interfaceServerSession
-
characterSetNamesMatches
public boolean characterSetNamesMatches(java.lang.String mysqlEncodingName)- Specified by:
characterSetNamesMatchesin interfaceServerSession
-
getServerVersion
Description copied from interface:ServerSessionGet the version of the MySQL server we are talking to.- Specified by:
getServerVersionin interfaceServerSession- Returns:
ServerVersion
-
isVersion
Description copied from interface:ServerSessionIs the version of the MySQL server we are connected to the given version?- Specified by:
isVersionin 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:
getErrorMessageEncodingin interfaceServerSession
-
setErrorMessageEncoding
public void setErrorMessageEncoding(java.lang.String errorMessageEncoding)- Specified by:
setErrorMessageEncodingin interfaceServerSession
-
getServerDefaultCharset
public java.lang.String getServerDefaultCharset()- Specified by:
getServerDefaultCharsetin 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:
getMaxBytesPerCharin interfaceServerSession
-
getMaxBytesPerChar
public int getMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName)- Specified by:
getMaxBytesPerCharin interfaceServerSession
-
getEncodingForIndex
public java.lang.String getEncodingForIndex(int charsetIndex)Description copied from interface:ServerSessionReturns the Java character encoding name for the given MySQL server collation index- Specified by:
getEncodingForIndexin interfaceServerSession- Parameters:
charsetIndex- collation index- Returns:
- the Java character encoding name for the given MySQL server collation index
-
configureCharacterSets
public void configureCharacterSets()- Specified by:
configureCharacterSetsin interfaceServerSession
-
getCharacterSetMetadata
public java.lang.String getCharacterSetMetadata()- Specified by:
getCharacterSetMetadatain interfaceServerSession
-
setCharacterSetMetadata
public void setCharacterSetMetadata(java.lang.String characterSetMetadata)- Specified by:
setCharacterSetMetadatain interfaceServerSession
-
getMetadataCollationIndex
public int getMetadataCollationIndex()- Specified by:
getMetadataCollationIndexin interfaceServerSession
-
setMetadataCollationIndex
public void setMetadataCollationIndex(int metadataCollationIndex)- Specified by:
setMetadataCollationIndexin interfaceServerSession
-
getCharacterSetResultsOnServer
public java.lang.String getCharacterSetResultsOnServer()- Specified by:
getCharacterSetResultsOnServerin interfaceServerSession
-
setCharacterSetResultsOnServer
public void setCharacterSetResultsOnServer(java.lang.String characterSetResultsOnServer)- Specified by:
setCharacterSetResultsOnServerin interfaceServerSession
-
preserveOldTransactionState
public void preserveOldTransactionState() -
isLowerCaseTableNames
public boolean isLowerCaseTableNames()Description copied from interface:ServerSessionIs the server configured to use lower-case table names only?- Specified by:
isLowerCaseTableNamesin interfaceServerSession- Returns:
- true if lower_case_table_names is 'on'
-
storesLowerCaseTableNames
public boolean storesLowerCaseTableNames()- Specified by:
storesLowerCaseTableNamesin interfaceServerSession
-
isQueryCacheEnabled
public boolean isQueryCacheEnabled()- Specified by:
isQueryCacheEnabledin interfaceServerSession
-
isNoBackslashEscapesSet
public boolean isNoBackslashEscapesSet()Is the server in a sql_mode that does not allow us to use \\ to escape things?- Specified by:
isNoBackslashEscapesSetin interfaceServerSession- Returns:
- Returns the noBackslashEscapes.
-
useAnsiQuotedIdentifiers
public boolean useAnsiQuotedIdentifiers()- Specified by:
useAnsiQuotedIdentifiersin interfaceServerSession
-
isServerTruncatesFracSecs
public boolean isServerTruncatesFracSecs()- Specified by:
isServerTruncatesFracSecsin interfaceServerSession
-
getThreadId
public long getThreadId()- Specified by:
getThreadIdin interfaceServerSession
-
setThreadId
public void setThreadId(long threadId)- Specified by:
setThreadIdin interfaceServerSession
-
isAutoCommit
public boolean isAutoCommit()- Specified by:
isAutoCommitin interfaceServerSession
-
setAutoCommit
public void setAutoCommit(boolean autoCommit)- Specified by:
setAutoCommitin interfaceServerSession
-
getSessionTimeZone
public java.util.TimeZone getSessionTimeZone()- Specified by:
getSessionTimeZonein interfaceServerSession
-
setSessionTimeZone
public void setSessionTimeZone(java.util.TimeZone sessionTimeZone)- Specified by:
setSessionTimeZonein interfaceServerSession
-
getDefaultTimeZone
public java.util.TimeZone getDefaultTimeZone()Description copied from interface:ServerSessionThe 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:
getDefaultTimeZonein interfaceServerSession- Returns:
- The default JVM time zone
-