show client version info before connecting to server

This commit is contained in:
slguan 2019-08-07 23:39:27 +08:00
parent 8b05ac9960
commit 9b3c4de4c5
1 changed files with 8 additions and 6 deletions

View File

@ -33,9 +33,8 @@
#include "tutil.h"
/**************** Global variables ****************/
char VERSION_INFO[] =
"Welcome to the TDengine shell, server version:%s client version:%s\n"
"Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.\n\n";
char CLIENT_VERSION[] = "Welcome to the TDengine shell, client version:%s ";
char SERVER_VERSION[] = "server version:%s\nCopyright (c) 2017 by TAOS Data, Inc. All rights reserved.\n\n";
char PROMPT_HEADER[] = "taos> ";
char CONTINUE_PROMPT[] = " -> ";
int prompt_size = 6;
@ -46,6 +45,10 @@ History history;
* FUNCTION: Initialize the shell.
*/
TAOS *shellInit(struct arguments *args) {
printf("\n");
printf(CLIENT_VERSION, taos_get_client_info());
fflush(stdout);
// set options before initializing
if (args->timezone != NULL) {
taos_options(TSDB_OPTION_TIMEZONE, args->timezone);
@ -100,8 +103,7 @@ TAOS *shellInit(struct arguments *args) {
exit(EXIT_SUCCESS);
}
printf("\n");
printf(VERSION_INFO, taos_get_server_info(con), taos_get_client_info());
printf(SERVER_VERSION, taos_get_server_info(con));
return con;
}
@ -584,7 +586,7 @@ void write_history() {
}
void taos_error(TAOS *con) {
fprintf(stderr, "TSDB error: %s\n", taos_errstr(con));
fprintf(stderr, "\nTSDB error: %s\n\n", taos_errstr(con));
/* free local resouce: allocated memory/metric-meta refcnt */
TAOS_RES *pRes = taos_use_result(con);