Class OkPacket

  • All Implemented Interfaces:
    Completion, ServerMessage

    public class OkPacket
    extends java.lang.Object
    implements Completion
    Ok packet parser see https://mariadb.com/kb/en/ok_packet/
    • Field Detail

      • BASIC_OK

        private static final OkPacket BASIC_OK
      • logger

        private static final Logger logger
      • affectedRows

        private final long affectedRows
      • lastInsertId

        private final long lastInsertId
      • info

        private final byte[] info
      • CHARACTER_SET_CLIENT

        static final byte[] CHARACTER_SET_CLIENT
      • CHARACTER_SET_RESULTS

        static final byte[] CHARACTER_SET_RESULTS
      • CONNECTION_ID

        static final byte[] CONNECTION_ID
      • THREAD_CONNECTED

        static final byte[] THREAD_CONNECTED
      • AUTO_INCREMENT_INCREMENT

        static final byte[] AUTO_INCREMENT_INCREMENT
      • MAXSCALE

        static final byte[] MAXSCALE
      • REDIRECT_URL

        static final byte[] REDIRECT_URL
      • TX_ISOLATION

        static final byte[] TX_ISOLATION
      • TRANSACTION_ISOLATION

        static final byte[] TRANSACTION_ISOLATION
      • REPEATABLE_READ

        static final byte[] REPEATABLE_READ
      • READ_UNCOMMITTED

        static final byte[] READ_UNCOMMITTED
      • READ_COMMITTED

        static final byte[] READ_COMMITTED
      • SERIALIZABLE

        static final byte[] SERIALIZABLE
    • Constructor Detail

      • OkPacket

        private OkPacket​(long affectedRows,
                         long lastInsertId,
                         byte[] info)
    • Method Detail

      • parse

        public static OkPacket parse​(ReadableByteBuf buf,
                                     Context context)
                              throws java.sql.SQLException
        Parser
        Parameters:
        buf - packet buffer
        context - connection context
        Throws:
        java.sql.SQLException
      • parseWithInfo

        public static OkPacket parseWithInfo​(ReadableByteBuf buf,
                                             Context context)
                                      throws java.sql.SQLException
        Parser, keeping the info field
        Parameters:
        buf - packet buffer
        context - connection context
        Returns:
        Ok_Packet object
        Throws:
        java.sql.SQLException
      • parseSessionState

        private static void parseSessionState​(ReadableByteBuf buf,
                                              Context context)
                                       throws java.sql.SQLException
        Apply the session-state blocks following the info field. Lengths inside the blocks are server-declared: a malformed entry means nothing after it can be trusted, so the rest of the session state is ignored rather than read past its block.
        Parameters:
        buf - packet buffer, positioned after the info field
        context - connection context
        Throws:
        java.sql.SQLException
      • getAffectedRows

        public long getAffectedRows()
        get affected rows
        Returns:
        affected rows
      • getLastInsertId

        public long getLastInsertId()
        Get last auto generated insert id
        Returns:
        last insert id
      • getInfo

        public byte[] getInfo()
        Get ok packet info byte array. That is usually a string value, but for first Ok_Packet, containing fingerprint info.
        Returns:
        info