From 33bcee62c966c8339441b46980ae594ffb2132fb Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 6 Apr 2022 15:09:29 +0800 Subject: [PATCH] [td-14393] refactor. --- source/client/inc/clientInt.h | 1 + source/client/src/clientImpl.c | 1 + source/client/src/clientMain.c | 7 ++++++- source/client/test/clientTests.cpp | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 0749ce9e7d..ae1b34a3bd 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -163,6 +163,7 @@ typedef struct SReqResultInfo { uint64_t totalRows; uint32_t current; bool completed; + int32_t precision; int32_t payloadLen; } SReqResultInfo; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 80559c025f..4a2687ed36 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -825,6 +825,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR pResultInfo->current = 0; pResultInfo->completed = (pRsp->completed == 1); pResultInfo->payloadLen = htonl(pRsp->compLen); + pResultInfo->precision = pRsp->precision; // TODO handle the compressed case pResultInfo->totalRows += pResultInfo->numOfRows; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index ee4fc7fcb5..b2c32a4366 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -323,7 +323,12 @@ int taos_affected_rows(TAOS_RES *res) { } int taos_result_precision(TAOS_RES *res) { - return TSDB_TIME_PRECISION_MILLI; + SRequestObj* pRequest = (SRequestObj*) res; + if (pRequest == NULL) { + return TSDB_TIME_PRECISION_MILLI; + } + + return pRequest->body.resInfo.precision; } int taos_select_db(TAOS *taos, const char *db) { diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 629dd90da3..772f9049e5 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -400,6 +400,7 @@ TEST(testCase, show_vgroup_Test) { taos_free_result(pRes); taos_close(pConn); } +#endif TEST(testCase, create_multiple_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -458,7 +459,7 @@ TEST(testCase, create_multiple_tables) { taos_free_result(pRes); - for (int32_t i = 0; i < 20; ++i) { + for (int32_t i = 0; i < 25000; ++i) { char sql[512] = {0}; snprintf(sql, tListLen(sql), "create table t_x_%d using st1 tags(2) t_x_%d using st1 tags(5) t_x_%d using st1 tags(911)", i, @@ -652,7 +653,6 @@ TEST(testCase, projection_query_stables) { taos_free_result(pRes); taos_close(pConn); } -#endif TEST(testCase, agg_query_tables) { TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); -- GitLab