diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index c9d7988a1eedc2b1752e71db38b7e32b57801569..067c3a2300d1c502bee74941f982d2fbe0813784 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -800,6 +800,8 @@ static void printHelp() { "Set the replica parameters of the database, By default use 1, min: 1, max: 3."); printf("%s%s%s%s\n", indent, "-m, --table-prefix=TABLEPREFIX", "\t", "Table prefix name. By default use 'd'."); + printf("%s%s%s%s\n", indent, "-E, --escape-character", "\t", + "Use escape character for Both Stable and normmal table name"); printf("%s%s%s%s\n", indent, "-s, --sql-file=FILE", "\t\t", "The select sql file."); printf("%s%s%s%s\n", indent, "-N, --normal-table", "\t\t", "Use normal table flag."); @@ -3777,7 +3779,7 @@ static int calcRowLen(SSuperTable* superTbls) { static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, char* dbName, char* stbName, char** childTblNameOfSuperTbl, - int64_t* childTblCountOfSuperTbl, int64_t limit, uint64_t offset) { + int64_t* childTblCountOfSuperTbl, int64_t limit, uint64_t offset, bool escapChar) { char command[1024] = "\0"; char limitBuf[100] = "\0"; @@ -3791,8 +3793,8 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos, limit, offset); //get all child table name use cmd: select tbname from superTblName; - snprintf(command, 1024, "select tbname from %s.%s %s", - dbName, stbName, limitBuf); + snprintf(command, 1024, escapChar ? "select tbname from %s.`%s` %s" : + "select tbname from %s.%s %s", dbName, stbName, limitBuf); res = taos_query(taos, command); int32_t code = taos_errno(res); @@ -3863,7 +3865,7 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, return getChildNameOfSuperTableWithLimitAndOffset(taos, dbName, stbName, childTblNameOfSuperTbl, childTblCountOfSuperTbl, - -1, 0); + -1, 0, false); } static int getSuperTableFromServer(TAOS * taos, char* dbName, @@ -4320,9 +4322,12 @@ static int createSuperTable( superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow; + snprintf(command, BUFFER_SIZE, - "CREATE TABLE IF NOT EXISTS %s.%s (ts TIMESTAMP%s) TAGS %s", - dbName, superTbl->stbName, cols, tags); + superTbl->escapeChar ? + "CREATE TABLE IF NOT EXISTS %s.`%s` (ts TIMESTAMP%s) TAGS %s": + "CREATE TABLE IF NOT EXISTS %s.%s (ts TIMESTAMP%s) TAGS %s", + dbName, superTbl->stbName, cols, tags); if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) { errorPrint2("create supertable %s failed!\n\n", superTbl->stbName); @@ -10364,7 +10369,7 @@ static void startMultiThreadInsertData(int threads, char* db_name, db_name, stbInfo->stbName, &stbInfo->childTblName, &childTblCount, limit, - offset); + offset, stbInfo->escapeChar); ntables = childTblCount; } else { ntables = g_args.ntables;