未验证 提交 6c24bbae 编写于 作者: H huili 提交者: GitHub

Merge pull request #4476 from taosdata/bugfix/TD-2336

use only one taos_connect and taos_close
......@@ -50,7 +50,7 @@ static void queryDB(TAOS *taos, char *command) {
taos_free_result(pSql);
}
void Test(char *qstr, const char *input, int i);
void Test(TAOS *taos, char *qstr, int i);
int main(int argc, char *argv[]) {
char qstr[1024];
......@@ -63,21 +63,22 @@ int main(int argc, char *argv[]) {
// init TAOS
taos_init();
TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
if (taos == NULL) {
printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/);
exit(1);
}
for (int i = 0; i < 4000000; i++) {
Test(qstr, argv[1], i);
Test(taos, qstr, i);
}
taos_close(taos);
taos_cleanup();
}
void Test(char *qstr, const char *input, int index) {
TAOS *taos = taos_connect(input, "root", "taosdata", NULL, 0);
void Test(TAOS *taos, char *qstr, int index) {
printf("==================test at %d\n================================", index);
queryDB(taos, "drop database if exists demo");
queryDB(taos, "create database demo");
TAOS_RES *result;
if (taos == NULL) {
printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/);
exit(1);
}
queryDB(taos, "use demo");
queryDB(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))");
......@@ -131,6 +132,5 @@ void Test(char *qstr, const char *input, int index) {
taos_free_result(result);
printf("====demo end====\n\n");
taos_close(taos);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册