[td-11818] fix crash in show.
This commit is contained in:
parent
f5916bcf47
commit
cf4b5594d4
|
@ -567,58 +567,58 @@ TEST(testCase, show_table_Test) {
|
||||||
// taos_free_result(pRes);
|
// taos_free_result(pRes);
|
||||||
// taos_close(pConn);
|
// taos_close(pConn);
|
||||||
//}
|
//}
|
||||||
//
|
|
||||||
//TEST(testCase, projection_query_tables) {
|
TEST(testCase, projection_query_tables) {
|
||||||
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
// ASSERT_NE(pConn, nullptr);
|
ASSERT_NE(pConn, nullptr);
|
||||||
//
|
|
||||||
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
TAOS_RES* pRes = taos_query(pConn, "use abc1");
|
||||||
// taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
//
|
|
||||||
//// pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
|
||||||
//// if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
//// printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
||||||
//// }
|
}
|
||||||
//// taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
////
|
|
||||||
//// pRes = taos_query(pConn, "create table tu using st1 tags(1)");
|
pRes = taos_query(pConn, "create table tu using st1 tags(1)");
|
||||||
//// if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
//// printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
||||||
//// }
|
}
|
||||||
//// taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
////
|
|
||||||
//// for(int32_t i = 0; i < 100; ++i) {
|
for(int32_t i = 0; i < 100000; ++i) {
|
||||||
//// char sql[512] = {0};
|
char sql[512] = {0};
|
||||||
//// sprintf(sql, "insert into tu values(now+%da, %d)", i, i);
|
sprintf(sql, "insert into tu values(now+%da, %d)", i, i);
|
||||||
//// TAOS_RES* p = taos_query(pConn, sql);
|
TAOS_RES* p = taos_query(pConn, sql);
|
||||||
//// if (taos_errno(p) != 0) {
|
if (taos_errno(p) != 0) {
|
||||||
//// printf("failed to insert data, reason:%s\n", taos_errstr(p));
|
printf("failed to insert data, reason:%s\n", taos_errstr(p));
|
||||||
//// }
|
}
|
||||||
////
|
|
||||||
//// taos_free_result(p);
|
taos_free_result(p);
|
||||||
//// }
|
}
|
||||||
//
|
|
||||||
// pRes = taos_query(pConn, "select * from tu");
|
pRes = taos_query(pConn, "select * from tu");
|
||||||
// if (taos_errno(pRes) != 0) {
|
if (taos_errno(pRes) != 0) {
|
||||||
// printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
|
||||||
// taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
// ASSERT_TRUE(false);
|
ASSERT_TRUE(false);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// TAOS_ROW pRow = NULL;
|
TAOS_ROW pRow = NULL;
|
||||||
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
|
TAOS_FIELD* pFields = taos_fetch_fields(pRes);
|
||||||
// int32_t numOfFields = taos_num_fields(pRes);
|
int32_t numOfFields = taos_num_fields(pRes);
|
||||||
//
|
|
||||||
// char str[512] = {0};
|
char str[512] = {0};
|
||||||
// while ((pRow = taos_fetch_row(pRes)) != NULL) {
|
while ((pRow = taos_fetch_row(pRes)) != NULL) {
|
||||||
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
|
int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
|
||||||
// printf("%s\n", str);
|
printf("%s\n", str);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
// taos_close(pConn);
|
taos_close(pConn);
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//TEST(testCase, projection_query_stables) {
|
//TEST(testCase, projection_query_stables) {
|
||||||
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
// ASSERT_NE(pConn, nullptr);
|
// ASSERT_NE(pConn, nullptr);
|
||||||
|
|
|
@ -26,7 +26,7 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseContext* pCtx, void** out
|
||||||
const char* msg4 = "pattern is invalid";
|
const char* msg4 = "pattern is invalid";
|
||||||
const char* msg5 = "database name is empty";
|
const char* msg5 = "database name is empty";
|
||||||
const char* msg6 = "pattern string is empty";
|
const char* msg6 = "pattern string is empty";
|
||||||
const char* msg7 = "db is not specified";
|
const char* msg7 = "database not specified";
|
||||||
/*
|
/*
|
||||||
* database prefix in pInfo->pMiscInfo->a[0]
|
* database prefix in pInfo->pMiscInfo->a[0]
|
||||||
* wildcard in like clause in pInfo->pMiscInfo->a[1]
|
* wildcard in like clause in pInfo->pMiscInfo->a[1]
|
||||||
|
@ -50,7 +50,11 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseContext* pCtx, void** out
|
||||||
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
char dbFname[TSDB_DB_FNAME_LEN] = {0};
|
||||||
tNameGetFullDbName(&name, dbFname);
|
tNameGetFullDbName(&name, dbFname);
|
||||||
|
|
||||||
catalogGetDBVgroup(pCtx->pCatalog, pCtx->pTransporter, &pCtx->mgmtEpSet, dbFname, false, &array);
|
int32_t code = catalogGetDBVgroup(pCtx->pCatalog, pCtx->pTransporter, &pCtx->mgmtEpSet, dbFname, false, &array);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
terrno = code;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
SVgroupInfo* info = taosArrayGet(array, 0);
|
SVgroupInfo* info = taosArrayGet(array, 0);
|
||||||
pShowReq->head.vgId = htonl(info->vgId);
|
pShowReq->head.vgId = htonl(info->vgId);
|
||||||
|
|
Loading…
Reference in New Issue