Strings are sequences of bytes and appear in a few forms in the protocol.
Protocol::FixedLengthString
Fixed-length strings have a known, hardcoded length.
An example is the sql-state
of the
ERR_Packet
which is always 5 bytes long.
Implemented By
Protocol::NulTerminatedString
Strings that are terminated by a [00] byte.
Implemented By
Protocol::VariableLengthString:
The length of the string is determined by another field or is calculated at runtime
Implemented By
Protocol::LengthEncodedString
A length encoded string is a string that is prefixed with length encoded integer describing the length of the string.
It is a special case of
Protocol::VariableLengthString
Fields
length (int<lenenc>) -- length of the string
string (string<fix>) -- [len=$length] string
Implemented By
Protocol::RestOfPacketString
If a string is the last component of a packet, its length can be calculated from the overall packet length minus the current position.