fix: backslash add G only valid in string end
This commit is contained in:
parent
d666897043
commit
0aef021d88
|
@ -195,6 +195,25 @@ int32_t shellRunCommand(char *command, bool recordHistory) {
|
||||||
return shellRunSingleCommand(cmd);
|
return shellRunSingleCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char * strendG(const char* pstr) {
|
||||||
|
if(pstr == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t len = strlen(pstr);
|
||||||
|
if(len < 3) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * p = pstr + len - 2
|
||||||
|
if (strcmp(p, "\\G") == 0) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void shellRunSingleCommandImp(char *command) {
|
void shellRunSingleCommandImp(char *command) {
|
||||||
int64_t st, et;
|
int64_t st, et;
|
||||||
char *sptr = NULL;
|
char *sptr = NULL;
|
||||||
|
@ -213,7 +232,7 @@ void shellRunSingleCommandImp(char *command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sptr = strstr(command, "\\G")) != NULL) {
|
if ((sptr = strendG(command)) != NULL) {
|
||||||
*sptr = '\0';
|
*sptr = '\0';
|
||||||
printMode = true; // When output to a file, the switch does not work.
|
printMode = true; // When output to a file, the switch does not work.
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,6 +238,7 @@ static int shellDumpWebsocket(WS_RES *wres, char *fname,
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * strendG(const char* pstr);
|
||||||
void shellRunSingleCommandWebsocketImp(char *command) {
|
void shellRunSingleCommandWebsocketImp(char *command) {
|
||||||
int64_t st, et;
|
int64_t st, et;
|
||||||
char *sptr = NULL;
|
char *sptr = NULL;
|
||||||
|
@ -256,7 +257,7 @@ void shellRunSingleCommandWebsocketImp(char *command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sptr = strstr(command, "\\G")) != NULL) {
|
if ((sptr = strendG(command)) != NULL) {
|
||||||
*sptr = '\0';
|
*sptr = '\0';
|
||||||
printMode = true; // When output to a file, the switch does not work.
|
printMode = true; // When output to a file, the switch does not work.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue