提交 03e1664d 编写于 作者: sangshuduo's avatar sangshuduo

[TD-2984] <fix>: combine taosdemo and taosdemox.

上级 b378b691
...@@ -5072,6 +5072,18 @@ int main(int argc, char *argv[]) { ...@@ -5072,6 +5072,18 @@ int main(int argc, char *argv[]) {
printf("Failed to read %s\n", g_args.metaFile); printf("Failed to read %s\n", g_args.metaFile);
return 1; return 1;
} }
if (INSERT_MODE == g_jsonType) {
if (g_Dbs.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir);
(void)insertTestProcess();
} else if (QUERY_MODE == g_jsonType) {
if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir);
(void)queryTestProcess();
} else if (SUBSCRIBE_MODE == g_jsonType) {
if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir);
(void)subscribeTestProcess();
} else {
;
}
} else { } else {
memset(&g_Dbs, 0, sizeof(SDbs)); memset(&g_Dbs, 0, sizeof(SDbs));
...@@ -5079,7 +5091,8 @@ int main(int argc, char *argv[]) { ...@@ -5079,7 +5091,8 @@ int main(int argc, char *argv[]) {
setParaFromArg(); setParaFromArg();
if (NULL != g_args.sqlFile) { if (NULL != g_args.sqlFile) {
TAOS* qtaos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, g_Dbs.db[0].dbName, g_Dbs.port); TAOS* qtaos = taos_connect(
g_Dbs.host, g_Dbs.user, g_Dbs.password, g_Dbs.db[0].dbName, g_Dbs.port);
querySqlFile(qtaos, g_args.sqlFile); querySqlFile(qtaos, g_args.sqlFile);
taos_close(qtaos); taos_close(qtaos);
return 0; return 0;
...@@ -5089,22 +5102,28 @@ int main(int argc, char *argv[]) { ...@@ -5089,22 +5102,28 @@ int main(int argc, char *argv[]) {
if (g_Dbs.insert_only) return 0; if (g_Dbs.insert_only) return 0;
// select // select
if (false == insert_only) {
//printf("At present, there is no integration of taosdemo, please wait patiently!\n"); // query data
return 0; pthread_t read_id;
} info *rInfo = malloc(sizeof(info));
rInfo->start_time = 1500000000000;
if (INSERT_MODE == g_jsonType) { rInfo->start_table_id = 0;
if (g_Dbs.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_Dbs.cfgDir); rInfo->end_table_id = ntables - 1;
(void)insertTestProcess(); rInfo->do_aggreFunc = do_aggreFunc;
} else if (QUERY_MODE == g_jsonType) { rInfo->nrecords_per_table = nrecords_per_table;
if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir); rInfo->taos = taos_connect(ip_addr, user, pass, db_name, port);
(void)queryTestProcess(); strcpy(rInfo->tb_prefix, tb_prefix);
} else if (SUBSCRIBE_MODE == g_jsonType) { strcpy(rInfo->fp, arguments.output_file);
if (g_queryInfo.cfgDir[0]) taos_options(TSDB_OPTION_CONFIGDIR, g_queryInfo.cfgDir);
(void)subscribeTestProcess(); if (!use_metric) {
} else { pthread_create(&read_id, NULL, readTable, rInfo);
; } else {
pthread_create(&read_id, NULL, readMetric, rInfo);
}
pthread_join(read_id, NULL);
taos_close(rInfo->taos);
free(rInfo);
}
} }
taos_cleanup(); taos_cleanup();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册