feat: taos-shell support new websocket api
This commit is contained in:
parent
96824ca012
commit
51aee7afff
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 3.0
|
GIT_TAG feat/TD-31019-3.0
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosws-rs
|
# taosws-rs
|
||||||
ExternalProject_Add(taosws-rs
|
ExternalProject_Add(taosws-rs
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||||
GIT_TAG main
|
GIT_TAG feat/TS-5060
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -34,10 +34,10 @@ int shell_conn_ws_server(bool first) {
|
||||||
size_t len = strlen(shell.args.dsn);
|
size_t len = strlen(shell.args.dsn);
|
||||||
char * dsn = taosMemoryMalloc(len + 32);
|
char * dsn = taosMemoryMalloc(len + 32);
|
||||||
sprintf(dsn, "%s&conn_mode=1", shell.args.dsn);
|
sprintf(dsn, "%s&conn_mode=1", shell.args.dsn);
|
||||||
shell.ws_conn = ws_connect_with_dsn(dsn);
|
shell.ws_conn = ws_connect(dsn);
|
||||||
taosMemoryFree(dsn);
|
taosMemoryFree(dsn);
|
||||||
} else {
|
} else {
|
||||||
shell.ws_conn = ws_connect_with_dsn(shell.args.dsn);
|
shell.ws_conn = ws_connect(shell.args.dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == shell.ws_conn) {
|
if (NULL == shell.ws_conn) {
|
||||||
|
@ -95,7 +95,7 @@ int shell_conn_ws_server(bool first) {
|
||||||
static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
|
static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
|
||||||
const void* data = NULL;
|
const void* data = NULL;
|
||||||
int rows;
|
int rows;
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
if (wres) {
|
if (wres) {
|
||||||
*execute_time += (double)(ws_take_timing(wres)/1E6);
|
*execute_time += (double)(ws_take_timing(wres)/1E6);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
numOfRows += rows;
|
numOfRows += rows;
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
} while (rows && !shell.stop_query);
|
} while (rows && !shell.stop_query);
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
|
||||||
static int verticalPrintWebsocket(WS_RES* wres, double* pexecute_time) {
|
static int verticalPrintWebsocket(WS_RES* wres, double* pexecute_time) {
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
const void* data = NULL;
|
const void* data = NULL;
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
if (wres) {
|
if (wres) {
|
||||||
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
|
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ static int verticalPrintWebsocket(WS_RES* wres, double* pexecute_time) {
|
||||||
}
|
}
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
}
|
}
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
} while (rows && !shell.stop_query);
|
} while (rows && !shell.stop_query);
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres,
|
||||||
}
|
}
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
const void* data = NULL;
|
const void* data = NULL;
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
if (wres) {
|
if (wres) {
|
||||||
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
|
*pexecute_time += (double)(ws_take_timing(wres)/1E6);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres,
|
||||||
}
|
}
|
||||||
taosFprintfFile(pFile, "\r\n");
|
taosFprintfFile(pFile, "\r\n");
|
||||||
}
|
}
|
||||||
ws_fetch_block(wres, &data, &rows);
|
ws_fetch_raw_block(wres, &data, &rows);
|
||||||
} while (rows && !shell.stop_query);
|
} while (rows && !shell.stop_query);
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
|
|
Loading…
Reference in New Issue