public class NativeCharsetSettings extends CharsetMapping implements CharsetSettings
| Modifier and Type | Field and Description |
|---|---|
protected RuntimeProperty<java.lang.Boolean> |
cacheServerConfiguration |
protected RuntimeProperty<java.lang.String> |
characterEncoding |
protected RuntimeProperty<java.lang.String> |
characterSetResults |
java.util.Map<java.lang.String,java.lang.Integer> |
charsetNameToCollationIndex |
java.util.Map<java.lang.String,java.lang.String> |
charsetNameToJavaEncoding |
java.util.Map<java.lang.String,java.lang.Integer> |
charsetNameToMblen |
java.util.Map<java.lang.Integer,java.lang.String> |
collationIndexToCharsetName |
java.util.Map<java.lang.Integer,java.lang.String> |
collationIndexToCollationName |
java.util.Map<java.lang.String,java.lang.Integer> |
collationNameToCollationIndex |
protected RuntimeProperty<java.lang.String> |
connectionCollation |
java.util.Map<java.lang.String,java.lang.String> |
javaEncodingUcToCharsetName |
java.util.Set<java.lang.String> |
multibyteEncodings |
protected RuntimeProperty<java.lang.String> |
passwordCharacterEncoding |
MAP_SIZE, MYSQL_CHARSET_NAME_armscii8, MYSQL_CHARSET_NAME_ascii, MYSQL_CHARSET_NAME_big5, MYSQL_CHARSET_NAME_binary, MYSQL_CHARSET_NAME_cp1250, MYSQL_CHARSET_NAME_cp1251, MYSQL_CHARSET_NAME_cp1256, MYSQL_CHARSET_NAME_cp1257, MYSQL_CHARSET_NAME_cp850, MYSQL_CHARSET_NAME_cp852, MYSQL_CHARSET_NAME_cp866, MYSQL_CHARSET_NAME_cp932, MYSQL_CHARSET_NAME_dec8, MYSQL_CHARSET_NAME_eucjpms, MYSQL_CHARSET_NAME_euckr, MYSQL_CHARSET_NAME_gb18030, MYSQL_CHARSET_NAME_gb2312, MYSQL_CHARSET_NAME_gbk, MYSQL_CHARSET_NAME_geostd8, MYSQL_CHARSET_NAME_greek, MYSQL_CHARSET_NAME_hebrew, MYSQL_CHARSET_NAME_hp8, MYSQL_CHARSET_NAME_keybcs2, MYSQL_CHARSET_NAME_koi8r, MYSQL_CHARSET_NAME_koi8u, MYSQL_CHARSET_NAME_latin1, MYSQL_CHARSET_NAME_latin2, MYSQL_CHARSET_NAME_latin5, MYSQL_CHARSET_NAME_latin7, MYSQL_CHARSET_NAME_macce, MYSQL_CHARSET_NAME_macroman, MYSQL_CHARSET_NAME_sjis, MYSQL_CHARSET_NAME_swe7, MYSQL_CHARSET_NAME_tis620, MYSQL_CHARSET_NAME_ucs2, MYSQL_CHARSET_NAME_ujis, MYSQL_CHARSET_NAME_utf16, MYSQL_CHARSET_NAME_utf16le, MYSQL_CHARSET_NAME_utf32, MYSQL_CHARSET_NAME_utf8, MYSQL_CHARSET_NAME_utf8mb3, MYSQL_CHARSET_NAME_utf8mb4, MYSQL_COLLATION_INDEX_binary, MYSQL_COLLATION_INDEX_utf8mb4_0900_ai_ci, MYSQL_COLLATION_INDEX_utf8mb4_general_ciCHARACTER_SET_CLIENT, CHARACTER_SET_CONNECTION, CHARACTER_SET_RESULTS, COLLATION_CONNECTION| Constructor and Description |
|---|
NativeCharsetSettings(NativeSession sess) |
| Modifier and Type | Method and Description |
|---|---|
void |
configurePostHandshake(boolean dontCheckServerMatch)
Sets up client character set.
|
int |
configurePreHandshake(boolean reset)
Choose the MySQL collation index for the handshake packet and the corresponding Java encodings for the password and error messages.
|
boolean |
doesPlatformDbCharsetMatches() |
java.lang.Integer |
getCollationIndexForCollationName(java.lang.String collationName) |
int |
getCollationIndexForJavaEncoding(java.lang.String javaEncoding,
ServerVersion version) |
int |
getCollationIndexForMysqlCharsetName(java.lang.String charsetName) |
java.lang.String |
getCollationNameForCollationIndex(java.lang.Integer collationIndex) |
java.lang.String |
getErrorMessageEncoding() |
java.lang.String |
getJavaEncodingForCollationIndex(int collationIndex) |
java.lang.String |
getJavaEncodingForCollationIndex(java.lang.Integer collationIndex,
java.lang.String fallBackJavaEncoding) |
java.lang.String |
getJavaEncodingForMysqlCharset(java.lang.String mysqlCharsetName) |
java.lang.String |
getJavaEncodingForMysqlCharset(java.lang.String mysqlCharsetName,
java.lang.String javaEncoding) |
int |
getMaxBytesPerChar(java.lang.Integer charsetIndex,
java.lang.String javaCharsetName) |
int |
getMaxBytesPerChar(java.lang.String javaCharsetName) |
int |
getMetadataCollationIndex() |
java.lang.String |
getMetadataEncoding() |
java.lang.String |
getMysqlCharsetForJavaEncoding(java.lang.String javaEncoding,
ServerVersion version) |
java.lang.String |
getMysqlCharsetNameForCollationIndex(java.lang.Integer collationIndex) |
java.lang.String |
getPasswordCharacterEncoding() |
boolean |
getRequiresEscapingEncoder() |
java.lang.String |
getServerDefaultCharset()
Get 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
|
boolean |
isImpermissibleCollation(int collationIndex) |
boolean |
isMultibyteCharset(java.lang.String javaEncodingName) |
getStaticCollationIndexForCollationName, getStaticCollationIndexForJavaEncoding, getStaticCollationIndexForMysqlCharsetName, getStaticCollationNameForCollationIndex, getStaticJavaEncodingForCollationIndex, getStaticJavaEncodingForCollationIndex, getStaticJavaEncodingForMysqlCharset, getStaticJavaEncodingForMysqlCharset, getStaticMblen, getStaticMysqlCharsetAliasesByName, getStaticMysqlCharsetByName, getStaticMysqlCharsetForJavaEncoding, getStaticMysqlCharsetNameForCollationIndex, isStaticImpermissibleCollation, isStaticMultibyteCharsetpublic java.util.Map<java.lang.Integer,java.lang.String> collationIndexToCollationName
public java.util.Map<java.lang.String,java.lang.Integer> collationNameToCollationIndex
public java.util.Map<java.lang.Integer,java.lang.String> collationIndexToCharsetName
public java.util.Map<java.lang.String,java.lang.Integer> charsetNameToMblen
public java.util.Map<java.lang.String,java.lang.String> charsetNameToJavaEncoding
public java.util.Map<java.lang.String,java.lang.Integer> charsetNameToCollationIndex
public java.util.Map<java.lang.String,java.lang.String> javaEncodingUcToCharsetName
public java.util.Set<java.lang.String> multibyteEncodings
protected RuntimeProperty<java.lang.String> characterEncoding
protected RuntimeProperty<java.lang.String> passwordCharacterEncoding
protected RuntimeProperty<java.lang.String> characterSetResults
protected RuntimeProperty<java.lang.String> connectionCollation
protected RuntimeProperty<java.lang.Boolean> cacheServerConfiguration
public NativeCharsetSettings(NativeSession sess)
public boolean doesPlatformDbCharsetMatches()
doesPlatformDbCharsetMatches in interface CharsetSettingspublic int configurePreHandshake(boolean reset)
CharsetSettingsChoose the MySQL collation index for the handshake packet and the corresponding Java encodings for the password and error messages.
This index will be sent with HandshakeResponse setting server variables 'character_set_connection', 'collation_connection', 'character_set_client'
and 'character_set_results' which will be used by the server for decoding passwords during the authentication phase and later on, if
no SET NAMES are issued by CharsetSettings.configurePostHandshake(boolean).
It also means that collation index should be set according to:
Since Protocol::HandshakeV10 and Protocol::HandshakeResponse41 has only one byte for the collation it's not possible to use indexes > 255 during the handshake. Also, ucs2, utf16, utf16le and utf32 character sets are impermissible here. Connector/J will try to use utf8mb4 instead.
configurePreHandshake in interface CharsetSettingsreset - reset the charsets configuration; needed for changeUser call.public void configurePostHandshake(boolean dontCheckServerMatch)
CharsetSettingsCharsetSettings.configurePreHandshake(boolean) and sent in the Protocol::HandshakeV10 packet.
Here Connector/J alters these server variables if needed.configurePostHandshake in interface CharsetSettingsdontCheckServerMatch - if true then send the SET NAMES query even if server charset already matches the new value; needed for changeUser call.public java.lang.String getServerDefaultCharset()
public java.lang.String getErrorMessageEncoding()
getErrorMessageEncoding in interface CharsetSettingspublic java.lang.String getMetadataEncoding()
getMetadataEncoding in interface CharsetSettingspublic int getMetadataCollationIndex()
getMetadataCollationIndex in interface CharsetSettingspublic boolean getRequiresEscapingEncoder()
getRequiresEscapingEncoder in interface CharsetSettingspublic java.lang.String getPasswordCharacterEncoding()
getPasswordCharacterEncoding in interface CharsetSettingspublic java.lang.Integer getCollationIndexForCollationName(java.lang.String collationName)
getCollationIndexForCollationName in interface CharsetSettingspublic java.lang.String getCollationNameForCollationIndex(java.lang.Integer collationIndex)
getCollationNameForCollationIndex in interface CharsetSettingspublic java.lang.String getMysqlCharsetNameForCollationIndex(java.lang.Integer collationIndex)
getMysqlCharsetNameForCollationIndex in interface CharsetSettingspublic java.lang.String getJavaEncodingForCollationIndex(int collationIndex)
getJavaEncodingForCollationIndex in interface CharsetSettingspublic java.lang.String getJavaEncodingForCollationIndex(java.lang.Integer collationIndex,
java.lang.String fallBackJavaEncoding)
public int getCollationIndexForJavaEncoding(java.lang.String javaEncoding,
ServerVersion version)
getCollationIndexForJavaEncoding in interface CharsetSettingspublic int getCollationIndexForMysqlCharsetName(java.lang.String charsetName)
getCollationIndexForMysqlCharsetName in interface CharsetSettingspublic java.lang.String getJavaEncodingForMysqlCharset(java.lang.String mysqlCharsetName)
getJavaEncodingForMysqlCharset in interface CharsetSettingspublic java.lang.String getJavaEncodingForMysqlCharset(java.lang.String mysqlCharsetName,
java.lang.String javaEncoding)
public java.lang.String getMysqlCharsetForJavaEncoding(java.lang.String javaEncoding,
ServerVersion version)
getMysqlCharsetForJavaEncoding in interface CharsetSettingspublic boolean isImpermissibleCollation(int collationIndex)
public boolean isMultibyteCharset(java.lang.String javaEncodingName)
isMultibyteCharset in interface CharsetSettingspublic int getMaxBytesPerChar(java.lang.String javaCharsetName)
getMaxBytesPerChar in interface CharsetSettingspublic int getMaxBytesPerChar(java.lang.Integer charsetIndex,
java.lang.String javaCharsetName)
getMaxBytesPerChar in interface CharsetSettings