MySQL 9.1.0
Source Code Documentation
|
Data types. More...
Go to the source code of this file.
Classes | |
struct | dtype_t |
Macros | |
#define | DATA_BIG_COL(col) DATA_BIG_LEN_MTYPE((col)->len, (col)->mtype) |
Enumerations | |
enum | ib_like_t { IB_LIKE_EXACT , IB_LIKE_PREFIX } |
SQL Like operator comparison types. More... | |
Functions | |
ulint | DATA_MBMINMAXLEN (ulint mbminlen, ulint mbmaxlen) |
ulint | DATA_MBMINLEN (ulint mbminmaxlen) |
ulint | DATA_MBMAXLEN (ulint mbminmaxlen) |
bool | DATA_POINT_MTYPE (ulint mtype) |
bool | DATA_GEOMETRY_MTYPE (ulint mtype) |
bool | DATA_LARGE_MTYPE (ulint mtype) |
bool | DATA_BIG_LEN_MTYPE (ulint len, ulint mtype) |
static ulint | dtype_get_mysql_type (const dtype_t *type) |
Gets the MySQL type code from a dtype. More... | |
ulint | dtype_get_at_most_n_mbchars (ulint prtype, ulint mbminmaxlen, ulint prefix_len, ulint data_len, const char *str) |
Determine how many bytes the first n characters of the given string occupy. More... | |
bool | dtype_is_string_type (ulint mtype) |
Checks if a data main type is a string type. More... | |
bool | dtype_is_binary_string_type (ulint mtype, ulint prtype) |
Checks if a type is a binary string type. More... | |
bool | dtype_is_non_binary_string_type (ulint mtype, ulint prtype) |
Checks if a type is a non-binary string type. More... | |
static void | dtype_set (dtype_t *type, ulint mtype, ulint prtype, ulint len) |
Sets a data type structure. More... | |
static void | dtype_copy (dtype_t *type1, const dtype_t *type2) |
Copies a data type structure. More... | |
static ulint | dtype_get_mtype (const dtype_t *type) |
Gets the SQL main data type. More... | |
static ulint | dtype_get_prtype (const dtype_t *type) |
Gets the precise data type. More... | |
static void | dtype_get_mblen (ulint mtype, ulint prtype, ulint *mbminlen, ulint *mbmaxlen) |
Compute the mbminlen and mbmaxlen members of a data type structure. More... | |
static ulint | dtype_get_charset_coll (ulint prtype) |
Gets the MySQL charset-collation code for MySQL string types. More... | |
ulint | dtype_form_prtype (ulint old_prtype, ulint charset_coll) |
Forms a precise type from the < 4.1.2 format precise type plus the charset-collation code. More... | |
static bool | dtype_is_utf8 (ulint prtype) |
Determines if a MySQL string type is a subset of UTF-8. More... | |
static ulint | dtype_get_len (const dtype_t *type) |
Gets the type length. More... | |
static ulint | dtype_get_mbminlen (const dtype_t *type) |
Gets the minimum length of a character, in bytes. More... | |
static ulint | dtype_get_mbmaxlen (const dtype_t *type) |
Gets the maximum length of a character, in bytes. More... | |
static void | dtype_set_mbminmaxlen (dtype_t *type, ulint mbminlen, ulint mbmaxlen) |
Sets the minimum and maximum length of a character, in bytes. More... | |
static ulint | dtype_get_fixed_size_low (ulint mtype, ulint prtype, ulint len, ulint mbminmaxlen, bool comp) |
Returns the size of a fixed size data type, 0 if not a fixed size type. More... | |
static ulint | dtype_get_min_size_low (ulint mtype, ulint prtype, ulint len, ulint mbminmaxlen) |
Returns the minimum size of a data type. More... | |
static ulint | dtype_get_max_size_low (ulint mtype, ulint len) |
Returns the maximum size of a data type. More... | |
static ulint | dtype_get_sql_null_size (const dtype_t *type, bool comp) |
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type. More... | |
static void | dtype_read_for_order_and_null_size (dtype_t *type, const byte *buf) |
Reads to a type the stored information which determines its alphabetical ordering and the storage size of an SQL NULL value. More... | |
static void | dtype_new_store_for_order_and_null_size (byte *buf, const dtype_t *type, ulint prefix_len) |
Stores for a type the information which determines its alphabetical ordering and the storage size of an SQL NULL value. More... | |
static void | dtype_new_read_for_order_and_null_size (dtype_t *type, const byte *buf) |
Reads to a type the stored information which determines its alphabetical ordering and the storage size of an SQL NULL value. More... | |
static char * | dtype_sql_name (unsigned mtype, unsigned prtype, unsigned len, char *name, unsigned name_sz) |
Returns the type's SQL name (e.g. More... | |
bool | dtype_validate (const dtype_t *type) |
Validates a data type structure. More... | |
void | dtype_print (const dtype_t *type) |
Print a data type structure. More... | |
std::ostream & | operator<< (std::ostream &out, const dtype_t &obj) |
Variables | |
ulint | data_mysql_default_charset_coll |
constexpr uint32_t | DATA_MYSQL_BINARY_CHARSET_COLL = 63 |
constexpr uint32_t | DATA_MISSING = 0 |
missing column More... | |
constexpr uint32_t | DATA_VARCHAR = 1 |
character varying of the latin1_swedish_ci charset-collation; note that the MySQL format for this, DATA_BINARY, DATA_VARMYSQL, is also affected by whether the 'precise type' contains DATA_MYSQL_TRUE_VARCHAR More... | |
constexpr uint32_t | DATA_CHAR = 2 |
fixed length character of the latin1_swedish_ci charset-collation More... | |
constexpr uint32_t | DATA_FIXBINARY = 3 |
binary string of fixed length More... | |
constexpr uint32_t | DATA_BINARY = 4 |
binary string More... | |
constexpr uint32_t | DATA_BLOB = 5 |
binary large object, or a TEXT type; if prtype & DATA_BINARY_TYPE == 0, then this is actually a TEXT column (or a BLOB created with < 4.0.14; since column prefix indexes came only in 4.0.14, the missing flag in BLOBs created before that does not cause any harm) More... | |
constexpr uint32_t | DATA_INT = 6 |
integer: can be any size 1 - 8 bytes More... | |
constexpr uint32_t | DATA_SYS_CHILD = 7 |
address of the child page in node pointer More... | |
constexpr uint32_t | DATA_SYS = 8 |
system column More... | |
constexpr uint32_t | DATA_FLOAT = 9 |
constexpr uint32_t | DATA_DOUBLE = 10 |
constexpr uint32_t | DATA_DECIMAL = 11 |
decimal number stored as an ASCII string More... | |
constexpr uint32_t | DATA_VARMYSQL = 12 |
any charset varying length char More... | |
constexpr uint32_t | DATA_MYSQL = 13 |
any charset fixed length char NOTE that 4.1.1 used DATA_MYSQL and DATA_VARMYSQL for all character sets, and the charset-collation for tables created with it can also be latin1_swedish_ci More... | |
constexpr uint32_t | DATA_GEOMETRY = 14 |
constexpr uint32_t | DATA_POINT = 15 |
geometry datatype of fixed length POINT More... | |
constexpr uint32_t | DATA_VAR_POINT = 16 |
geometry datatype of variable length POINT, used when we want to store POINT as BLOB internally More... | |
constexpr uint32_t | DATA_MTYPE_MAX = 63 |
dtype_store_for_order_and_null_size() requires the values are <= 63 More... | |
constexpr uint32_t | DATA_MTYPE_CURRENT_MIN = DATA_VARCHAR |
minimum value of mtype More... | |
constexpr uint32_t | DATA_MTYPE_CURRENT_MAX = DATA_VAR_POINT |
maximum value of mtype More... | |
constexpr uint32_t | DATA_ENGLISH = 4 |
English language character string: this is a relic from pre-MySQL time and only used for InnoDB's own system tables. More... | |
constexpr uint32_t | DATA_ERROR = 111 |
another relic from pre-MySQL time More... | |
constexpr uint32_t | DATA_MYSQL_TYPE_MASK = 255 |
AND with this mask to extract the MySQL type from the precise type. More... | |
constexpr uint32_t | DATA_MYSQL_TRUE_VARCHAR = 15 |
MySQL type code for the >= 5.0.3 format true VARCHAR. More... | |
constexpr uint32_t | DATA_ROW_ID = 0 |
row id: a 48-bit integer More... | |
constexpr uint32_t | DATA_ROW_ID_LEN = 6 |
stored length for row id More... | |
constexpr size_t | DATA_TRX_ID = 1 |
Transaction id: 6 bytes. More... | |
constexpr size_t | DATA_TRX_ID_LEN = 6 |
Transaction ID type size in bytes. More... | |
constexpr size_t | DATA_ROLL_PTR = 2 |
Rollback data pointer: 7 bytes. More... | |
constexpr size_t | DATA_ROLL_PTR_LEN = 7 |
Rollback data pointer type size in bytes. More... | |
constexpr uint32_t | DATA_N_SYS_COLS = 3 |
number of system columns defined above More... | |
constexpr uint32_t | DATA_ITT_N_SYS_COLS = 2 |
number of system columns for intrinsic temporary table More... | |
constexpr uint32_t | DATA_FTS_DOC_ID = 3 |
Used as FTS DOC ID column. More... | |
constexpr uint32_t | DATA_SYS_PRTYPE_MASK = 0xF |
mask to extract the above from prtype More... | |
constexpr uint32_t | DATA_NOT_NULL = 256 |
this is ORed to the precise type when the column is declared as NOT NULL More... | |
constexpr uint32_t | DATA_UNSIGNED = 512 |
constexpr uint32_t | DATA_BINARY_TYPE = 1024 |
if the data type is a binary character string, this is ORed to the precise type: this only holds for tables created with >= MySQL-4.0.14 More... | |
constexpr uint32_t | DATA_GIS_MBR = 2048 |
Used as GIS MBR column. More... | |
constexpr uint32_t | DATA_MBR_LEN = SPDIMS * 2 * sizeof(double) |
GIS MBR length. More... | |
constexpr uint32_t | DATA_LONG_TRUE_VARCHAR = 4096 |
this is ORed to the precise data type when the column is true VARCHAR where MySQL uses 2 bytes to store the data len; for shorter VARCHARs MySQL uses only 1 byte More... | |
constexpr uint32_t | DATA_VIRTUAL = 8192 |
Virtual column. More... | |
constexpr uint32_t | DATA_MULTI_VALUE = 16384 |
Multi-value Virtual column. More... | |
constexpr uint32_t | DATA_ORDER_NULL_TYPE_BUF_SIZE = 4 |
constexpr uint32_t | DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE = 6 |
constexpr uint32_t | DATA_MBMAX = 5 |
constexpr uint32_t | DATA_POINT_LEN = 25 |
constexpr uint32_t | MAX_CHAR_COLL_NUM = 32767 |
constexpr uint32_t | CHAR_COLL_MASK = MAX_CHAR_COLL_NUM |
Data types.
Created 1/16/1996 Heikki Tuuri
#define DATA_BIG_COL | ( | col | ) | DATA_BIG_LEN_MTYPE((col)->len, (col)->mtype) |
enum ib_like_t |
|
inline |
|
inline |
|
inline |
Copies a data type structure.
[in] | type1 | type struct to copy to |
[in] | type2 | type struct to copy from |
Forms a precise type from the < 4.1.2 format precise type plus the charset-collation code.
old_prtype | in: the MySQL type code and the flags DATA_BINARY_TYPE etc. |
charset_coll | in: MySQL charset-collation code |
ulint dtype_get_at_most_n_mbchars | ( | ulint | prtype, |
ulint | mbminmaxlen, | ||
ulint | prefix_len, | ||
ulint | data_len, | ||
const char * | str | ||
) |
Determine how many bytes the first n characters of the given string occupy.
If the string is shorter than n characters, returns the number of bytes the characters in the string occupy.
If the string is shorter than n characters, returns the number of bytes the characters in the string occupy.
prtype | in: precise type |
mbminmaxlen | in: minimum and maximum length of a multi-byte character |
prefix_len | in: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype) |
data_len | in: length of str (in bytes) |
str | in: the string whose prefix length is being determined |
Gets the MySQL charset-collation code for MySQL string types.
|
inlinestatic |
Returns the size of a fixed size data type, 0 if not a fixed size type.
[in] | mtype | main type |
[in] | prtype | precise type |
[in] | len | length |
[in] | mbminmaxlen | minimum and maximum length of a multibyte character, in bytes |
[in] | comp | nonzero=ROW_FORMAT=COMPACT |
Gets the type length.
Returns the maximum size of a data type.
Note: types in system tables may be incomplete and return incorrect information.
[in] | mtype | main type |
[in] | len | length |
|
inlinestatic |
Compute the mbminlen and mbmaxlen members of a data type structure.
[in] | mtype | main type |
[in] | prtype | precise type (and collation) |
[out] | mbminlen | minimum length of a multi-byte character |
[out] | mbmaxlen | maximum length of a multi-byte character |
Gets the maximum length of a character, in bytes.
Gets the minimum length of a character, in bytes.
|
inlinestatic |
Returns the minimum size of a data type.
[in] | mtype | main type |
[in] | prtype | precise type |
[in] | len | length |
[in] | mbminmaxlen | minimum and maximum length of a multibyte character, in bytes |
Gets the SQL main data type.
Gets the MySQL type code from a dtype.
Gets the precise data type.
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a type.
For fixed length types it is the fixed length of the type, otherwise 0.
[in] | type | type struct |
[in] | comp | nonzero=ROW_FORMAT=COMPACT |
Checks if a type is a binary string type.
Note that for tables created with < 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. For those DATA_BLOB columns this function currently returns false.
Note that for tables created with < 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. For those DATA_BLOB columns this function currently returns false.
mtype | in: main data type |
prtype | in: precise type |
Checks if a type is a non-binary string type.
That is, dtype_is_string_type is true and dtype_is_binary_string_type is false. Note that for tables created with < 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. For those DATA_BLOB columns this function currently returns true.
That is, dtype_is_string_type is true and dtype_is_binary_string_type is false. Note that for tables created with < 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. For those DATA_BLOB columns this function currently returns true.
mtype | in: main data type |
prtype | in: precise type |
bool dtype_is_string_type | ( | ulint | mtype | ) |
Checks if a data main type is a string type.
Also a BLOB is considered a string type.
Also a BLOB is considered a string type.
mtype | in: InnoDB main data type code: DATA_CHAR, ... |
|
inlinestatic |
Determines if a MySQL string type is a subset of UTF-8.
This function may return false negatives, in case further character-set collation codes are introduced in MySQL later.
|
inlinestatic |
Reads to a type the stored information which determines its alphabetical ordering and the storage size of an SQL NULL value.
This is the 4.1.x storage format.
[in] | type | type struct |
[in] | buf | buffer for stored type order info |
|
inlinestatic |
Stores for a type the information which determines its alphabetical ordering and the storage size of an SQL NULL value.
This is the >= 4.1.x storage format.
[in] | buf | buffer for DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE bytes where we store the info |
[in] | type | type struct |
[in] | prefix_len | prefix length to replace type->len, or 0 |
void dtype_print | ( | const dtype_t * | type | ) |
Print a data type structure.
[in] | type | data type |
Reads to a type the stored information which determines its alphabetical ordering and the storage size of an SQL NULL value.
[in] | type | type struct |
[in] | buf | buffer for the stored order info |
Sets a data type structure.
[in] | type | type struct to init |
[in] | mtype | main data type |
[in] | prtype | precise type |
[in] | len | precision of type |
Sets the minimum and maximum length of a character, in bytes.
[in,out] | type | type |
[in] | mbminlen | minimum length of a char, in bytes, or 0 if this is not a character type |
[in] | mbmaxlen | maximum length of a char, in bytes, or 0 if this is not a character type |
|
inlinestatic |
Returns the type's SQL name (e.g.
BIGINT UNSIGNED) from mtype,prtype,len
[in] | mtype | main type |
[in] | prtype | precise type |
[in] | len | length |
[out] | name | SQL name |
[in] | name_sz | size of the name buffer |
bool dtype_validate | ( | const dtype_t * | type | ) |
Validates a data type structure.
type | in: type struct to validate |
|
inline |
|
constexpr |
|
constexpr |
binary string
|
constexpr |
if the data type is a binary character string, this is ORed to the precise type: this only holds for tables created with >= MySQL-4.0.14
|
constexpr |
binary large object, or a TEXT type; if prtype & DATA_BINARY_TYPE == 0, then this is actually a TEXT column (or a BLOB created with < 4.0.14; since column prefix indexes came only in 4.0.14, the missing flag in BLOBs created before that does not cause any harm)
|
constexpr |
fixed length character of the latin1_swedish_ci charset-collation
|
constexpr |
decimal number stored as an ASCII string
|
constexpr |
|
constexpr |
English language character string: this is a relic from pre-MySQL time and only used for InnoDB's own system tables.
|
constexpr |
another relic from pre-MySQL time
|
constexpr |
binary string of fixed length
|
constexpr |
|
constexpr |
Used as FTS DOC ID column.
|
constexpr |
|
constexpr |
Used as GIS MBR column.
|
constexpr |
integer: can be any size 1 - 8 bytes
|
constexpr |
number of system columns for intrinsic temporary table
|
constexpr |
this is ORed to the precise data type when the column is true VARCHAR where MySQL uses 2 bytes to store the data len; for shorter VARCHARs MySQL uses only 1 byte
|
constexpr |
|
constexpr |
GIS MBR length.
|
constexpr |
missing column
|
constexpr |
maximum value of mtype
|
constexpr |
minimum value of mtype
|
constexpr |
dtype_store_for_order_and_null_size() requires the values are <= 63
|
constexpr |
Multi-value Virtual column.
|
constexpr |
any charset fixed length char NOTE that 4.1.1 used DATA_MYSQL and DATA_VARMYSQL for all character sets, and the charset-collation for tables created with it can also be latin1_swedish_ci
|
constexpr |
|
extern |
|
constexpr |
MySQL type code for the >= 5.0.3 format true VARCHAR.
|
constexpr |
AND with this mask to extract the MySQL type from the precise type.
|
constexpr |
number of system columns defined above
|
constexpr |
|
constexpr |
this is ORed to the precise type when the column is declared as NOT NULL
|
constexpr |
|
constexpr |
geometry datatype of fixed length POINT
|
constexpr |
|
constexpr |
Rollback data pointer: 7 bytes.
|
constexpr |
Rollback data pointer type size in bytes.
|
constexpr |
row id: a 48-bit integer
|
constexpr |
stored length for row id
|
constexpr |
system column
|
constexpr |
address of the child page in node pointer
|
constexpr |
mask to extract the above from prtype
|
constexpr |
Transaction id: 6 bytes.
|
constexpr |
Transaction ID type size in bytes.
|
constexpr |
|
constexpr |
geometry datatype of variable length POINT, used when we want to store POINT as BLOB internally
|
constexpr |
character varying of the latin1_swedish_ci charset-collation; note that the MySQL format for this, DATA_BINARY, DATA_VARMYSQL, is also affected by whether the 'precise type' contains DATA_MYSQL_TRUE_VARCHAR
|
constexpr |
any charset varying length char
|
constexpr |
Virtual column.
|
constexpr |