MySQL 8.4.2
Source Code Documentation
data0type.cc File Reference

Data types. More...

#include "data0type.h"
#include "rem0rec.h"
#include <sys/types.h>
#include "ha_prototypes.h"

Functions

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...
 
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...
 
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...
 

Variables

ulint data_mysql_default_charset_coll
 

Detailed Description

Data types.

Created 1/16/1996 Heikki Tuuri

Function Documentation

◆ dtype_form_prtype()

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.

Returns
precise type, including the charset-collation code
Parameters
old_prtypein: the MySQL type code and the flags DATA_BINARY_TYPE etc.
charset_collin: MySQL charset-collation code

◆ dtype_get_at_most_n_mbchars()

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.

Returns
length of the prefix, in bytes
Parameters
prtypein: precise type
mbminmaxlenin: minimum and maximum length of a multi-byte character
prefix_lenin: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype)
data_lenin: length of str (in bytes)
strin: the string whose prefix length is being determined

◆ dtype_is_binary_string_type()

bool dtype_is_binary_string_type ( ulint  mtype,
ulint  prtype 
)

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.

Returns
true if binary string type
Parameters
mtypein: main data type
prtypein: precise type

◆ dtype_is_non_binary_string_type()

bool dtype_is_non_binary_string_type ( ulint  mtype,
ulint  prtype 
)

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.

Returns
true if non-binary string type
Parameters
mtypein: main data type
prtypein: precise type

◆ dtype_is_string_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.

Returns
true if string type
Parameters
mtypein: InnoDB main data type code: DATA_CHAR, ...

◆ dtype_print()

void dtype_print ( const dtype_t type)

Print a data type structure.

Parameters
[in]typedata type

◆ dtype_validate()

bool dtype_validate ( const dtype_t type)

Validates a data type structure.

Returns
true if ok
Parameters
typein: type struct to validate

Variable Documentation

◆ data_mysql_default_charset_coll

ulint data_mysql_default_charset_coll