Resultset row

A resultset row represents a database resultset unit, which is usually generated by executing a statement that queries the database. Using COM_STMT_EXECUTE the resultsetrow will be in binary format, others in text format.

Text resultset row


The byte representation of the string according to client character collation.

Binary resultset row


NULL-Bitmap values

The NULL-Bitmap indicates if a parameter for a column is null (one bit per parameter) beginning with the 3rd bit. NULL-bitmap size is (number_of_columns + 9) / 8.


DECIMAL Binary encoding.

DECIMAL has no fixed size, so will be encoded as string<lenenc>. An DECIMAL(10,2) with a value of -15.5 is stored as

06 45 49 53 46 53 48      . - 1 5 . 5 0 


DOUBLE binary encoding

DOUBLE is the IEEE 754 floating-point value in Little-endian format on 8 bytes.


BIGINT binary encoding

BIGINT is the value in Little-endian format on 8 bytes. Signed is defined by the Column field detail flag.


INTEGER binary encoding

INTEGER is the value in Little-endian format on 4 bytes. Signed is defined by the Column field detail flag.


MEDIUMINT binary encoding

MEDIUMINT is similar to INTEGER binary encoding, even if MEDIUM int is 3-bytes encoded server side. (Last byte will always be 0x00).


FLOAT binary encoding

FLOAT is the IEEE 754 floating-point value in Little-endian format on 4 bytes.


SMALLINT binary encoding

SMALLINT is the value in Little-endian format on 2 bytes. Signed is defined by the Column field detail flag.


YEAR binary encoding

YEAR uses the same format as SMALLINT.


TINYINT binary encoding

TINYINT is the value of 1 byte. Signed is defined by the Column field detail flag.


DATE binary encoding

DATE uses the same format as TIMESTAMP binary encoding, with data length of 4 ( without hour/minute/second part)


TIMESTAMP binary encoding

Data is encoded in 8 bytes without fractional seconds, 12 bytes with fractional seconds.

byte positiondescription
1data length : 4 without hour/minute/second part, 7 without fractional seconds, 11 with fractional seconds
2-3year on 2 bytes little-endian format
4Month ( 1=january)
5days of month
6hour of day (0 if DATE type)
7minutes (0 if DATE type)
8secondes (0 if DATE type)
9-12micro-second on 4 bytes little-endian format (only if data-length is > 7)


DATETIME binary encoding

DATETIME uses the same format as TIMESTAMP binary encoding


TIME binary encoding

Data is encoded in 9 bytes without fractional seconds, 13 bytes with fractional seconds.

byte positiondescription
1data length : 8 without fractional seconds, 12 with fractional seconds
2is negative
3-6date on 4 bytes little-endian format
7hour of day
8minutes
9secondes
10-13micro-second on 4 bytes little-endian format (only if data-length is > 7)


Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.