You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
MCOL-3536 Collation
This commit is contained in:
@ -80,7 +80,6 @@ struct IdbSortSpec
|
||||
// TODO There are three ordering specs since 10.2
|
||||
int fAsc; // <ordering specification> ::= ASC | DESC
|
||||
int fNf; // <null ordering> ::= NULLS FIRST | NULLS LAST
|
||||
std::string fLocale;
|
||||
|
||||
IdbSortSpec() : fIndex(-1), fAsc(1), fNf(1) {}
|
||||
IdbSortSpec(int i, bool b) : fIndex(i), fAsc(b ? 1 : -1), fNf(fAsc) {}
|
||||
@ -93,39 +92,7 @@ struct IdbSortSpec
|
||||
class Compare
|
||||
{
|
||||
public:
|
||||
Compare(const IdbSortSpec& spec) : fSpec(spec)
|
||||
{
|
||||
// Save off the current Locale in case something goes wrong.
|
||||
std::string curLocale = setlocale(LC_COLLATE, NULL);
|
||||
if (spec.fLocale.length() > 0)
|
||||
{
|
||||
fLocale = spec.fLocale;
|
||||
}
|
||||
else
|
||||
{
|
||||
fLocale = curLocale;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
std::locale localloc(fLocale.c_str());
|
||||
loc = localloc;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
fLocale = curLocale;
|
||||
std::locale localloc(fLocale.c_str());
|
||||
loc = localloc;
|
||||
}
|
||||
if (fLocale.find("ja_JP") != std::string::npos)
|
||||
{
|
||||
JPcodePoint = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
JPcodePoint = false;
|
||||
}
|
||||
}
|
||||
Compare(const IdbSortSpec& spec) : fSpec(spec) {}
|
||||
virtual ~Compare() {}
|
||||
|
||||
virtual int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer) = 0;
|
||||
@ -137,9 +104,6 @@ public:
|
||||
|
||||
protected:
|
||||
IdbSortSpec fSpec;
|
||||
std::string fLocale;
|
||||
std::locale loc;
|
||||
bool JPcodePoint; // code point ordering (Japanese UTF) flag
|
||||
};
|
||||
|
||||
// Comparators for signed types
|
||||
@ -283,9 +247,11 @@ public:
|
||||
class StringCompare : public Compare
|
||||
{
|
||||
public:
|
||||
StringCompare(const IdbSortSpec& spec) : Compare(spec) {}
|
||||
StringCompare(const IdbSortSpec& spec) : Compare(spec), cs(NULL) {}
|
||||
|
||||
int operator()(IdbCompare*, rowgroup::Row::Pointer, rowgroup::Row::Pointer);
|
||||
|
||||
CHARSET_INFO* cs;
|
||||
};
|
||||
|
||||
// End of comparators for variable sized types
|
||||
@ -324,6 +290,10 @@ public:
|
||||
return fRow2;
|
||||
}
|
||||
|
||||
rowgroup::RowGroup* rowGroup()
|
||||
{
|
||||
return &fRowGroup;
|
||||
}
|
||||
protected:
|
||||
rowgroup::RowGroup fRowGroup;
|
||||
rowgroup::Row fRow1;
|
||||
|
Reference in New Issue
Block a user