|
1 | 1 | /*****************************************************************************
|
2 | 2 |
|
3 | 3 | Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
4 |
| -Copyright (c) 2017, 2018, MariaDB Corporation. |
| 4 | +Copyright (c) 2017, 2019, MariaDB Corporation. |
5 | 5 |
|
6 | 6 | This program is free software; you can redistribute it and/or modify it under
|
7 | 7 | the terms of the GNU General Public License as published by the Free Software
|
@@ -262,35 +262,31 @@ dtype_get_at_most_n_mbchars(
|
262 | 262 | ulint data_len, /*!< in: length of str (in bytes) */
|
263 | 263 | const char* str); /*!< in: the string whose prefix
|
264 | 264 | length is being determined */
|
265 |
| -/*********************************************************************//** |
266 |
| -Checks if a data main type is a string type. Also a BLOB is considered a |
267 |
| -string type. |
268 |
| -@return TRUE if string type */ |
269 |
| -ibool |
270 |
| -dtype_is_string_type( |
271 |
| -/*=================*/ |
272 |
| - ulint mtype); /*!< in: InnoDB main data type code: DATA_CHAR, ... */ |
273 |
| -/*********************************************************************//** |
274 |
| -Checks if a type is a binary string type. Note that for tables created with |
275 |
| -< 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. For |
276 |
| -those DATA_BLOB columns this function currently returns FALSE. |
277 |
| -@return TRUE if binary string type */ |
278 |
| -ibool |
279 |
| -dtype_is_binary_string_type( |
280 |
| -/*========================*/ |
281 |
| - ulint mtype, /*!< in: main data type */ |
282 |
| - ulint prtype);/*!< in: precise type */ |
283 |
| -/*********************************************************************//** |
284 |
| -Checks if a type is a non-binary string type. That is, dtype_is_string_type is |
285 |
| -TRUE and dtype_is_binary_string_type is FALSE. Note that for tables created |
286 |
| -with < 4.0.14, we do not know if a DATA_BLOB column is a BLOB or a TEXT column. |
287 |
| -For those DATA_BLOB columns this function currently returns TRUE. |
288 |
| -@return TRUE if non-binary string type */ |
289 |
| -ibool |
290 |
| -dtype_is_non_binary_string_type( |
291 |
| -/*============================*/ |
292 |
| - ulint mtype, /*!< in: main data type */ |
293 |
| - ulint prtype);/*!< in: precise type */ |
| 265 | +/** @return whether main type is a string type */ |
| 266 | +inline bool dtype_is_string_type(ulint mtype) |
| 267 | +{ |
| 268 | + return mtype <= DATA_BLOB |
| 269 | + || mtype == DATA_MYSQL || mtype == DATA_VARMYSQL; |
| 270 | +} |
| 271 | + |
| 272 | +/** @return whether a type is a binary string type */ |
| 273 | +inline bool dtype_is_binary_string_type(ulint mtype, ulint prtype) |
| 274 | +{ |
| 275 | + /* Note that for tables created before MySQL 4.0.14, |
| 276 | + we do not know if a DATA_BLOB column is a BLOB or a TEXT column. |
| 277 | + For those DATA_BLOB columns we return false. */ |
| 278 | + |
| 279 | + return mtype == DATA_FIXBINARY || mtype == DATA_BINARY |
| 280 | + || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE)); |
| 281 | +} |
| 282 | + |
| 283 | +/** @return whether a type is a non-binary string type */ |
| 284 | +inline bool dtype_is_non_binary_string_type(ulint mtype, ulint prtype) |
| 285 | +{ |
| 286 | + return dtype_is_string_type(mtype) |
| 287 | + && !dtype_is_binary_string_type(mtype, prtype); |
| 288 | +} |
| 289 | + |
294 | 290 | /*********************************************************************//**
|
295 | 291 | Sets a data type structure. */
|
296 | 292 | UNIV_INLINE
|
|
0 commit comments