From 1f802325f2d5c2b239dd0b1be9e1fe659a528fd9 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 17 Dec 2021 16:29:40 +0800 Subject: [PATCH] bug fix --- deps/jemalloc | 2 +- src/client/src/tscPrepare.c | 5 ++--- src/client/src/tscUtil.c | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/deps/jemalloc b/deps/jemalloc index ea6b3e973b..9015e129bd 160000 --- a/deps/jemalloc +++ b/deps/jemalloc @@ -1 +1 @@ -Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756 +Subproject commit 9015e129bd7de389afa4196495451669700904d0 diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index b8447d7160..ea0a3124b2 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -1725,7 +1725,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags pStmt->last = STMT_SETTBNAME; SStrToken tname = {0}; - tname.type = TK_ID; + tname.type = TK_STRING; tname.z = (char *)strdup(name); if (!tname.z) { tscError("0x%" PRIx64 " out of memory", pSql->self); @@ -1829,8 +1829,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "no tags set")); } - // N.B. Use 'name' while not 'tname.z' as tscValidateName is invoked in tsParseSql. - int32_t ret = stmtGenInsertStatement(pSql, pStmt, name, tags); + int32_t ret = stmtGenInsertStatement(pSql, pStmt, tname.z, tags); if (ret != TSDB_CODE_SUCCESS) { free(tname.z); STMT_RET(ret); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 5cf1be8b7f..96a896c2b2 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -132,7 +132,7 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le return TSDB_CODE_SUCCESS; } -static void tscStrToLower(char* str, int32_t n) { +UNUSED_FUNC static void tscStrToLower(char* str, int32_t n) { if (str == NULL || n <= 0) { return;} for (int32_t i = 0; i < n; i++) { if (str[i] >= 'A' && str[i] <= 'Z') { @@ -3028,7 +3028,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) if (pToken->type == TK_STRING) { tscDequoteAndTrimToken(pToken); - tscStrToLower(pToken->z, pToken->n); + // tscStrToLower(pToken->z, pToken->n); + strntolower(pToken->z, pToken->z, pToken->n); //pToken->n = (uint32_t)strtrim(pToken->z); int len = tGetToken(pToken->z, &pToken->type); @@ -3046,7 +3047,6 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) return tscValidateName(pToken, escapeEnabled, NULL); } } else if (pToken->type == TK_ID) { - strntolower(pToken->z, pToken->z, pToken->n); tscRmEscapeAndTrimToken(pToken); if (pToken->n == 0) { -- GitLab