未验证 提交 86c50d51 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

fix: taos shell ws take timing with null inputed (#18957)

上级 ae07cbdf
......@@ -37,7 +37,9 @@ static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
const void* data = NULL;
int rows;
ws_fetch_block(wres, &data, &rows);
*execute_time += (double)(ws_take_timing(wres)/1E6);
if (wres) {
*execute_time += (double)(ws_take_timing(wres)/1E6);
}
if (!rows) {
return 0;
}
......@@ -77,7 +79,9 @@ static int verticalPrintWebsocket(WS_RES* wres, double* pexecute_time) {
int rows = 0;
const void* data = NULL;
ws_fetch_block(wres, &data, &rows);
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
if (wres) {
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
}
if (!rows) {
return 0;
}
......@@ -129,7 +133,9 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute
int rows = 0;
const void* data = NULL;
ws_fetch_block(wres, &data, &rows);
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
if (wres) {
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
}
if (!rows) {
taosCloseFile(&pFile);
return 0;
......@@ -236,7 +242,10 @@ void shellRunSingleCommandWebsocketImp(char *command) {
break;
}
double execute_time = ws_take_timing(res)/1E6;
double execute_time = 0;
if (res) {
execute_time = ws_take_timing(res)/1E6;
}
if (shellRegexMatch(command, "^\\s*use\\s+[a-zA-Z0-9_]+\\s*;\\s*$", REG_EXTENDED | REG_ICASE)) {
fprintf(stdout, "Database changed.\r\n\r\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册