From cf3b1b12fd6a39e5ea567264af62c84c9fd51a86 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 6 May 2021 21:03:54 +0800 Subject: [PATCH] reset code --- src/client/src/tscParseInsert.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 17f9f27abc..f17afa0f78 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1345,12 +1345,15 @@ int tsParseSql(SSqlObj *pSql, bool initial) { } // make a backup as tsParseInsertSql may modify the string -// char* sqlstr = strdup(pSql->sqlstr); + char* sqlstr = strdup(pSql->sqlstr); ret = tsParseInsertSql(pSql); - if (/*(sqlstr == NULL) || */(pSql->parseRetry >= 1) || + if ((sqlstr == NULL) || (pSql->parseRetry >= 1) || (ret != TSDB_CODE_TSC_SQL_SYNTAX_ERROR && ret != TSDB_CODE_TSC_INVALID_SQL)) { + free(sqlstr); } else { tscResetSqlCmd(pCmd, true); + free(pSql->sqlstr); + pSql->sqlstr = sqlstr; pSql->parseRetry++; if ((ret = tsInsertInitialCheck(pSql)) == TSDB_CODE_SUCCESS) { ret = tsParseInsertSql(pSql); -- GitLab