提交 7e2a0f8c 编写于 作者: C Cary Xu

adaption for more test cases

上级 e66239c2
...@@ -1725,13 +1725,12 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags ...@@ -1725,13 +1725,12 @@ 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_STRING; tname.type = TK_ID;
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);
STMT_RET(TSDB_CODE_TSC_OUT_OF_MEMORY); STMT_RET(TSDB_CODE_TSC_OUT_OF_MEMORY);
} }
strntolower(tname.z, name, nameLen);
tname.n = (uint32_t)strlen(tname.z); tname.n = (uint32_t)strlen(tname.z);
bool dbIncluded = false; bool dbIncluded = false;
...@@ -1830,7 +1829,8 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags ...@@ -1830,7 +1829,8 @@ 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"));
} }
int32_t ret = stmtGenInsertStatement(pSql, pStmt, tname.z, tags); // N.B. Use 'name' while not 'tname.z' as tscValidateName is invoked in tsParseSql.
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,8 +132,7 @@ int32_t converToStr(char *str, int type, void *buf, int32_t bufSize, int32_t *le ...@@ -132,8 +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') {
...@@ -3029,8 +3028,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -3029,8 +3028,7 @@ 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);
...@@ -3048,6 +3046,7 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded) ...@@ -3048,6 +3046,7 @@ 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.
先完成此消息的编辑!
想要评论请 注册