类 NativeCharsetSettings
- java.lang.Object
-
- com.mysql.cj.CharsetMapping
-
- com.mysql.cj.NativeCharsetSettings
-
- 所有已实现的接口:
CharsetSettings
public class NativeCharsetSettings extends CharsetMapping implements CharsetSettings
-
-
字段概要
-
从类继承的字段 com.mysql.cj.CharsetMapping
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_ci
-
从接口继承的字段 com.mysql.cj.CharsetSettings
CHARACTER_SET_CLIENT, CHARACTER_SET_CONNECTION, CHARACTER_SET_RESULTS, COLLATION_CONNECTION
-
-
构造器概要
构造器 构造器 说明 NativeCharsetSettings(NativeSession sess)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidconfigurePostHandshake(boolean dontCheckServerMatch)Sets up client character set.intconfigurePreHandshake(boolean reset)Choose the MySQL collation index for the handshake packet and the corresponding Java encodings for the password and error messages.booleandoesPlatformDbCharsetMatches()IntegergetCollationIndexForCollationName(String collationName)intgetCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)intgetCollationIndexForMysqlCharsetName(String charsetName)StringgetCollationNameForCollationIndex(Integer collationIndex)StringgetErrorMessageEncoding()StringgetJavaEncodingForCollationIndex(int collationIndex)StringgetJavaEncodingForCollationIndex(Integer collationIndex, String fallBackJavaEncoding)StringgetJavaEncodingForMysqlCharset(String mysqlCharsetName)StringgetJavaEncodingForMysqlCharset(String mysqlCharsetName, String javaEncoding)intgetMaxBytesPerChar(Integer charsetIndex, String javaCharsetName)intgetMaxBytesPerChar(String javaCharsetName)intgetMetadataCollationIndex()StringgetMetadataEncoding()StringgetMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)StringgetMysqlCharsetNameForCollationIndex(Integer collationIndex)StringgetPasswordCharacterEncoding()booleangetRequiresEscapingEncoder()StringgetServerDefaultCharset()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 indexbooleanisImpermissibleCollation(int collationIndex)booleanisMultibyteCharset(String javaEncodingName)-
从类继承的方法 com.mysql.cj.CharsetMapping
getStaticCollationIndexForCollationName, getStaticCollationIndexForJavaEncoding, getStaticCollationIndexForMysqlCharsetName, getStaticCollationNameForCollationIndex, getStaticJavaEncodingForCollationIndex, getStaticJavaEncodingForCollationIndex, getStaticJavaEncodingForMysqlCharset, getStaticJavaEncodingForMysqlCharset, getStaticMblen, getStaticMysqlCharsetAliasesByName, getStaticMysqlCharsetByName, getStaticMysqlCharsetForJavaEncoding, getStaticMysqlCharsetNameForCollationIndex, isStaticImpermissibleCollation, isStaticMultibyteCharset
-
-
-
-
字段详细资料
-
characterEncoding
protected RuntimeProperty<String> characterEncoding
-
passwordCharacterEncoding
protected RuntimeProperty<String> passwordCharacterEncoding
-
characterSetResults
protected RuntimeProperty<String> characterSetResults
-
connectionCollation
protected RuntimeProperty<String> connectionCollation
-
cacheServerConfiguration
protected RuntimeProperty<Boolean> cacheServerConfiguration
-
-
构造器详细资料
-
NativeCharsetSettings
public NativeCharsetSettings(NativeSession sess)
-
-
方法详细资料
-
doesPlatformDbCharsetMatches
public boolean doesPlatformDbCharsetMatches()
- 指定者:
doesPlatformDbCharsetMatches在接口中CharsetSettings
-
configurePreHandshake
public 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:
- 'passwordCharacterEncoding' if it's present, or
- 'connectionCollation' if it's present, or
- 'characterEncoding' if it's present
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在接口中CharsetSettings- 参数:
reset- reset the charsets configuration; needed for changeUser call.- 返回:
- MySQL collation index to be used during the handshake.
-
configurePostHandshake
public void configurePostHandshake(boolean dontCheckServerMatch)
从接口复制的说明:CharsetSettingsSets up client character set. This must be done before any further communication with the server! The 'collation_connection', 'character_set_client', 'character_set_connection' and 'character_set_results' server variables are set according to the collation index selected byCharsetSettings.configurePreHandshake(boolean)and sent in the Protocol::HandshakeV10 packet. Here Connector/J alters these server variables if needed.- 指定者:
configurePostHandshake在接口中CharsetSettings- 参数:
dontCheckServerMatch- if true then send the SET NAMES query even if server charset already matches the new value; needed for changeUser call.
-
getServerDefaultCharset
public 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- 返回:
- MySQL charset name
-
getErrorMessageEncoding
public String getErrorMessageEncoding()
- 指定者:
getErrorMessageEncoding在接口中CharsetSettings
-
getMetadataEncoding
public String getMetadataEncoding()
- 指定者:
getMetadataEncoding在接口中CharsetSettings
-
getMetadataCollationIndex
public int getMetadataCollationIndex()
- 指定者:
getMetadataCollationIndex在接口中CharsetSettings
-
getRequiresEscapingEncoder
public boolean getRequiresEscapingEncoder()
- 指定者:
getRequiresEscapingEncoder在接口中CharsetSettings
-
getPasswordCharacterEncoding
public String getPasswordCharacterEncoding()
- 指定者:
getPasswordCharacterEncoding在接口中CharsetSettings
-
getCollationIndexForCollationName
public Integer getCollationIndexForCollationName(String collationName)
-
getCollationNameForCollationIndex
public String getCollationNameForCollationIndex(Integer collationIndex)
-
getMysqlCharsetNameForCollationIndex
public String getMysqlCharsetNameForCollationIndex(Integer collationIndex)
-
getJavaEncodingForCollationIndex
public String getJavaEncodingForCollationIndex(int collationIndex)
-
getJavaEncodingForCollationIndex
public String getJavaEncodingForCollationIndex(Integer collationIndex, String fallBackJavaEncoding)
-
getCollationIndexForJavaEncoding
public int getCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)
-
getCollationIndexForMysqlCharsetName
public int getCollationIndexForMysqlCharsetName(String charsetName)
-
getJavaEncodingForMysqlCharset
public String getJavaEncodingForMysqlCharset(String mysqlCharsetName)
-
getJavaEncodingForMysqlCharset
public String getJavaEncodingForMysqlCharset(String mysqlCharsetName, String javaEncoding)
-
getMysqlCharsetForJavaEncoding
public String getMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)
-
isImpermissibleCollation
public boolean isImpermissibleCollation(int collationIndex)
-
isMultibyteCharset
public boolean isMultibyteCharset(String javaEncodingName)
- 指定者:
isMultibyteCharset在接口中CharsetSettings
-
getMaxBytesPerChar
public int getMaxBytesPerChar(String javaCharsetName)
- 指定者:
getMaxBytesPerChar在接口中CharsetSettings
-
getMaxBytesPerChar
public int getMaxBytesPerChar(Integer charsetIndex, String javaCharsetName)
- 指定者:
getMaxBytesPerChar在接口中CharsetSettings
-
-