fix: some problems of parser for stmt mode

This commit is contained in:
Xiaoyu Wang 2022-05-17 20:08:13 +08:00
parent 463d7d16c0
commit 8eadd68218
2 changed files with 6 additions and 1 deletions

View File

@ -3446,7 +3446,11 @@ static int32_t extractQueryResultSchema(const SNodeList* pProjections, int32_t*
(*pSchema)[index].type = pExpr->resType.type; (*pSchema)[index].type = pExpr->resType.type;
(*pSchema)[index].bytes = pExpr->resType.bytes; (*pSchema)[index].bytes = pExpr->resType.bytes;
(*pSchema)[index].colId = index + 1; (*pSchema)[index].colId = index + 1;
if ('\0' != pExpr->userAlias[0]) {
strcpy((*pSchema)[index].name, pExpr->userAlias); strcpy((*pSchema)[index].name, pExpr->userAlias);
} else {
strcpy((*pSchema)[index].name, pExpr->aliasName);
}
index += 1; index += 1;
} }

View File

@ -139,6 +139,7 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
static EDealRes rewriteQueryExprAliasImpl(SNode* pNode, void* pContext) { static EDealRes rewriteQueryExprAliasImpl(SNode* pNode, void* pContext) {
if (nodesIsExprNode(pNode) && QUERY_NODE_COLUMN != nodeType(pNode) && '\0' == ((SExprNode*)pNode)->userAlias[0]) { if (nodesIsExprNode(pNode) && QUERY_NODE_COLUMN != nodeType(pNode) && '\0' == ((SExprNode*)pNode)->userAlias[0]) {
strcpy(((SExprNode*)pNode)->userAlias, ((SExprNode*)pNode)->aliasName);
sprintf(((SExprNode*)pNode)->aliasName, "#%d", *(int32_t*)pContext); sprintf(((SExprNode*)pNode)->aliasName, "#%d", *(int32_t*)pContext);
++(*(int32_t*)pContext); ++(*(int32_t*)pContext);
} }