Resultset

You are viewing an old version of this article. View the current version here.

Resultset

A resultset consists of different packets:

Resultset row can begin with 0xfe byte (when using text protocol with a field length > 0xffffff)

Too ensure that packet beginning with 0xfe correspond to the ending packet (EOF_Packet or OK_Packet with a 0xFE header), packet length must be checked : packet length must be less than 0xffffff length.


ResultSet metadata


Column count packet


Column definition packet


Field types

0MYSQL_TYPE_DECIMAL
1MYSQL_TYPE_TINY
2MYSQL_TYPE_SHORT
3MYSQL_TYPE_LONG,
4MYSQL_TYPE_FLOAT
5MYSQL_TYPE_DOUBLE,
6MYSQL_TYPE_NULL
7MYSQL_TYPE_TIMESTAMP
8MYSQL_TYPE_LONGLONG,
9MYSQL_TYPE_INT24
10MYSQL_TYPE_DATE
11MYSQL_TYPE_TIME
12MYSQL_TYPE_DATETIME
13MYSQL_TYPE_YEAR
14MYSQL_TYPE_NEWDATE
15MYSQL_TYPE_VARCHAR
16MYSQL_TYPE_BIT
17MYSQL_TYPE_TIMESTAMP2
18MYSQL_TYPE_DATETIME2
19MYSQL_TYPE_TIME2
246MYSQL_TYPE_NEWDECIMAL
247MYSQL_TYPE_ENUM
248MYSQL_TYPE_SET
249MYSQL_TYPE_TINY_BLOB
250MYSQL_TYPE_MEDIUM_BLOB
251MYSQL_TYPE_LONG_BLOB
252MYSQL_TYPE_BLOB
253MYSQL_TYPE_VAR_STRING
254MYSQL_TYPE_STRING
255MYSQL_TYPE_GEOMETRY



Field detail flag

The field details flag will permit having an indication, like is this field signed ?

The blob flag is not enough to permit identifying if the field is a binary flag: char binary and varchar binary are not binary (they are handled like strings), but have the binary flag!

1NOT_NULLfield cannot be null
2PRIMARY_KEYfield is a primary key
4UNIQUE_KEYfield is unique
8MULTIPLE_KEYfield is in a multiple key
16BLOBis this field a Blob
32UNSIGNEDis this field unsigned
64DECIMALis this field a decimal
128BINARY_COLLATIONwhether this field has a binary collation
256ENUMField is an enumeration
512AUTO_INCREMENTfield auto-increment
1024TIMESTAMPfield is a timestamp value
2048SETfield is a SET



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.