From 349818c9b18ffb99f7253c43b5cd4cb927c95b25 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 4 Aug 2021 18:16:25 +0800 Subject: [PATCH] [TD-5578] the max length of wild cards can be configured --- packaging/cfg/taos.cfg | 4 ++-- src/client/src/tscSQLParser.c | 4 ++-- src/common/inc/tglobal.h | 2 +- src/common/src/tglobal.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index 0e28d8b43c..3ae4e9941e 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -144,8 +144,8 @@ keepColumnName 1 # max length of an SQL # maxSQLLength 65480 -# max length of like -# maxLikeLength 100 +# max length of WildCards +# maxWildCardsLength 100 # the maximum number of records allowed for super table time sorting # maxNumOfOrderedRes 100000 diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 8bab4225b8..573e8b8782 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4401,9 +4401,9 @@ static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t tSqlExpr* pRight = pExpr->pRight; if (pExpr->tokenId == TK_LIKE) { - if (pRight->value.nLen > tsMaxLikeStringLen) { + if (pRight->value.nLen > tsMaxWildCardsLen) { char tmp[64] = {0}; - sprintf(tmp, msg1, tsMaxLikeStringLen); + sprintf(tmp, msg1, tsMaxWildCardsLen); return invalidOperationMsg(msgBuf, tmp); } diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 544482fd14..25d1c90ec5 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -70,7 +70,7 @@ extern int8_t tsKeepOriginalColumnName; // client extern int32_t tsMaxSQLStringLen; -extern int32_t tsMaxLikeStringLen; +extern int32_t tsMaxWildCardsLen; extern int8_t tsTscEnableRecordSql; extern int32_t tsMaxNumOfOrderedResults; extern int32_t tsMinSlidingTime; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 98d524179d..3c904dc034 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -76,7 +76,7 @@ int32_t tsCompressMsgSize = -1; // client int32_t tsMaxSQLStringLen = TSDB_MAX_ALLOWED_SQL_LEN; -int32_t tsMaxLikeStringLen = TSDB_PATTERN_STRING_MAX_LEN; +int32_t tsMaxWildCardsLen = TSDB_PATTERN_STRING_MAX_LEN; int8_t tsTscEnableRecordSql = 0; // the maximum number of results for projection query on super table that are returned from @@ -986,8 +986,8 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_BYTE; taosInitConfigOption(cfg); - cfg.option = "maxLikeLength"; - cfg.ptr = &tsMaxLikeStringLen; + cfg.option = "maxWildCardsLength"; + cfg.ptr = &tsMaxWildCardsLen; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW; cfg.minValue = 0; -- GitLab