Commit a081a998 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15563: Fix cmake -DPLUGIN_PERFSCHEMA=NO

Commit 22feb179 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.
parent 0f489494
/*****************************************************************************
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 */
......
......@@ -682,6 +682,12 @@ struct dict_col_t{
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 @@ struct dict_col_t{
|| 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 @@ struct dict_col_t{
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment