Resultset

Resultset

A resultset consists of different packets:

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

To ensure that packets beginning with 0xfe correspond to the ending packet (EOF_Packet or OK_Packet with a 0xFE header), the packet length must be checked and must be less than 0xffffff in 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
245MYSQL_TYPE_JSON
for mysql only
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
64ZEROFILL_FLAGis this field a zerofill
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
4096NO_DEFAULT_VALUE_FLAGfield doesn't have default value
8192ON_UPDATE_NOW_FLAGfield is set to NOW on UPDATE
32768NUM_FLAGfield is num



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.