diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 33ea06ba9c03df9b4d7dd2fd67fca4cbabf95707..ee7063d4715f2af5fcde3fda328e9b46f7037460 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -342,6 +342,10 @@ typedef struct SSqlObj { struct SSqlObj *prev, *next; int64_t self; + + void *metaSubPtr; + int64_t parentRid; + int64_t metaSubRid; } SSqlObj; typedef struct SSqlStream { @@ -419,7 +423,7 @@ void tscCloseTscObj(void *pObj); // todo move to taos? or create a new file: taos_internal.h TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int), void *param, TAOS **taos); -TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res); +TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res); void waitForQueryRsp(void *param, TAOS_RES *tres, int code); void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index bb0d8005c2d7234b5a9dca1cc788239ece088965..fa7bc99a9f304c45db46891f444509ec4c72e97f 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -314,7 +314,7 @@ static void waitForRetrieveRsp(void *param, TAOS_RES *tres, int numOfRows) { tsem_post(&pSql->rspSem); } -TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES** res) { +TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, int64_t* res) { STscObj *pObj = (STscObj *)taos; if (pObj == NULL || pObj->signature != pObj) { terrno = TSDB_CODE_TSC_DISCONNECTED; @@ -340,7 +340,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen); if (res != NULL) { - *res = pSql; + atomic_store_64(res, pSql->self); } tsem_wait(&pSql->rspSem); @@ -351,7 +351,7 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) { return taos_query_c(taos, sqlstr, (uint32_t)strlen(sqlstr), NULL); } -TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res) { +TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res) { return taos_query_c(taos, sqlstr, (uint32_t) strlen(sqlstr), res); } diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 627d06ac2e59ec2bdb222998ea05018c038830ab..fca0e93472a350e8a6fddb8acc5ff54af67fa833 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -302,14 +302,12 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { st = taosGetTimestampUs(); - TAOS_RES* tmpSql = NULL; - TAOS_RES* pSql = taos_query_h(con, command, &tmpSql); + TAOS_RES* pSql = taos_query_h(con, command, &result); if (taos_errno(pSql)) { taos_error(pSql, st); return; } - atomic_store_64(&result, ((SSqlObj*)tmpSql)->self); int64_t oresult = atomic_load_64(&result); if (regex_match(command, "^\\s*use\\s+[a-zA-Z0-9_]+\\s*;\\s*$", REG_EXTENDED | REG_ICASE)) {