Commit 5e57a1ae authored by marko's avatar marko

branches/zip: Add the function dtype_is_utf8().

parent 2eb32d30
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment