[TD-3589] <fix>: taosdemo need to use db before query. (#5612)
Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
ea1508bfee
commit
78e67ebe7c
|
@ -5526,9 +5526,14 @@ static void *superQueryProcess(void *sarg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//char sqlStr[MAX_TB_NAME_SIZE*2];
|
char sqlStr[MAX_DB_NAME_SIZE + 5];
|
||||||
//sprintf(sqlStr, "use %s", g_queryInfo.dbName);
|
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
|
||||||
//queryDB(winfo->taos, sqlStr);
|
if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE, false)) {
|
||||||
|
taos_close(winfo->taos);
|
||||||
|
errorPrint( "use database %s failed!\n\n",
|
||||||
|
g_queryInfo.dbName);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t st = 0;
|
int64_t st = 0;
|
||||||
int64_t et = 0;
|
int64_t et = 0;
|
||||||
|
@ -5861,9 +5866,10 @@ static void *subSubscribeProcess(void *sarg) {
|
||||||
|
|
||||||
char sqlStr[MAX_TB_NAME_SIZE*2];
|
char sqlStr[MAX_TB_NAME_SIZE*2];
|
||||||
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
|
sprintf(sqlStr, "use %s", g_queryInfo.dbName);
|
||||||
debugPrint("%s() %d sqlStr: %s\n", __func__, __LINE__, sqlStr);
|
|
||||||
if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE, false)) {
|
if (0 != queryDbExec(winfo->taos, sqlStr, NO_INSERT_TYPE, false)) {
|
||||||
taos_close(winfo->taos);
|
taos_close(winfo->taos);
|
||||||
|
errorPrint( "use database %s failed!\n\n",
|
||||||
|
g_queryInfo.dbName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue