diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-19 20:03:05 +0000 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-08-25 16:27:57 +0200 |
commit | 56c4cfe0bea0fea8f80692c3df684b204cbfa731 (patch) | |
tree | dc433fb0f163f8d06498b1cc425c6a57298cf060 /client/mysqladmin.cc | |
parent | 31a8cf54c8a7913338480a0571feaf32143b5f64 (diff) | |
download | mariadb-git-56c4cfe0bea0fea8f80692c3df684b204cbfa731.tar.gz |
MDEV-9293 - Use MariaDB's Connector/C in server
Diffstat (limited to 'client/mysqladmin.cc')
-rw-r--r-- | client/mysqladmin.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index fe9db6ea93d..fcc4e626f2f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -23,8 +23,10 @@ #include <sys/stat.h> #include <mysql.h> #include <sql_common.h> +#include <mysql_version.h> #include <welcome_copyright_notice.h> #include <my_rnd.h> +#include <password.h> #define ADMIN_VERSION "9.1" #define MAX_MYSQL_VAR 512 @@ -440,7 +442,7 @@ int main(int argc,char *argv[]) didn't signal for us to die. Otherwise, signal failure. */ - if (mysql.net.vio == 0) + if (mysql.net.pvio == 0) { if (option_wait && !interrupted) { @@ -521,7 +523,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, unix_port, CLIENT_REMEMBER_OPTIONS)) { - mysql->reconnect= 1; + my_bool reconnect= 1; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (info) { fputs("\n",stderr); @@ -542,16 +545,16 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) { fprintf(stderr, "Check that mysqld is running and that the socket: '%s' exists!\n", - unix_port ? unix_port : mysql_unix_port); + unix_port ? unix_port : MYSQL_UNIX_ADDR); } else if (mysql_errno(mysql) == CR_CONN_HOST_ERROR || mysql_errno(mysql) == CR_UNKNOWN_HOST) { fprintf(stderr,"Check that mysqld is running on %s",host); fprintf(stderr," and that the port is %d.\n", - tcp_port ? tcp_port: mysql_port); + tcp_port ? tcp_port: MYSQL_PORT); fprintf(stderr,"You can check this by doing 'telnet %s %d'\n", - host, tcp_port ? tcp_port: mysql_port); + host, tcp_port ? tcp_port: MYSQL_PORT); } } return 1; @@ -1077,9 +1080,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } } if (old) - make_scrambled_password_323(crypted_pw, typed_password); + my_make_scrambled_password_323(crypted_pw, typed_password, sizeof(crypted_pw)); else - make_scrambled_password(crypted_pw, typed_password); + my_make_scrambled_password(crypted_pw, typed_password, sizeof(crypted_pw)); } else crypted_pw[0]=0; /* No password */ @@ -1187,7 +1190,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) break; } case ADMIN_PING: - mysql->reconnect=0; /* We want to know of reconnects */ + { + my_bool reconnect= 0; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (!mysql_ping(mysql)) { if (option_silent < 2) @@ -1197,7 +1202,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) { if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) { - mysql->reconnect=1; + reconnect= 1; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (!mysql_ping(mysql)) puts("connection was down, but mysqld is now alive"); } @@ -1208,8 +1214,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return -1; } } - mysql->reconnect=1; /* Automatic reconnect is default */ + reconnect=1; /* Automatic reconnect is default */ + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); break; + } default: my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]); return 1; |