MDEV-15564: Fix bool/ibool type mismatch
dtype_is_string_type(), dtype_is_binary_string_type(), dtype_is_non_binary_string_type(): Define as inline functions that return bool, not ibool.
This commit is contained in:
parent
10c05d4ae9
commit
e17fc72940
@ -79,67 +79,6 @@ dtype_get_at_most_n_mbchars(
|
|||||||
return(data_len);
|
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.
|
Validates a data type structure.
|
||||||
@return TRUE if ok */
|
@return TRUE if ok */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
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
|
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
|
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) */
|
ulint data_len, /*!< in: length of str (in bytes) */
|
||||||
const char* str); /*!< in: the string whose prefix
|
const char* str); /*!< in: the string whose prefix
|
||||||
length is being determined */
|
length is being determined */
|
||||||
/*********************************************************************//**
|
/** @return whether main type is a string type */
|
||||||
Checks if a data main type is a string type. Also a BLOB is considered a
|
inline bool dtype_is_string_type(ulint mtype)
|
||||||
string type.
|
{
|
||||||
@return TRUE if string type */
|
return mtype <= DATA_BLOB
|
||||||
ibool
|
|| mtype == DATA_MYSQL || mtype == DATA_VARMYSQL;
|
||||||
dtype_is_string_type(
|
}
|
||||||
/*=================*/
|
|
||||||
ulint mtype); /*!< in: InnoDB main data type code: DATA_CHAR, ... */
|
/** @return whether a type is a binary string type */
|
||||||
/*********************************************************************//**
|
inline 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
|
/* Note that for tables created before MySQL 4.0.14,
|
||||||
those DATA_BLOB columns this function currently returns FALSE.
|
we do not know if a DATA_BLOB column is a BLOB or a TEXT column.
|
||||||
@return TRUE if binary string type */
|
For those DATA_BLOB columns we return false. */
|
||||||
ibool
|
|
||||||
dtype_is_binary_string_type(
|
return mtype == DATA_FIXBINARY || mtype == DATA_BINARY
|
||||||
/*========================*/
|
|| (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE));
|
||||||
ulint mtype, /*!< in: main data type */
|
}
|
||||||
ulint prtype);/*!< in: precise type */
|
|
||||||
/*********************************************************************//**
|
/** @return whether a type is a non-binary string type */
|
||||||
Checks if a type is a non-binary string type. That is, dtype_is_string_type is
|
inline bool dtype_is_non_binary_string_type(ulint mtype, ulint prtype)
|
||||||
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.
|
return dtype_is_string_type(mtype)
|
||||||
For those DATA_BLOB columns this function currently returns TRUE.
|
&& !dtype_is_binary_string_type(mtype, prtype);
|
||||||
@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 */
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
Sets a data type structure. */
|
Sets a data type structure. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user