summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-03-08 10:05:30 +0200
committerMonty <monty@mariadb.org>2019-03-08 10:05:30 +0200
commitd3e3bb77c2173ab200efdc8188c4d0a52127d247 (patch)
tree6573e41ecb9afe1887dfdd813d639243f791a19d
parent5f34513c2a2dd5f8431cf03f6ba083c42f233dca (diff)
downloadmariadb-git-d3e3bb77c2173ab200efdc8188c4d0a52127d247.tar.gz
Print value of 'protocol' option in --help
-rw-r--r--client/mysql.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index f3125c1eb42..90f4e984379 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -198,6 +198,7 @@ static uint delimiter_length= 1;
unsigned short terminal_width= 80;
static uint opt_protocol=0;
+static const char *opt_protocol_type= "";
static CHARSET_INFO *charset_info= &my_charset_latin1;
#include "sslopt-vars.h"
@@ -1604,7 +1605,8 @@ static struct my_option my_long_options[] =
&current_prompt, &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ &opt_protocol_type, &opt_protocol_type, 0, GET_STR, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"quick", 'q',
"Don't cache result, print it row by row. This may slow down the server "
"if the output is suspended. Doesn't use history file.",
@@ -1785,8 +1787,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
- if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
- opt->name)) <= 0)
+ if (!argument[0])
+ opt_protocol= 0;
+ else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
+ opt->name)) <= 0)
exit(1);
#endif
break;
@@ -1873,6 +1877,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'W':
#ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE;
+ opt_protcol_type= "pipe";
#endif
break;
#include <sslopt-case.h>