From 14c377e37e75130b76e748d8d0670323cce9ad31 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Thu, 9 Jan 2020 23:23:13 +0800 Subject: [PATCH] refactor some codes, avoid set return code to be 0. --- src/client/src/tscLocal.c | 3 ++- src/client/src/tscUtil.c | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 6c54767a73..402838bb68 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -445,7 +445,8 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa SSqlRes *pRes = &pSql->res; pCmd->numOfCols = 1; - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); + + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); pQueryInfo->order.order = TSQL_SO_ASC; tscClearFieldInfo(&pQueryInfo->fieldsInfo); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 0ff801d08b..fc175a399a 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -365,6 +365,9 @@ void tscFreeSqlCmdData(SSqlCmd* pCmd) { tscFreeSubqueryInfo(pCmd); } +/* + * this function must not change the pRes->code value, since it may be used later. + */ void tscFreeResData(SSqlObj* pSql) { SSqlRes* pRes = &pSql->res; @@ -386,10 +389,8 @@ void tscFreeResData(SSqlObj* pSql) { pRes->offset = 0; pRes->useconds = 0; - pRes->code = 0; pRes->data = NULL; - tfree(pRes->pGroupRec); tscDestroyLocalReducer(pSql); @@ -404,8 +405,6 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) { } SSqlCmd* pCmd = &pSql->cmd; - SSqlRes* pRes = &pSql->res; - STscObj* pObj = pSql->pTscObj; int32_t cmd = pCmd->command; -- GitLab