程序包 com.mysql.cj

接口 CharsetSettings

    • 方法详细资料

      • configurePreHandshake

        int configurePreHandshake​(boolean reset)

        Choose 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 configurePostHandshake(boolean).

        It also means that collation index should be set according to:

        1. 'passwordCharacterEncoding' if it's present, or
        2. 'connectionCollation' if it's present, or
        3. 'characterEncoding' if it's present
        otherwise it will be set to utf8mb4_general_ci or utf8mb4_0900_ai_ci depending on server version.

        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.

        参数:
        reset - reset the charsets configuration; needed for changeUser call.
        返回:
        MySQL collation index to be used during the handshake.
      • configurePostHandshake

        void configurePostHandshake​(boolean dontCheckServerMatch)
        Sets 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 by configurePreHandshake(boolean) and sent in the Protocol::HandshakeV10 packet. Here Connector/J alters these server variables if needed.
        参数:
        dontCheckServerMatch - if true then send the SET NAMES query even if server charset already matches the new value; needed for changeUser call.
      • doesPlatformDbCharsetMatches

        boolean doesPlatformDbCharsetMatches()
      • getPasswordCharacterEncoding

        String getPasswordCharacterEncoding()
      • getErrorMessageEncoding

        String getErrorMessageEncoding()
      • getMetadataEncoding

        String getMetadataEncoding()
      • getMetadataCollationIndex

        int getMetadataCollationIndex()
      • getRequiresEscapingEncoder

        boolean getRequiresEscapingEncoder()
      • getJavaEncodingForCollationIndex

        String getJavaEncodingForCollationIndex​(int collationIndex)
      • getMaxBytesPerChar

        int getMaxBytesPerChar​(String javaCharsetName)
      • getMaxBytesPerChar

        int getMaxBytesPerChar​(Integer charsetIndex,
                               String javaCharsetName)
      • getCollationIndexForCollationName

        Integer getCollationIndexForCollationName​(String collationName)
      • getCollationNameForCollationIndex

        String getCollationNameForCollationIndex​(Integer collationIndex)
      • getMysqlCharsetNameForCollationIndex

        String getMysqlCharsetNameForCollationIndex​(Integer collationIndex)
      • getCollationIndexForJavaEncoding

        int getCollationIndexForJavaEncoding​(String javaEncoding,
                                             ServerVersion version)
      • getCollationIndexForMysqlCharsetName

        int getCollationIndexForMysqlCharsetName​(String charsetName)
      • getJavaEncodingForMysqlCharset

        String getJavaEncodingForMysqlCharset​(String mysqlCharsetName)
      • isMultibyteCharset

        boolean isMultibyteCharset​(String javaEncodingName)