diff --git a/include/client/taos.h b/include/client/taos.h index 82d6b9e2f8..1dbe888834 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -244,7 +244,7 @@ typedef enum { TAOS_CONN_MODE_BI = 0, } TAOS_CONN_MODE; -DLL_EXPORT int taos_set_mode(TAOS* taos, int mode, int value); +DLL_EXPORT int taos_set_conn_mode(TAOS* taos, int mode, int value); /* --------------------------schemaless INTERFACE------------------------------- */ DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 117b01acf6..c4f4d24299 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -297,7 +297,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { SRetrieveTableRsp* pRsp = NULL; - int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, pRequest->pTscObj->biMode); + int8_t biMode = atomic_load_8(&pRequest->pTscObj->biMode); + int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, biMode); if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true); } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 994f0cf10b..9835660068 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1832,7 +1832,7 @@ int taos_stmt_close(TAOS_STMT *stmt) { return stmtClose(stmt); } -int taos_set_mode(TAOS* taos, int mode, int value) { +int taos_set_conn_mode(TAOS* taos, int mode, int value) { if (taos == NULL) { terrno = TSDB_CODE_INVALID_PARA; return terrno; @@ -1848,6 +1848,9 @@ int taos_set_mode(TAOS* taos, int mode, int value) { case TAOS_CONN_MODE_BI: atomic_store_8(&pObj->biMode, value); break; + default: + tscError("not supported mode."); + return TSDB_CODE_INVALID_PARA; } return 0; } \ No newline at end of file diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index b23b43731b..33ba5217a8 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -89,7 +89,8 @@ static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) { } static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta, int8_t biMode) { - blockDataEnsureCapacity(pBlock, numOfRows + 1); + int32_t blockCap = (biMode != 0) ? numOfRows + 1 : numOfRows; + blockDataEnsureCapacity(pBlock, blockCap); pBlock->info.rows = 0; // field