提交 e489c016 编写于 作者: G Ganlin Zhao

[TD-11220]<feature>(query): time related functions

上级 fffcab68
......@@ -60,7 +60,7 @@ SSqlInfo qSqlParse(const char *pStr) {
sqlInfo.valid = false;
goto abort_parse;
}
case TK_HEX:
case TK_OCT:
case TK_BIN:{
......@@ -68,6 +68,12 @@ SSqlInfo qSqlParse(const char *pStr) {
sqlInfo.valid = false;
goto abort_parse;
}
case TK_NOW: {
// for now() function used in select clause
if (pStr[i] == '(' && pStr[i + 1] == ')') {
t0.type = TK_ID;
}
}
default:
Parse(pParser, t0.type, t0, &sqlInfo);
if (sqlInfo.valid == false) {
......
......@@ -590,10 +590,6 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) {
}
*tokenId = tKeywordCode(z, i);
//Check for function now()
if (*tokenId == TK_NOW && z[i] == '(' && z[i + 1] == ')') {
*tokenId = TK_ID;
}
return i;
}
}
......@@ -670,6 +666,11 @@ SStrToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr) {
#endif
}
//for now() function used in insert clause
if (t0.type == TK_NOW && str[t0.n] == '(' && str[t0.n + 1] == ')') {
t0.n += 2;
}
if (t0.type == TK_SEMI) {
t0.n = 0;
return t0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册