You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-696 REVERSE reversing too much
This commit is contained in:
@ -49,13 +49,6 @@ void reverse( char *start, char *end )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *reverse_char( char *start )
|
|
||||||
{
|
|
||||||
char *end = start;
|
|
||||||
while( (end[1] & 0xC0) == 0x80 ) end++;
|
|
||||||
reverse( start, end );
|
|
||||||
return( end+1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace funcexp
|
namespace funcexp
|
||||||
@ -74,11 +67,20 @@ std::string Func_reverse::getStrVal(rowgroup::Row& row,
|
|||||||
{
|
{
|
||||||
string str = stringValue(fp[0], row, isNull);
|
string str = stringValue(fp[0], row, isNull);
|
||||||
|
|
||||||
char *end = (char*) str.c_str();
|
// We used to reverse in the string buffer, but that doesn't
|
||||||
while( *end ) end = reverse_char( end );
|
// work for all compilers as some re-use the buffer on simple
|
||||||
reverse( (char*) str.c_str(), end-1 );
|
// string assignment and implement a ref-count. Reversing in the
|
||||||
|
// string buffer has the affect of reversing all strings from
|
||||||
return str;
|
// which this one derived.
|
||||||
|
int len = str.length();
|
||||||
|
char* pbuf = new char[len+1];
|
||||||
|
strncpy(pbuf, str.c_str(), len);
|
||||||
|
pbuf[len] = 0;
|
||||||
|
char *end = pbuf+len-1;
|
||||||
|
reverse(pbuf, end);
|
||||||
|
string rstr = pbuf;
|
||||||
|
delete [] pbuf;
|
||||||
|
return rstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user