This page defines the fundamental data types used in the MariaDB client/server protocol, including integers, strings, and binary representations.
Unknown type:
Fixed-length bytes
Length-encoded bytes
Integer type:
String type:
The notation is "byte".
A fixed-length byte stores the value in a series of n bytes.
The notation is "byte".
Length encoded bytes are prefixed by a length-encoded integer which describes the length of the byte value, followed by the bytes value.
The notation is "byte".
Bytes whose length will be calculated by the packet remaining length.
Notation is "int".
A fixed-length integer stores the value in a series of n bytes. The least significant byte is always the first byte (little-endian format).
An int<4> with value 2 is stored as02 00 00 00
The notation is "int".
An integer which depending on its value is represented by n bytes.
The first byte represents the size of the integer:
If the value of first byte is
< 0xFB - Integer value is this 1 byte integer
0xFB - NULL value
0xFC - Integer value is encoded in the next 2 bytes (3 bytes total)
0xFD - Integer value is encoded in the next 3 bytes (4 bytes total)
The notation is "string".
Fixed-length strings have a known hardcoded length.
The notation is "string".
Null-terminated strings have a variable size and are terminated by a 0x00 character
The notation is "string".
Length-encoded strings are prefixed by a length-encoded integer which describes the length of the string, followed by the string value.
An string of 512 "a" is encoded in 515 bytes :
...
The NULL value is encoded using null (0xfb) length.
An empty value is encoded with a 0 (0x00) length.
The notation is "string".
Strings whose length is calculated by the packet remaining length.
For an example, see the packet.
This page is licensed: CC BY-SA / Gnu FDL
0xFE - Integer value is encoded in the next 8 bytes (9 bytes total)
End-of-file length bytes
Fixed-length integers
Length-encoded integers
Fixed-length strings
Null-terminated strings
Length-encoded strings
End-of-file length strings
fc 00 02 97 97 97 97 97 97 97 97 97 97 97 97 97
² .. a a a a a a a a a a a a a