提交 06b88467 编写于 作者: X xywang

feat(query): fixed right shift parsing error

上级 0a745291
......@@ -248,6 +248,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
char * cptr = NULL;
char * fname = NULL;
bool printMode = false;
int match;
sptr = command;
while ((sptr = tstrstr(sptr, ">>", true)) != NULL) {
......@@ -259,18 +260,24 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
sptr = tmp;
if (sptr != NULL) {
if (regex_match(sptr + 2, "^\\s*[0-9]+\\s*[\\>|\\<|\\<=|\\>=|=|!=]\\s*.*;\\s*$", REG_EXTENDED | REG_ICASE) == 0) {
cptr = tstrstr(command, ";", true);
if (cptr != NULL) {
*cptr = '\0';
// select ... where col >> n op m ...;
match = regex_match(sptr + 2, "^\\s*[0-9]{1,}\\s*[\\>|\\<|\\<=|\\>=|=|!=]\\s*.*;\\s*$", REG_EXTENDED | REG_ICASE);
if (match == 0) {
// select col >> n from ...;
match = regex_match(sptr + 2, "^\\s*[0-9]{1,}\\s*.*;\\s*$", REG_EXTENDED | REG_ICASE);
if (match == 0) {
cptr = tstrstr(command, ";", true);
if (cptr != NULL) {
*cptr = '\0';
}
if (wordexp(sptr + 2, &full_path, 0) != 0) {
fprintf(stderr, "ERROR: invalid filename: %s\n", sptr + 2);
return;
}
*sptr = '\0';
fname = full_path.we_wordv[0];
}
if (wordexp(sptr + 2, &full_path, 0) != 0) {
fprintf(stderr, "ERROR: invalid filename: %s\n", sptr + 2);
return;
}
*sptr = '\0';
fname = full_path.we_wordv[0];
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册