提交 1f802325 编写于 作者: C Cary Xu

bug fix

上级 59510344
Subproject commit ea6b3e973b477b8061e0076bb257dbd7f3faa756 Subproject commit 9015e129bd7de389afa4196495451669700904d0
...@@ -1725,7 +1725,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags ...@@ -1725,7 +1725,7 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
pStmt->last = STMT_SETTBNAME; pStmt->last = STMT_SETTBNAME;
SStrToken tname = {0}; SStrToken tname = {0};
tname.type = TK_ID; tname.type = TK_STRING;
tname.z = (char *)strdup(name); tname.z = (char *)strdup(name);
if (!tname.z) { if (!tname.z) {
tscError("0x%" PRIx64 " out of memory", pSql->self); 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 ...@@ -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")); 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, tname.z, tags);
int32_t ret = stmtGenInsertStatement(pSql, pStmt, name, tags);
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
free(tname.z); free(tname.z);
STMT_RET(ret); STMT_RET(ret);
......
...@@ -132,7 +132,7 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le ...@@ -132,7 +132,7 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le
return TSDB_CODE_SUCCESS; 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;} if (str == NULL || n <= 0) { return;}
for (int32_t i = 0; i < n; i++) { for (int32_t i = 0; i < n; i++) {
if (str[i] >= 'A' && str[i] <= 'Z') { if (str[i] >= 'A' && str[i] <= 'Z') {
...@@ -3028,7 +3028,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -3028,7 +3028,8 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
if (pToken->type == TK_STRING) { if (pToken->type == TK_STRING) {
tscDequoteAndTrimToken(pToken); 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); //pToken->n = (uint32_t)strtrim(pToken->z);
int len = tGetToken(pToken->z, &pToken->type); int len = tGetToken(pToken->z, &pToken->type);
...@@ -3046,7 +3047,6 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -3046,7 +3047,6 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
return tscValidateName(pToken, escapeEnabled, NULL); return tscValidateName(pToken, escapeEnabled, NULL);
} }
} else if (pToken->type == TK_ID) { } else if (pToken->type == TK_ID) {
strntolower(pToken->z, pToken->z, pToken->n);
tscRmEscapeAndTrimToken(pToken); tscRmEscapeAndTrimToken(pToken);
if (pToken->n == 0) { if (pToken->n == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册