1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

fix(compilation): add explicit comparison operators and explicitly cast a type (#3229)

This commit is contained in:
drrtuy
2024-06-29 07:53:54 +01:00
committed by GitHub
parent c12e59c4d7
commit d089171637
2 changed files with 18 additions and 12 deletions

View File

@ -147,18 +147,23 @@ class Charset
{
}
bool operator==(const Charset& rhs)
bool operator==(const Charset& rhs) const
{
return rhs.getCharset().cs_name.str == getCharset().cs_name.str;
}
bool operator!=(const Charset& rhs) const
{
return !(*this == rhs);
}
std::string convert(const std::string& from, const datatypes::Charset& fromCs) const
{
std::string result;
uint dummy_errors;
result.resize(from.size() * getCharset().mbmaxlen);
size_t resultingSize = my_convert(const_cast<char*>(result.c_str()), result.size(), &getCharset(), from.c_str(),
from.size(), &fromCs.getCharset(), &dummy_errors);
size_t resultingSize = my_convert(const_cast<char*>(result.c_str()), result.size(), &getCharset(),
from.c_str(), from.size(), &fromCs.getCharset(), &dummy_errors);
result.resize(resultingSize);
return result;
}

View File

@ -60,18 +60,19 @@ struct PCREOptions
PCREOptions::PCREOptions(execplan::CalpontSystemCatalog::ColType& ct)
{
datatypes::Charset cs = ct.getCharset();
datatypes::Charset myCharsetBin = my_charset_bin;
// TODO use system variable instead if hardcode default_regex_flags_pcre(_current_thd());
// PCRE2_DOTALL | PCRE2_DUPNAMES | PCRE2_EXTENDED | PCRE2_EXTENDED_MORE | PCRE2_MULTILINE | PCRE2_UNGREEDY;
jpcre2::Uint defaultFlags = 0;
flags = (cs != &my_charset_bin ? (PCRE2_UTF | PCRE2_UCP) : 0) |
flags = (cs != myCharsetBin ? (PCRE2_UTF | PCRE2_UCP) : 0) |
((cs.getCharset().state & (MY_CS_BINSORT | MY_CS_CSSORT)) ? 0 : PCRE2_CASELESS) | defaultFlags;
// Convert text data to utf-8.
dataCharset = cs;
libraryCharset = cs == my_charset_bin ? my_charset_bin : my_charset_utf8mb3_general_ci;
libraryCharset = cs == myCharsetBin ? my_charset_bin : my_charset_utf8mb3_general_ci;
}
struct RegExpParams