提交 1a048a10 编写于 作者: S slguan

[TD-9] extract table name

上级 1a52be00
...@@ -524,7 +524,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v ...@@ -524,7 +524,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v
} }
memset(stableName, 0, tListLen(stableName)); memset(stableName, 0, tListLen(stableName));
extractTableName(pTable->tableId, stableName); mgmtExtractTableName(pTable->tableId, stableName);
if (pShow->payloadLen > 0 && if (pShow->payloadLen > 0 &&
patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH) patternMatch(pShow->payload, stableName, TSDB_TABLE_NAME_LEN, &info) != TSDB_PATTERN_MATCH)
...@@ -625,7 +625,16 @@ int32_t mgmtGetSuperTableMeta(SDbObj *pDb, SSuperTableObj *pTable, STableMetaMsg ...@@ -625,7 +625,16 @@ int32_t mgmtGetSuperTableMeta(SDbObj *pDb, SSuperTableObj *pTable, STableMetaMsg
} }
int32_t mgmtExtractTableName(const char* tableId, char* name) { int32_t mgmtExtractTableName(const char* tableId, char* name) {
char* r = skipSegments(tableId, TS_PATH_DELIMITER[0], 2); int pos = -1;
return copy(name, r, TS_PATH_DELIMITER[0]); int num = 0;
for (pos = 0; tableId[pos] != 0; ++pos) {
if (tableId[pos] == '.') num++;
if (num == 2) break;
}
if (num == 2) {
strcpy(name, tableId + pos + 1);
}
return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册