From 37c1e1393d18927eeaf15f0ba9daf41d48a63035 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 1 Jun 2021 17:49:48 +0800 Subject: [PATCH] [td-255] fix bug found by regression test. --- src/client/src/tscPrepare.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 312a570f2c..0e740b36bf 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -1203,7 +1203,6 @@ static int insertBatchStmtExecute(STscStmt* pStmt) { return pStmt->pSql->res.code; } - int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { SSqlCmd *pCmd = &pSql->cmd; int32_t ret = TSDB_CODE_SUCCESS; @@ -1233,28 +1232,28 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { pStmt->mtb.tagSet = true; sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); - if (sToken.n > 0 && sToken.type == TK_VALUES) { + if (sToken.n > 0 && (sToken.type == TK_VALUES || sToken.type == TK_LP)) { return TSDB_CODE_SUCCESS; } if (sToken.n <= 0 || sToken.type != TK_USING) { - return TSDB_CODE_TSC_INVALID_OPERATION; + return tscSQLSyntaxErrMsg(pCmd->payload, "keywords USING is expected", sToken.z); } sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); if (sToken.n <= 0 || ((sToken.type != TK_ID) && (sToken.type != TK_STRING))) { - return TSDB_CODE_TSC_INVALID_OPERATION; + return tscSQLSyntaxErrMsg(pCmd->payload, "invalid token", sToken.z); } pStmt->mtb.stbname = sToken; sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); if (sToken.n <= 0 || sToken.type != TK_TAGS) { - return TSDB_CODE_TSC_INVALID_OPERATION; + return tscSQLSyntaxErrMsg(pCmd->payload, "keyword TAGS expected", sToken.z); } sToken = tStrGetToken(pCmd->insertParam.sql, &index, false); if (sToken.n <= 0 || sToken.type != TK_LP) { - return TSDB_CODE_TSC_INVALID_OPERATION; + return tscSQLSyntaxErrMsg(pCmd->payload, ") expected", sToken.z); } pStmt->mtb.tags = taosArrayInit(4, sizeof(SStrToken)); @@ -1296,9 +1295,6 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } - - - int stmtGenInsertStatement(SSqlObj* pSql, STscStmt* pStmt, const char* name, TAOS_BIND* tags) { size_t tagNum = taosArrayGetSize(pStmt->mtb.tags); size_t size = 1048576; @@ -1379,8 +1375,6 @@ int stmtGenInsertStatement(SSqlObj* pSql, STscStmt* pStmt, const char* name, TAO return TSDB_CODE_SUCCESS; } - - //////////////////////////////////////////////////////////////////////////////// // interface functions -- GitLab