未验证 提交 1041396a 编写于 作者: Y Yang Zhao 提交者: GitHub

[TD-10712]<fix>taosdemo escape character (#8320)

* add -E to --help

* add escape char to stable

* stable escape char
上级 f5d9a1cf
......@@ -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,7 +4322,10 @@ static int createSuperTable(
superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow;
snprintf(command, BUFFER_SIZE,
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)) {
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册