提交 649905f4 编写于 作者: X Xiaoyu Wang

TD-13747 New SQL model integration

上级 79e4cc0e
...@@ -101,20 +101,29 @@ SNode* nodesMakeNode(ENodeType type) { ...@@ -101,20 +101,29 @@ SNode* nodesMakeNode(ENodeType type) {
return NULL; return NULL;
} }
static EDealRes destroyNode(SNode* pNode, void* pContext) { static EDealRes destroyNode(SNode** pNode, void* pContext) {
switch (nodeType(pNode)) { switch (nodeType(*pNode)) {
case QUERY_NODE_VALUE: case QUERY_NODE_VALUE:
tfree(((SValueNode*)pNode)->literal); tfree(((SValueNode*)(*pNode))->literal);
break;
case QUERY_NODE_LOGIC_CONDITION:
nodesDestroyList(((SLogicConditionNode*)(*pNode))->pParameterList);
break;
case QUERY_NODE_FUNCTION:
nodesDestroyList(((SFunctionNode*)(*pNode))->pParameterList);
break;
case QUERY_NODE_GROUPING_SET:
nodesDestroyList(((SGroupingSetNode*)(*pNode))->pParameterList);
break; break;
default: default:
break; break;
} }
tfree(pNode); tfree(*pNode);
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
void nodesDestroyNode(SNode* pNode) { void nodesDestroyNode(SNode* pNode) {
nodesWalkNodePostOrder(pNode, destroyNode, NULL); nodesRewriteNodePostOrder(&pNode, destroyNode, NULL);
} }
SNodeList* nodesMakeList() { SNodeList* nodesMakeList() {
...@@ -191,9 +200,9 @@ SNode* nodesListGetNode(SNodeList* pList, int32_t index) { ...@@ -191,9 +200,9 @@ SNode* nodesListGetNode(SNodeList* pList, int32_t index) {
} }
void nodesDestroyList(SNodeList* pList) { void nodesDestroyList(SNodeList* pList) {
SNode* node; SListCell* pNext = pList->pHead;
FOREACH(node, pList) { while (NULL != pNext) {
nodesDestroyNode(node); pNext = nodesListErase(pList, pNext);
} }
tfree(pList); tfree(pList);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册