提交 d2553f5a 编写于 作者: S shenglian zhou

[TD-6634]<hotfix>:use original string and remove begin/end quote instead of...

[TD-6634]<hotfix>:use original string and remove begin/end quote instead of string value after stringRmQuote
上级 7f8008a1
......@@ -4539,13 +4539,24 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
regex_t regex;
char regErrBuf[256] = {0};
const char* pattern = pRight->value.pz;
//remove the quote at the begin end of original sql string.
uint32_t lenPattern = pRight->exprToken.n - 2;
char* pattern = malloc(lenPattern + 1);
strncpy(pattern, pRight->exprToken.z+1, lenPattern);
pattern[lenPattern] = '\0';
tfree(pRight->value.pz);
pRight->value.pz = strndup(pattern, lenPattern);
pRight->value.nLen = lenPattern;
int cflags = REG_EXTENDED;
if ((errCode = regcomp(&regex, pattern, cflags)) != 0) {
regerror(errCode, &regex, regErrBuf, sizeof(regErrBuf));
tscError("Failed to compile regex pattern %s. reason %s", pattern, regErrBuf);
free(pattern);
return invalidOperationMsg(msgBuf, msg3);
}
free(pattern);
regfree(&regex);
}
......
......@@ -79,6 +79,23 @@ if $rows != 1 then
return -1
endi
sql select c1b from $st_name where c1b match '\\.\\*'
if $rows != 0 then
return -1
endi
sql select c1b from $st_name where c1b match '\\\\'
if $rows != 0 then
return -1
endi
sql insert into $ct1_name values(now+3s, '\\this is engine')
sql select c1b from $st_name where c1b match '\\'
if $rows != 1 then
return -1
endi
sql_error select c1b from $st_name where c1b match e;
sql_error select c1b from $st_name where c1b nmatch e;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册