diff options
author | Bjorn Munch <Bjorn.Munch@sun.com> | 2010-03-23 15:01:40 +0100 |
---|---|---|
committer | Bjorn Munch <Bjorn.Munch@sun.com> | 2010-03-23 15:01:40 +0100 |
commit | 5fbd98a1fbb91d3d1a439c5f70efb66426caecf4 (patch) | |
tree | 7b8d909037b1f57712622a27f6a68987a90eff20 /client | |
parent | 4a6bf6443e783bbaef7a517d053ec01d26c5d90f (diff) | |
download | mariadb-git-5fbd98a1fbb91d3d1a439c5f70efb66426caecf4.tar.gz |
Bug #52301 Add --protocol to mysqltest
Implement as for other clients
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index e184061d4d3..4205d5518dc 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -188,6 +188,8 @@ static void init_re(void); static int match_re(my_regex_t *, char *); static void free_re(void); +static uint opt_protocol=0; + DYNAMIC_ARRAY q_lines; #include "sslopt-vars.h" @@ -5165,11 +5167,13 @@ void do_connect(struct st_command *command) #ifdef __WIN__ if (con_pipe) { - uint protocol= MYSQL_PROTOCOL_PIPE; - mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol); + opt_protocol= MYSQL_PROTOCOL_PIPE; } #endif + if (opt_protocol) + mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); + #ifdef HAVE_SMEM if (con_shm) { @@ -5886,6 +5890,8 @@ static struct my_option my_long_options[] = GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -6023,7 +6029,7 @@ void read_embedded_server_arguments(const char *name) static my_bool -get_one_option(int optid, const struct my_option *opt __attribute__((unused)), +get_one_option(int optid, const struct my_option *opt, char *argument) { switch(optid) { @@ -6112,6 +6118,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case 'V': print_version(); exit(0); + case OPT_MYSQL_PROTOCOL: + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); + break; case '?': usage(); exit(0); @@ -7862,6 +7872,9 @@ int main(int argc, char **argv) mysql_options(&con->mysql, MYSQL_SET_CHARSET_DIR, opt_charsets_dir); + if (opt_protocol) + mysql_options(&con->mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); + #ifdef HAVE_OPENSSL if (opt_use_ssl) |