类 XProtocol

    • 字段详细资料

      • defaultSchemaName

        public String defaultSchemaName
    • 方法详细资料

      • sendCapabilities

        public void sendCapabilities​(Map<String,​Object> keyValuePair)
        Set client capabilities of current session. Must be done before authentication (changeUser(String, String, String)).
        参数:
        keyValuePair - capabilities name/value map
      • negotiateCompression

        public void negotiateCompression()
        Negotiates compression capabilities with the server.
      • connect

        public void connect​(String user,
                            String password,
                            String database)
        从接口复制的说明: Protocol
        Create a new session. This generally happens once at the beginning of a connection.
        指定者:
        connect 在接口中 Protocol<XMessage>
        参数:
        user - DB user name
        password - DB user password
        database - database name
      • changeUser

        public void changeUser​(String user,
                               String password,
                               String database)
        从接口复制的说明: Protocol
        Re-authenticates as the given user and password
        指定者:
        changeUser 在接口中 Protocol<XMessage>
        参数:
        user - DB user name
        password - DB user password
        database - database name
      • readAuthenticateOk

        public void readAuthenticateOk()
      • readAuthenticateContinue

        public byte[] readAuthenticateContinue()
      • hasMoreResults

        public boolean hasMoreResults()
      • hasResults

        public boolean hasResults()
        Used only in tests
        返回:
        true if there are result rows
      • drainRows

        public void drainRows()
        Used only in tests
      • supportsPreparedStatements

        public boolean supportsPreparedStatements()
        Checks if the MySQL server currently connected supports prepared statements.
        返回:
        true if the MySQL server currently connected supports prepared statements.
      • readyForPreparingStatements

        public boolean readyForPreparingStatements()
        Checks if enough statements have been executed in this MySQL server so that another prepare statement attempt should be done.
        返回:
        true if enough executions have been done since last time a prepared statement failed to prepare
      • getNewPreparedStatementId

        public int getNewPreparedStatementId​(PreparableStatement<?> preparableStatement)
        Returns an id to be used as a client-managed prepared statement id. The method freePreparedStatementId(int) must be called when the prepared statement is deallocated so that the same id can be re-used.
        参数:
        preparableStatement - PreparableStatement
        返回:
        a new identifier to be used as prepared statement id
      • freePreparedStatementId

        public void freePreparedStatementId​(int preparedStatementId)
        Frees a prepared statement id so that it can be reused. Note that freeing an id from an active prepared statement will result in a statement prepare conflict next time one gets prepared with the same released id.
        参数:
        preparedStatementId - the prepared statement id to release
      • failedPreparingStatement

        public boolean failedPreparingStatement​(int preparedStatementId,
                                                XProtocolError e)
        Informs this protocol instance that preparing a statement on the connected server failed.
        参数:
        preparedStatementId - the id of the prepared statement that failed to prepare
        e - XProtocolError
        返回:
        true if the exception was properly handled
      • newCommand

        protected void newCommand()
        Signal the intent to start processing a new command. A session supports processing a single command at a time. Results are read lazily from the wire. It is necessary to flush any pending result before starting a new command. This method performs the flush if necessary.
      • isOpen

        public boolean isOpen()
      • isSqlResultPending

        public boolean isSqlResultPending()
      • setMaxAllowedPacket

        public void setMaxAllowedPacket​(int maxAllowedPacket)
      • send

        public void send​(Message message,
                         int packetLen)
        指定者:
        send 在接口中 Protocol<XMessage>
        参数:
        message - Message instance
        packetLen - length of header + payload
      • readMessage

        public XMessage readMessage​(XMessage reuse)
        从接口复制的说明: Protocol
        Read one message from the MySQL server into the reusable buffer if provided or into the new one.
        指定者:
        readMessage 在接口中 Protocol<XMessage>
        参数:
        reuse - Message instance to read into, may be null
        返回:
        the message from the server.
      • checkErrorMessage

        public XMessage checkErrorMessage()
        从接口复制的说明: Protocol
        Read one message from the MySQL server, checks for errors in it, and if none, returns the message, ready for reading
        指定者:
        checkErrorMessage 在接口中 Protocol<XMessage>
        返回:
        a message ready for reading.
      • sendCommand

        public XMessage sendCommand​(Message queryPacket,
                                    boolean skipCheck,
                                    int timeoutMillis)
        从接口复制的说明: Protocol
        Send a command to the MySQL server.
        指定者:
        sendCommand 在接口中 Protocol<XMessage>
        参数:
        queryPacket - a packet pre-loaded with data for the protocol (eg. from a client-side prepared statement). The first byte of this packet is the MySQL protocol 'command' from MysqlDefs
        skipCheck - do not call checkErrorPacket() if true
        timeoutMillis - timeout
        返回:
        the response packet from the server
      • read

        public <T extends ProtocolEntity> T read​(Class<Resultset> requiredClass,
                                                 int maxRows,
                                                 boolean streamResults,
                                                 XMessage resultPacket,
                                                 boolean isBinaryEncoded,
                                                 ColumnDefinition metadata,
                                                 ProtocolEntityFactory<T,​XMessage> protocolEntityFactory)
                                          throws IOException
        从接口复制的说明: Protocol
        Read protocol entity.
        指定者:
        read 在接口中 Protocol<XMessage>
        类型参数:
        T - object extending the ProtocolEntity
        参数:
        requiredClass - required Resultset class
        maxRows - the maximum number of rows to read (-1 means all rows)
        streamResults - should the driver leave the results on the wire, and read them only when needed?
        resultPacket - the first packet of information in the result set
        isBinaryEncoded - true if the binary protocol is used (for server prepared statements)
        metadata - use this metadata instead of the one provided on wire
        protocolEntityFactory - ProtocolEntityFactory instance
        返回:
        ProtocolEntity instance
        抛出:
        IOException - if an error occurs
      • setLocalInfileInputStream

        public void setLocalInfileInputStream​(InputStream stream)
        从接口复制的说明: Protocol
        Sets an InputStream instance that will be used to send data to the MySQL server for a "LOAD DATA LOCAL INFILE" statement rather than a FileInputStream or URLInputStream that represents the path given as an argument to the statement. This stream will be read to completion upon execution of a "LOAD DATA LOCAL INFILE" statement, and will automatically be closed by the driver, so it needs to be reset before each call to execute*() that would cause the MySQL server to request data to fulfill the request for "LOAD DATA LOCAL INFILE". If this value is set to NULL, the driver will revert to using a FileInputStream or URLInputStream as required.
        指定者:
        setLocalInfileInputStream 在接口中 Protocol<XMessage>
        参数:
        stream - input stream
      • getLocalInfileInputStream

        public InputStream getLocalInfileInputStream()
        从接口复制的说明: Protocol
        Returns the InputStream instance that will be used to send data in response to a "LOAD DATA LOCAL INFILE" statement. This method returns NULL if no such stream has been set via setLocalInfileInputStream().
        指定者:
        getLocalInfileInputStream 在接口中 Protocol<XMessage>
        返回:
        input stream
      • getQueryComment

        public String getQueryComment()
        从接口复制的说明: Protocol
        Returns the comment that will be prepended to all statements sent to the server.
        指定者:
        getQueryComment 在接口中 Protocol<XMessage>
        返回:
        query comment string
      • setQueryComment

        public void setQueryComment​(String comment)
        从接口复制的说明: Protocol
        Sets the comment that will be prepended to all statements sent to the server. Do not use slash-star or star-slash tokens in the comment as these will be added by the driver itself.
        指定者:
        setQueryComment 在接口中 Protocol<XMessage>
        参数:
        comment - query comment string