MySQL 8.0.40
Source Code Documentation
|
Meta data of a column. More...
Public Types | |
enum | FieldType { SINT = 1 , UINT = 2 , DOUBLE = 5 , FLOAT = 6 , BYTES = 7 , TIME = 10 , DATETIME = 12 , SET = 15 , ENUM = 16 , BIT = 17 , DECIMAL = 18 } |
Public Attributes | |
required FieldType | type = 1 |
datatype of the field in a row More... | |
optional bytes | name = 2 |
name of the column More... | |
optional bytes | original_name = 3 |
name of the column before an alias was applied More... | |
optional bytes | table = 4 |
name of the table the column originates from More... | |
optional bytes | original_table = 5 |
name of the table the column originates from before an alias was applied More... | |
optional bytes | schema = 6 |
schema the column originates from More... | |
optional bytes | catalog = 7 |
catalog the schema originates from More... | |
optional uint64 | collation = 8 |
optional uint32 | fractional_digits = 9 |
displayed factional decimal digits for floating point and fixed point numbers More... | |
optional uint32 | length = 10 |
maximum count of displayable characters of .type More... | |
optional uint32 | flags = 11 |
.type specific flags More... | |
optional uint32 | content_type = 12 |
a hint about the higher-level encoding of a BYTES field More... | |
ServerMessages::Type | server_message_id = RESULTSET_COLUMN_META_DATA |
Meta data of a column.
bytes
fields in the meta data is externally controlled. See also: https://dev.mysql.com/doc/refman/5.0/en/charset-connection.htmloriginal_{table|name}
fields if they are equal to the plain {table|name}
field.Compact metadata format
can be requested by the client. In that case, only .type
is set and all other fields are empty.Expected data type of Mysqlx::Resultset::Row per SQL Type for non-NULL values:
SQL Type | .type | .length | .frac_dig | .flags | .charset |
---|---|---|---|---|---|
TINY | SINT | x | |||
TINY UNSIGNED | UINT | x | x | ||
SHORT | SINT | x | |||
SHORT UNSIGNED | UINT | x | x | ||
INT24 | SINT | x | |||
INT24 UNSIGNED | UINT | x | x | ||
INT | SINT | x | |||
INT UNSIGNED | UINT | x | x | ||
LONGLONG | SINT | x | |||
LONGLONG UNSIGNED | UINT | x | x | ||
DOUBLE | DOUBLE | x | x | x | |
FLOAT | FLOAT | x | x | x | |
DECIMAL | DECIMAL | x | x | x | |
VARCHAR,CHAR,... | BYTES | x | x | x | |
GEOMETRY | BYTES | ||||
TIME | TIME | x | |||
DATE | DATETIME | x | |||
DATETIME | DATETIME | x | |||
YEAR | UINT | x | x | ||
TIMESTAMP | DATETIME | x | |||
SET | SET | x | |||
ENUM | ENUM | x | |||
NULL | BYTES | ||||
BIT | BIT | x |
.length
Maximum number of displayable decimal digits (including minus sign) of the type.
SQL Type | Maximum Digits per Type |
---|---|
TINY SIGNED | 4 |
SHORT SIGNED | 6 |
INT24 SIGNED | 8 |
INT SIGNED | 11 |
LONGLONG SIGNED | 20 |
M
are in https://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html.value
.flags & 1
(zerofill) .length
Maximum number of displayable decimal digits of the type.
SQL Type | max digits per type |
---|---|
TINY UNSIGNED | 3 |
SHORT UNSIGNED | 5 |
INT24 UNSIGNED | 8 |
INT UNSIGNED | 10 |
LONGLONG UNSIGNED | 20 |
M
are in https://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html.value
.length
BIT
type is 1 - 64.value
.length
.fractional_digits
)..fractional_digits
value
.length
.fractional_digits
)..fractional_digits
value
.length
.flags & 1
(rightpad) .length
, the receiver is supposed to add padding characters to the right end of the string. If the .charset
is "binary", the padding character is 0x00
, otherwise it is a space character as defined by that character set. SQL Type | .length | .charset | .flags |
---|---|---|---|
TINYBLOB | 256 | binary | |
BLOB | 65535 | binary | |
VARCHAR(32) | 32 | utf8 | |
VARBINARY(32) | 32 | utf8_bin | |
BINARY(32) | 32 | binary | rightpad |
CHAR(32) | 32 | utf8 | rightpad |
value
Sequence of bytes with added one extra 0x00
byte at the end. To obtain the original string, the extra 0x00
should be removed. The length of the string can be acquired with protobuf's field length()
method:
length of sequence-of-bytes = length-of-field - 1
TIME
A time value.
value
The following bytes sequence:
negate [ hour [ minutes [ seconds [ useconds ]]]]
useconds - optional variable length encoded unsigned64 value for the microseconds
Example: 0x00 -> +00:00:00.000000
DATETIME
A date or date and time value.
value
A sequence of variants, arranged as follows:
| year | month | day | [ | hour | [ | minutes | [ | seconds | [ | useconds | ]]]]
.flags
Name | Position |
---|---|
is_timestamp | 1 |
DECIMAL
An arbitrary length number. The number is encoded as a single byte indicating the position of the decimal point followed by the Packed BCD encoded number. Packed BCD is used to simplify conversion to and from strings and other native arbitrary precision math data types. See also: packed BCD in https://en.wikipedia.org/wiki/Binary-coded_decimal
.length
Maximum number of displayable decimal digits (excluding the decimal point and sign, but including .fractional_digits
). .fractional_digits
The decimal digits to display out of length.
value
The following bytes sequence:
scale | BCD+ sign [0x00]?
Example: x04 0x12 0x34 0x01 0xd0 -> -12.3401
SET
A list of strings representing a SET of values.
value
A sequence of 0 or more of protobuf's bytes (length prepended octets) or one of the special sequences with a predefined meaning listed below.
Example (length of the bytes array shown in brackets):
[0]
- the NULL value[1] 0x00
- a set containing a blank string ''[1] 0x01
- this would be an invalid value, but is to be treated as the empty set[2] 0x01 0x00
- a set with a single item, which is the '0' character[8] 0x03 F O O 0x03 B A R
- a set with 2 items: FOO,BAR optional bytes Mysqlx::Resultset::ColumnMetaData::catalog = 7 |
catalog the schema originates from
def
all the time optional uint64 Mysqlx::Resultset::ColumnMetaData::collation = 8 |
optional uint32 Mysqlx::Resultset::ColumnMetaData::content_type = 12 |
a hint about the higher-level encoding of a BYTES field
Type | Value | Description |
---|---|---|
BYTES | 0x0001 | GEOMETRY (WKB encoding) |
BYTES | 0x0002 | JSON (text encoding) |
BYTES | 0x0003 | XML (text encoding) |
optional uint32 Mysqlx::Resultset::ColumnMetaData::flags = 11 |
.type
specific flags
Type | Value | Description |
---|---|---|
UINT | 0x0001 | zerofill |
DOUBLE | 0x0001 | unsigned |
FLOAT | 0x0001 | unsigned |
DECIMAL | 0x0001 | unsigned |
BYTES | 0x0001 | rightpad |
Value | Description |
---|---|
0x0010 | NOT_NULL |
0x0020 | PRIMARY_KEY |
0x0040 | UNIQUE_KEY |
0x0080 | MULTIPLE_KEY |
0x0100 | AUTO_INCREMENT |
default: 0
optional uint32 Mysqlx::Resultset::ColumnMetaData::fractional_digits = 9 |
displayed factional decimal digits for floating point and fixed point numbers
optional uint32 Mysqlx::Resultset::ColumnMetaData::length = 10 |
maximum count of displayable characters of .type
optional bytes Mysqlx::Resultset::ColumnMetaData::name = 2 |
name of the column
optional bytes Mysqlx::Resultset::ColumnMetaData::original_name = 3 |
name of the column before an alias was applied
optional bytes Mysqlx::Resultset::ColumnMetaData::original_table = 5 |
name of the table the column originates from before an alias was applied
optional bytes Mysqlx::Resultset::ColumnMetaData::schema = 6 |
schema the column originates from
ServerMessages::Type Mysqlx::Resultset::ColumnMetaData::server_message_id = RESULTSET_COLUMN_META_DATA |
optional bytes Mysqlx::Resultset::ColumnMetaData::table = 4 |
name of the table the column originates from
required FieldType Mysqlx::Resultset::ColumnMetaData::type = 1 |
datatype of the field in a row