1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-3536 collation

This commit is contained in:
David Hall
2020-05-19 16:22:44 -05:00
parent 8479a87e46
commit 11ba12f6ea
10 changed files with 53 additions and 126 deletions

View File

@ -22,6 +22,10 @@
*
****************************************************************************/
#include <mariadb.h>
#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost
#include <my_sys.h>
#include <cstdlib>
#include <string>
using namespace std;
@ -53,16 +57,16 @@ inline bool numericLE(result_t op1, result_t op2)
return op1 <= op2;
}
inline bool strGE(const string& op1, const string& op2)
inline bool strGE(uint32_t charsetNumber, const string& op1, const string& op2)
{
//return strcoll(op1.c_str(), op2.c_str()) >= 0;
return utf8::idb_strcoll(op1.c_str(), op2.c_str()) >= 0;
const CHARSET_INFO* cs = get_charset(charsetNumber, MYF(MY_WME));
return cs->strnncoll(op1.c_str(), op1.length(), op2.c_str(), op2.length()) >= 0;
}
inline bool strLE(const string& op1, const string& op2)
inline bool strLE(uint32_t charsetNumber, const string& op1, const string& op2)
{
//return strcoll(op1.c_str(), op2.c_str()) <= 0;
return utf8::idb_strcoll(op1.c_str(), op2.c_str()) <= 0;
const CHARSET_INFO* cs = get_charset(charsetNumber, MYF(MY_WME));
return cs->strnncoll(op1.c_str(), op1.length(), op2.c_str(), op2.length()) <= 0;
}
inline bool getBool(rowgroup::Row& row,
@ -256,16 +260,16 @@ inline bool getBool(rowgroup::Row& row,
if (notBetween)
{
if (!strGE(val, pm[1]->data()->getStrVal(row, isNull)) && !isNull)
if (!strGE(ct.charsetNumber, val, pm[1]->data()->getStrVal(row, isNull)) && !isNull)
return true;
isNull = false;
return (!strLE(val, pm[2]->data()->getStrVal(row, isNull)) && !isNull);
return (!strLE(ct.charsetNumber, val, pm[2]->data()->getStrVal(row, isNull)) && !isNull);
}
return !isNull &&
strGE(val, pm[1]->data()->getStrVal(row, isNull)) &&
strLE(val, pm[2]->data()->getStrVal(row, isNull));
strGE(ct.charsetNumber, val, pm[1]->data()->getStrVal(row, isNull)) &&
strLE(ct.charsetNumber, val, pm[2]->data()->getStrVal(row, isNull));
}
default: