diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index 0e07ca5182b..53d019a4664 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -79,67 +79,6 @@ dtype_get_at_most_n_mbchars( return(data_len); } -/*********************************************************************//** -Checks if a data main type is a string type. Also a BLOB is considered a -string type. -@return TRUE if string type */ -ibool -dtype_is_string_type( -/*=================*/ - ulint mtype) /*!< in: InnoDB main data type code: DATA_CHAR, ... */ -{ - if (mtype <= DATA_BLOB - || mtype == DATA_MYSQL - || mtype == DATA_VARMYSQL) { - - return(TRUE); - } - - return(FALSE); -} - -/*********************************************************************//** -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. -@return TRUE if binary string type */ -ibool -dtype_is_binary_string_type( -/*========================*/ - ulint mtype, /*!< in: main data type */ - ulint prtype) /*!< in: precise type */ -{ - if ((mtype == DATA_FIXBINARY) - || (mtype == DATA_BINARY) - || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) { - - return(TRUE); - } - - return(FALSE); -} - -/*********************************************************************//** -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. -@return TRUE if non-binary string type */ -ibool -dtype_is_non_binary_string_type( -/*============================*/ - ulint mtype, /*!< in: main data type */ - ulint prtype) /*!< in: precise type */ -{ - if (dtype_is_string_type(mtype) == TRUE - && dtype_is_binary_string_type(mtype, prtype) == FALSE) { - - return(TRUE); - } - - return(FALSE); -} - /*********************************************************************//** Validates a data type structure. @return TRUE if ok */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 23d2e310b21..65c105928e3 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -9034,9 +9034,7 @@ innobase_rename_or_enlarge_column_try( const Create_field& cf, bool is_v) { -#ifdef UNIV_DEBUG dict_col_t* col; -#endif /* UNIV_DEBUG */ dict_v_col_t* v_col; DBUG_ENTER("innobase_rename_or_enlarge_column_try"); @@ -9049,13 +9047,9 @@ innobase_rename_or_enlarge_column_try( if (is_v) { v_col = dict_table_get_nth_v_col(user_table, pos); pos = dict_create_v_col_pos(v_col->v_pos, v_col->m_col.ind); -#ifdef UNIV_DEBUG col = &v_col->m_col; -#endif /* UNIV_DEBUG */ } else { -#ifdef UNIV_DEBUG col = dict_table_get_nth_col(user_table, pos); -#endif /* UNIV_DEBUG */ } ulint prtype, mtype, len; diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 3b3ac9d1885..aa63be9b8a1 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -262,35 +262,31 @@ dtype_get_at_most_n_mbchars( ulint data_len, /*!< in: length of str (in bytes) */ const char* str); /*!< in: the string whose prefix length is being determined */ -/*********************************************************************//** -Checks if a data main type is a string type. Also a BLOB is considered a -string type. -@return TRUE if string type */ -ibool -dtype_is_string_type( -/*=================*/ - ulint mtype); /*!< in: InnoDB main data type code: DATA_CHAR, ... */ -/*********************************************************************//** -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. -@return TRUE if binary string type */ -ibool -dtype_is_binary_string_type( -/*========================*/ - ulint mtype, /*!< in: main data type */ - ulint 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. -@return TRUE if non-binary string type */ -ibool -dtype_is_non_binary_string_type( -/*============================*/ - ulint mtype, /*!< in: main data type */ - ulint prtype);/*!< in: precise type */ +/** @return whether main type is a string type */ +inline bool dtype_is_string_type(ulint mtype) +{ + return mtype <= DATA_BLOB + || mtype == DATA_MYSQL || mtype == DATA_VARMYSQL; +} + +/** @return whether a type is a binary string type */ +inline bool dtype_is_binary_string_type(ulint mtype, ulint prtype) +{ + /* Note that for tables created before MySQL 4.0.14, + we do not know if a DATA_BLOB column is a BLOB or a TEXT column. + For those DATA_BLOB columns we return false. */ + + return mtype == DATA_FIXBINARY || mtype == DATA_BINARY + || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE)); +} + +/** @return whether a type is a non-binary string type */ +inline bool dtype_is_non_binary_string_type(ulint mtype, ulint prtype) +{ + return dtype_is_string_type(mtype) + && !dtype_is_binary_string_type(mtype, prtype); +} + /*********************************************************************//** Sets a data type structure. */ UNIV_INLINE