summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVenkata Sidagam <venkata.sidagam@oracle.com>2012-07-19 13:52:34 +0530
committerVenkata Sidagam <venkata.sidagam@oracle.com>2012-07-19 13:52:34 +0530
commit913e3a8475f0cc69dcd149668291f973538e5046 (patch)
treeb058aca7d3889931a7dd6e575a51aa90ddfd404a /client
parentddcd6867e925613c90e699dcf3e51ab765cf07ba (diff)
downloadmariadb-git-913e3a8475f0cc69dcd149668291f973538e5046.tar.gz
Bug #12615411 - server side help doesn't work as first statement
Problem description: Giving "help 'contents'" in the mysql client as a first statement gives error Analysis: In com_server_help() function the "server_cmd" variable was initialised with buffer->ptr(). And the "server_cmd" variable is not updated since we are passing "'contents'"(with single quote) so the buffer->ptr() consists of the previous buffer values and it was sent to the mysql_real_query() hence we are getting error. Fix: We are not initialising the "server_cmd" variable and we are updating the variable with "server_cmd= cmd_buf" in any of the case i.e with single quote or without single quote for the contents. As part of error message improvement, added new error message in case of "help 'contents'". client/mysql.cc: com_server_help(): Properly updated the server_cmd variable and improved the error message.
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 49d58a832a2..595d5e1d969 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2803,7 +2803,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)), char *help_arg)
{
MYSQL_ROW cur;
- const char *server_cmd= buffer->ptr();
+ const char *server_cmd;
char cmd_buf[100 + 1];
MYSQL_RES *result;
int error;
@@ -2818,9 +2818,12 @@ static int com_server_help(String *buffer __attribute__((unused)),
*++end_arg= '\0';
}
(void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
- server_cmd= cmd_buf;
}
-
+ else
+ (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help ", help_arg, NullS);
+
+ server_cmd= cmd_buf;
+
if (!status.batch)
{
old_buffer= *buffer;
@@ -2888,6 +2891,11 @@ static int com_server_help(String *buffer __attribute__((unused)),
else
{
put_info("\nNothing found", INFO_INFO);
+ if (strncasecmp(server_cmd, "help 'contents'", 15) == 0)
+ {
+ put_info("\nPlease check if 'help tables' are loaded.\n", INFO_INFO);
+ goto err;
+ }
put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO);
}
}