mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip: Add the function dtype_is_utf8().
This commit is contained in:
parent
bde9d122ad
commit
dd7f702117
2 changed files with 35 additions and 0 deletions
|
@ -275,6 +275,16 @@ dtype_form_prtype(
|
|||
DATA_BINARY_TYPE etc. */
|
||||
ulint charset_coll); /* in: MySQL charset-collation code */
|
||||
/*************************************************************************
|
||||
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. */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
dtype_is_utf8(
|
||||
/*==========*/
|
||||
/* out: TRUE if a subset of UTF-8 */
|
||||
ulint prtype);/* in: precise data type */
|
||||
/*************************************************************************
|
||||
Gets the type length. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
|
|
|
@ -34,6 +34,31 @@ dtype_get_charset_coll(
|
|||
return((prtype >> 16) & 0xFFUL);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
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. */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
dtype_is_utf8(
|
||||
/*==========*/
|
||||
/* out: TRUE if a subset of UTF-8 */
|
||||
ulint prtype) /* in: precise data type */
|
||||
{
|
||||
/* These codes have been copied from strings/ctype-extra.c
|
||||
and strings/ctype-utf8.c. */
|
||||
switch (dtype_get_charset_coll(prtype)) {
|
||||
case 11: /* ascii_general_ci */
|
||||
case 65: /* ascii_bin */
|
||||
case 33: /* utf8_general_ci */
|
||||
case 83: /* utf8_bin */
|
||||
case 254: /* utf8_general_cs */
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Gets the MySQL type code from a dtype. */
|
||||
UNIV_INLINE
|
||||
|
|
Loading…
Add table
Reference in a new issue