diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2023-05-17 14:58:11 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2023-05-17 14:58:11 +0200 |
commit | 2543673dd22782f59299fd2e72179601892bd967 (patch) | |
tree | b73641bd88c9d1572203c75da618fce1937518e8 /client/mysql.cc | |
parent | 4e5b771e980edfdad5c5414aa62c81d409d585a4 (diff) | |
parent | ef911553f442cbb1baaac2af44c38b54fd058c41 (diff) | |
download | mariadb-git-bb-11.1-release.tar.gz |
Merge branch '11.0' into 11.1bb-11.1-release
Diffstat (limited to 'client/mysql.cc')
-rw-r--r-- | client/mysql.cc | 65 |
1 files changed, 11 insertions, 54 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index eb6508903b6..70bb4514dbc 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -299,8 +299,6 @@ unsigned short terminal_width= 80; static uint opt_protocol=0; static const char *opt_protocol_type= ""; -static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT; - #include "sslopt-vars.h" const char *default_dbug_option="d:t:o,/tmp/mariadb.trace"; @@ -1273,14 +1271,6 @@ int main(int argc,char *argv[]) exit(status.exit_status); } - /* Command line options override configured protocol */ - if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT - && protocol_to_force != opt_protocol) - { - warn_protocol_override(current_host, &opt_protocol, protocol_to_force); - } - - if (status.batch && !status.line_buff && !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) { @@ -1890,11 +1880,9 @@ static void usage(int version) my_bool -get_one_option(const struct my_option *opt, const char *argument, const char *filename) +get_one_option(const struct my_option *opt, const char *argument, + const char *filename) { - /* Track when protocol is set via CLI to not force port TCP protocol override */ - static my_bool ignore_protocol_override = FALSE; - switch(opt->id) { case OPT_CHARSETS_DIR: strmake_buf(mysql_charsets_dir, argument); @@ -1955,18 +1943,11 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi #ifndef EMBEDDED_LIBRARY if (!argument[0]) opt_protocol= 0; - else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + else if ((opt_protocol= + find_type_with_warning(argument, &sql_protocol_typelib, opt->name)) <= 0) exit(1); #endif - - /* Specification of protocol via CLI trumps implicit overrides */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - break; case OPT_SERVER_ARG: #ifdef EMBEDDED_LIBRARY @@ -2066,13 +2047,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi #ifdef _WIN32 opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol_type= "pipe"; - - /* Prioritize pipe if explicit via command line */ - if (filename[0] == '\0') - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } #endif break; #include <sslopt-case.h> @@ -2085,35 +2059,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi mysql_end(-1); break; case 'P': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* If port is set via CLI, try to force protocol to TCP */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = MYSQL_PROTOCOL_TCP; + /* Port given on command line, switch protocol to use TCP */ + opt_protocol= MYSQL_PROTOCOL_TCP; } break; case 'S': - /* If port and socket are set, fall back to default behavior */ - if (protocol_to_force == MYSQL_PROTOCOL_TCP) - { - ignore_protocol_override = TRUE; - protocol_to_force = MYSQL_PROTOCOL_DEFAULT; - } - - /* Prioritize socket if set via command line */ - if (filename[0] == '\0' && - !ignore_protocol_override && - protocol_to_force == MYSQL_PROTOCOL_DEFAULT) + if (filename[0] == '\0') { - protocol_to_force = SOCKET_PROTOCOL_TO_FORCE; + /* Socket given on command line, switch protocol to use SOCKETSt */ + opt_protocol= MYSQL_PROTOCOL_SOCKET; } break; case 'I': @@ -5660,6 +5616,7 @@ static void init_username() full_username=my_strdup(PSI_NOT_INSTRUMENTED, cur[0],MYF(MY_WME)); part_username=my_strdup(PSI_NOT_INSTRUMENTED, strtok(cur[0],"@"),MYF(MY_WME)); (void) mysql_fetch_row(result); // Read eof + mysql_free_result(result); } } |