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.
This commit is contained in:
Marko Mäkelä 2019-02-13 22:06:30 +02:00
parent 0f48949439
commit a081a998a6
2 changed files with 31 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. 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 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
@ -24,7 +24,8 @@ Data types
Created 1/16/1996 Heikki Tuuri 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" */ /** 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] = { const byte reset_trx_id[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN] = {
@ -160,6 +161,22 @@ dtype_validate(
return(TRUE); 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 #ifdef UNIV_DEBUG
/** Print a data type structure. /** Print a data type structure.
@param[in] type data type */ @param[in] type data type */

View File

@ -682,6 +682,12 @@ public:
def_val.data = NULL; 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 /** Determine if the columns have the same format
except for is_nullable() and is_versioned(). except for is_nullable() and is_versioned().
@param[in] other column to compare to @param[in] other column to compare to
@ -694,17 +700,6 @@ public:
|| mbmaxlen != other.mbmaxlen) { || mbmaxlen != other.mbmaxlen) {
return false; 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) if (!((prtype ^ other.prtype)
& ~(DATA_NOT_NULL | DATA_VERSIONED))) { & ~(DATA_NOT_NULL | DATA_VERSIONED))) {
@ -717,14 +712,16 @@ public:
case DATA_MYSQL: case DATA_MYSQL:
case DATA_VARCHAR: case DATA_VARCHAR:
case DATA_VARMYSQL: case DATA_VARMYSQL:
return mtype == DATA_CHAR return (mtype == DATA_CHAR
|| mtype == DATA_MYSQL || mtype == DATA_MYSQL
|| mtype == DATA_VARCHAR || mtype == DATA_VARCHAR
|| mtype == DATA_VARMYSQL; || mtype == DATA_VARMYSQL)
&& same_charset(other);
case DATA_FIXBINARY: case DATA_FIXBINARY:
case DATA_BINARY: case DATA_BINARY:
return mtype == DATA_FIXBINARY return (mtype == DATA_FIXBINARY
|| mtype == DATA_BINARY; || mtype == DATA_BINARY)
&& same_charset(other);
case DATA_INT: case DATA_INT:
return mtype == DATA_INT; return mtype == DATA_INT;
} }