diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-02-13 22:06:30 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-02-13 22:11:40 +0200 |
commit | a081a998a62eb0663b5691d0b5c0607465f15c0f (patch) | |
tree | ca666ed5f064eebb127fe8d30b328493eff4b558 | |
parent | 0f489494395a8cd6aeaf5943fea63a9e4465cabb (diff) | |
download | mariadb-git-a081a998a62eb0663b5691d0b5c0607465f15c0f.tar.gz |
MDEV-15563: Fix cmake -DPLUGIN_PERFSCHEMA=NO
Commit 22feb179ae166500ec91feec6246c8154e33f9a2 broke the build
with performance_schema disabled.
dict_col_t::same_charset(): An auxiliary function to
dict_col_t::same_format(). Determine if two non-binary string
columns have the same character set.
-rw-r--r-- | storage/innobase/data/data0type.cc | 21 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 27 |
2 files changed, 31 insertions, 17 deletions
diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index 84962d097aa..0e07ca5182b 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, 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 @@ -24,7 +24,8 @@ Data types Created 1/16/1996 Heikki Tuuri *******************************************************/ -#include "data0type.h" +#include "dict0mem.h" +#include "my_sys.h" /** The DB_TRX_ID,DB_ROLL_PTR values for "no history is available" */ const byte reset_trx_id[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN] = { @@ -160,6 +161,22 @@ dtype_validate( return(TRUE); } +bool dict_col_t::same_charset(const dict_col_t& other) const +{ + if (dtype_is_non_binary_string_type(mtype, prtype) + && dtype_is_non_binary_string_type(other.mtype, other.prtype)) { + uint csn1 = (uint) dtype_get_charset_coll(prtype); + uint csn2 = (uint) dtype_get_charset_coll(other.prtype); + CHARSET_INFO* cs1 = get_charset(csn1, MYF(MY_WME)); + CHARSET_INFO* cs2 = get_charset(csn2, MYF(MY_WME)); + if (!my_charset_same(cs1, cs2)) { + return false; + } + } + + return true; +} + #ifdef UNIV_DEBUG /** Print a data type structure. @param[in] type data type */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 3314b8e2459..e9ffa660354 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -682,6 +682,12 @@ public: def_val.data = NULL; } +private: + /** Determine if the columns have the same character set + @param[in] other column to compare to + @return whether the columns have the same character set */ + bool same_charset(const dict_col_t& other) const; +public: /** Determine if the columns have the same format except for is_nullable() and is_versioned(). @param[in] other column to compare to @@ -694,17 +700,6 @@ public: || mbmaxlen != other.mbmaxlen) { return false; } - if (dtype_is_non_binary_string_type(mtype, prtype) - && dtype_is_non_binary_string_type(other.mtype, - other.prtype)) { - uint csn1 = (uint) dtype_get_charset_coll(prtype); - uint csn2 = (uint) dtype_get_charset_coll(other.prtype); - CHARSET_INFO* cs1 = get_charset(csn1, MYF(MY_WME)); - CHARSET_INFO* cs2 = get_charset(csn2, MYF(MY_WME)); - if (!my_charset_same(cs1, cs2)) { - return false; - } - } if (!((prtype ^ other.prtype) & ~(DATA_NOT_NULL | DATA_VERSIONED))) { @@ -717,14 +712,16 @@ public: case DATA_MYSQL: case DATA_VARCHAR: case DATA_VARMYSQL: - return mtype == DATA_CHAR + return (mtype == DATA_CHAR || mtype == DATA_MYSQL || mtype == DATA_VARCHAR - || mtype == DATA_VARMYSQL; + || mtype == DATA_VARMYSQL) + && same_charset(other); case DATA_FIXBINARY: case DATA_BINARY: - return mtype == DATA_FIXBINARY - || mtype == DATA_BINARY; + return (mtype == DATA_FIXBINARY + || mtype == DATA_BINARY) + && same_charset(other); case DATA_INT: return mtype == DATA_INT; } |