From c0ae4e75767e3dd9d2068044063f181b775abcc3 Mon Sep 17 00:00:00 2001 From: Hui Li Date: Sat, 20 Jun 2020 17:08:23 +0800 Subject: [PATCH] [TD-598] --- src/client/src/tscParseInsert.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index e65acc2483..69bc4a3e20 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -986,14 +986,16 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { return code; } -int validateTableName(char *tblName, int len) { +int validateTableName(char *tblName, int len, SSQLToken* psTblToken) { char buf[TSDB_TABLE_ID_LEN] = {0}; tstrncpy(buf, tblName, sizeof(buf)); - SSQLToken token = {.n = len, .type = TK_ID, .z = buf}; - tSQLGetToken(buf, &token.type); + psTblToken->n = len; + psTblToken->type = TK_ID; + psTblToken->z = buf; + tSQLGetToken(buf, &psTblToken->type); - return tscValidateName(&token); + return tscValidateName(psTblToken); } static int32_t validateDataSource(SSqlCmd *pCmd, int8_t type, const char *sql) { @@ -1077,14 +1079,14 @@ int tsParseInsertSql(SSqlObj *pSql) { } pCmd->curSql = sToken.z; - + SSQLToken sTblToken; // Check if the table name available or not - if (validateTableName(sToken.z, sToken.n) != TSDB_CODE_SUCCESS) { + if (validateTableName(sToken.z, sToken.n, &sTblToken) != TSDB_CODE_SUCCESS) { code = tscInvalidSQLErrMsg(pCmd->payload, "table name invalid", sToken.z); goto _error; } - if ((code = tscSetTableFullName(pTableMetaInfo, &sToken, pSql)) != TSDB_CODE_SUCCESS) { + if ((code = tscSetTableFullName(pTableMetaInfo, &sTblToken, pSql)) != TSDB_CODE_SUCCESS) { goto _error; } -- GitLab