feat: add showAD feature for community
This commit is contained in:
parent
2f6304d71e
commit
fd408b63da
|
@ -56,7 +56,7 @@ static void shellWriteHistory();
|
||||||
static void shellPrintError(TAOS_RES *tres, int64_t st);
|
static void shellPrintError(TAOS_RES *tres, int64_t st);
|
||||||
static bool shellIsCommentLine(char *line);
|
static bool shellIsCommentLine(char *line);
|
||||||
static void shellSourceFile(const char *file);
|
static void shellSourceFile(const char *file);
|
||||||
static void shellGetGrantInfo();
|
static bool shellGetGrantInfo();
|
||||||
|
|
||||||
static void shellCleanup(void *arg);
|
static void shellCleanup(void *arg);
|
||||||
static void *shellCancelHandler(void *arg);
|
static void *shellCancelHandler(void *arg);
|
||||||
|
@ -1150,7 +1150,17 @@ void shellSourceFile(const char *file) {
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shellGetGrantInfo() {
|
// show enterprise AD
|
||||||
|
void showAD() {
|
||||||
|
fprintf(stdout, "You are using the TDengine Community Edition. \
|
||||||
|
If you want to experience more advanced TDengine features and have professional service, \
|
||||||
|
please try the TDengine Enterprise Edition.\r\n\
|
||||||
|
https://www.taosdata.com/tdengine-enterprise
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shellGetGrantInfo() {
|
||||||
|
bool community = true;
|
||||||
char sinfo[1024] = {0};
|
char sinfo[1024] = {0};
|
||||||
tstrncpy(sinfo, taos_get_server_info(shell.conn), sizeof(sinfo));
|
tstrncpy(sinfo, taos_get_server_info(shell.conn), sizeof(sinfo));
|
||||||
strtok(sinfo, "\r\n");
|
strtok(sinfo, "\r\n");
|
||||||
|
@ -1194,15 +1204,19 @@ void shellGetGrantInfo() {
|
||||||
memcpy(expired, row[2], fields[2].bytes);
|
memcpy(expired, row[2], fields[2].bytes);
|
||||||
|
|
||||||
if (strcmp(serverVersion, "community") == 0) {
|
if (strcmp(serverVersion, "community") == 0) {
|
||||||
fprintf(stdout, "Server is Community Edition.\r\n");
|
community = true;
|
||||||
|
showAD()
|
||||||
} else if (strcmp(expiretime, "unlimited") == 0) {
|
} else if (strcmp(expiretime, "unlimited") == 0) {
|
||||||
|
community = false;
|
||||||
fprintf(stdout, "Server is Enterprise %s Edition, %s and will never expire.\r\n", serverVersion, sinfo);
|
fprintf(stdout, "Server is Enterprise %s Edition, %s and will never expire.\r\n", serverVersion, sinfo);
|
||||||
} else {
|
} else {
|
||||||
|
community = false;
|
||||||
fprintf(stdout, "Server is Enterprise %s Edition, %s and will expire at %s.\r\n", serverVersion, sinfo,
|
fprintf(stdout, "Server is Enterprise %s Edition, %s and will expire at %s.\r\n", serverVersion, sinfo,
|
||||||
expiretime);
|
expiretime);
|
||||||
}
|
}
|
||||||
|
|
||||||
taos_free_result(tres);
|
taos_free_result(tres);
|
||||||
|
return community;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, "\r\n");
|
fprintf(stdout, "\r\n");
|
||||||
|
@ -1367,7 +1381,7 @@ int32_t shellExecute() {
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
printfIntroduction();
|
printfIntroduction();
|
||||||
#endif
|
#endif
|
||||||
shellGetGrantInfo();
|
bool community = shellGetGrantInfo();
|
||||||
#ifdef WEBSOCKET
|
#ifdef WEBSOCKET
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1380,6 +1394,12 @@ int32_t shellExecute() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commnuity
|
||||||
|
if (community) {
|
||||||
|
showAD();
|
||||||
|
}
|
||||||
|
|
||||||
taosThreadJoin(spid, NULL);
|
taosThreadJoin(spid, NULL);
|
||||||
|
|
||||||
shellCleanupHistory();
|
shellCleanupHistory();
|
||||||
|
|
Loading…
Reference in New Issue