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-1559 remove the #define POSIX_REGEX and thus the use of regexec. Fix up the code changing #ifdef _MSC_VER to #ifdef POSIX_REGEX, where it applies to regexec.
This commit is contained in:
@ -128,31 +128,31 @@ inline bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, Retu
|
||||
// considers these nulls significant, but they're not in the pattern, so we need to strip
|
||||
// them off...
|
||||
const std::string& v = lop->getStrVal(row, isNull);
|
||||
char* c = (char*)alloca(v.length() + 1);
|
||||
memcpy(c, v.c_str(), v.length());
|
||||
c[v.length()] = 0;
|
||||
std::string vv(c);
|
||||
// char* c = (char*)alloca(v.length() + 1);
|
||||
// memcpy(c, v.c_str(), v.length());
|
||||
// c[v.length()] = 0;
|
||||
// std::string vv(c);
|
||||
|
||||
if (regex)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
bool ret = boost::regex_match(vv, *regex);
|
||||
#ifdef POSIX_REGEX
|
||||
bool ret = regexec(regex.get(), v.c_str(), 0, NULL, 0) == 0;
|
||||
#else
|
||||
bool ret = regexec(regex.get(), vv.c_str(), 0, NULL, 0) == 0;
|
||||
bool ret = boost::regex_match(v.c_str(), *regex);
|
||||
#endif
|
||||
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
boost::regex regex(dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull)));
|
||||
bool ret = boost::regex_match(vv, regex);
|
||||
#else
|
||||
#ifdef POSIX_REGEX
|
||||
regex_t regex;
|
||||
std::string str = dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull));
|
||||
regcomp(®ex, str.c_str(), REG_NOSUB | REG_EXTENDED);
|
||||
bool ret = regexec(®ex, vv.c_str(), 0, NULL, 0) == 0;
|
||||
bool ret = regexec(®ex, v.c_str(), 0, NULL, 0) == 0;
|
||||
regfree(®ex);
|
||||
#else
|
||||
boost::regex regex(dataconvert::DataConvert::constructRegexp(rop->getStrVal(row, isNull)));
|
||||
bool ret = boost::regex_match(v.c_str(), regex);
|
||||
#endif
|
||||
return (((fOp == OP_LIKE) ? ret : !ret) && !isNull);
|
||||
}
|
||||
|
Reference in New Issue
Block a user