MySQLPacket class
Represents a complete MySQL package, containing head (4 bytes) and payload.
The package head consists of:
- 3 bytes for payload size.
- 1 byte for sequenceID. O payload contains the real content of the package.
Constructors
- MySQLPacket.new({required int sequenceID, required MySQLPacketPayload payload, required int payloadLength})
- MySQLPacket.decodeAuthSwitchRequestPacket(Uint8List buffer)
-
Decodes an Auth Switch Request packet MySQLPacketAuthSwitchRequest.
factory
-
MySQLPacket.decodeBinaryResultSetRowPacket(Uint8List buffer, List<
MySQLColumnDefinitionPacket> colDefs) -
Decode a ResultSet line into binary format MySQLBinaryResultSetRowPacket.
factory
- MySQLPacket.decodeColumnCountPacket(Uint8List buffer)
-
Decode a packet containing the column contagem MySQLPacketColumnCount.
factory
- MySQLPacket.decodeColumnDefPacket(Uint8List buffer)
-
Decode a column definition packet MySQLColumnDefinitionPacket.
factory
- MySQLPacket.decodeCommPrepareStmtResponsePacket(Uint8List buffer)
-
Decode response to COM_STMT_PREPARE MySQLPacketStmtPrepareOK or error.
factory
- MySQLPacket.decodeGenericPacket(Uint8List buffer)
-
Decodes a generic packet, which could be OK, EOF, ERROR, etc.
factory
- MySQLPacket.decodeInitialHandshake(Uint8List buffer)
-
Decodes an initial handshake packet MySQLPacketInitialHandshake.
factory
-
MySQLPacket.decodeResultSetRowPacket(Uint8List buffer, List<
MySQLColumnDefinitionPacket> colDefs) -
Decode a ResultSet line into textual format MySQLResultSetRowPacket.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- payload ↔ MySQLPacketPayload
-
Package contents.
getter/setter pair
- payloadLength ↔ int
-
Payload size (excluding the 4 bytes of the head).
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sequenceID ↔ int
-
Sequence ID of the package, used to guarantee the order of two packages.
getter/setter pair
Methods
-
encode(
) → Uint8List - Encode the package (head + payload) in a Uint8List for sending to the server.
-
isEOFPacket(
) → bool - Returns the truth of the payload for an EOF package.
-
isErrorPacket(
) → bool - Returns the truth of the payload for an error packet.
-
isOkPacket(
) → bool - Returns the truth of the payload for a package OK.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decodePacketHeader(
Uint8List buffer) → Tuple2< int, int> - Decode the package head, returning (payloadLength, sequenceID).
-
detectPacketType(
Uint8List buffer) → MySQLGenericPacketType - Detects the generic type of the package based on the first byte of the payload.
-
getPacketLength(
Uint8List buffer) → int - Retorna o tamanho total do pacote (cabeçalho de 4 bytes + payload).