diff options
author | Bjorn Munch <Bjorn.Munch@sun.com> | 2009-05-29 13:04:02 +0200 |
---|---|---|
committer | Bjorn Munch <Bjorn.Munch@sun.com> | 2009-05-29 13:04:02 +0200 |
commit | cf6aeea48ceb32d0f67eaecaeefb5f33568de8fc (patch) | |
tree | e3b58b555dafa4e196c711fe27f096882e38438a /client | |
parent | 4404b6a915a96104c327118cc6fafb43b59d9b96 (diff) | |
parent | 67bbc74853dcca3864f3d82330d5ee9983ec4b45 (diff) | |
download | mariadb-git-cf6aeea48ceb32d0f67eaecaeefb5f33568de8fc.tar.gz |
merge from 5.1 main
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 35 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 4 | ||||
-rw-r--r-- | client/mysqladmin.cc | 14 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 5 | ||||
-rw-r--r-- | client/mysqlcheck.c | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 4 | ||||
-rw-r--r-- | client/mysqlimport.c | 2 | ||||
-rw-r--r-- | client/mysqlshow.c | 2 | ||||
-rw-r--r-- | client/mysqlslap.c | 2 | ||||
-rw-r--r-- | client/mysqltest.cc | 4 |
10 files changed, 56 insertions, 18 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 46141cd975f..860fc3a5f6e 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -143,7 +143,8 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, default_charset_used= 0, opt_secure_auth= 0, default_pager_set= 0, opt_sigint_ignore= 0, - show_warnings= 0, executing_query= 0, interrupted_query= 0; + show_warnings= 0, executing_query= 0, interrupted_query= 0, + ignore_spaces= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool column_types_flag; static my_bool preserve_comments= 0; @@ -1183,7 +1184,12 @@ int main(int argc,char *argv[]) histfile= 0; } } - if (histfile) + + /* We used to suggest setting MYSQL_HISTFILE=/dev/null. */ + if (histfile && strncmp(histfile, "/dev/null", 10) == 0) + histfile= NULL; + + if (histfile && histfile[0]) { if (verbose) tee_fprintf(stdout, "Reading history-file %s\n",histfile); @@ -1218,7 +1224,8 @@ sig_handler mysql_end(int sig) { mysql_close(&mysql); #ifdef HAVE_READLINE - if (!status.batch && !quick && !opt_html && !opt_xml && histfile) + if (!status.batch && !quick && !opt_html && !opt_xml && + histfile && histfile[0]) { /* write-history */ if (verbose) @@ -1345,7 +1352,7 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log", (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag, @@ -1372,8 +1379,9 @@ static struct my_option my_long_options[] = {"no-named-commands", 'g', "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"ignore-spaces", 'i', "Ignore space after function names.", + (uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", (uchar**) &opt_local_infile, (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1794,6 +1802,10 @@ static int get_options(int argc, char **argv) my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; if (debug_check_flag) my_end_arg= MY_CHECK_ERROR; + + if (ignore_spaces) + connect_flag|= CLIENT_IGNORE_SPACE; + return(0); } @@ -3381,9 +3393,12 @@ print_table_data_html(MYSQL_RES *result) { while((field = mysql_fetch_field(result))) { - tee_fprintf(PAGER, "<TH>%s</TH>", (field->name ? - (field->name[0] ? field->name : - " ") : "NULL")); + tee_fputs("<TH>", PAGER); + if (field->name && field->name[0]) + xmlencode_print(field->name, field->name_length); + else + tee_fputs(field->name ? " " : "NULL", PAGER); + tee_fputs("</TH>", PAGER); } (void) tee_fputs("</TR>", PAGER); } @@ -3396,7 +3411,7 @@ print_table_data_html(MYSQL_RES *result) for (uint i=0; i < mysql_num_fields(result); i++) { (void) tee_fputs("<TD>", PAGER); - safe_put_field(cur[i],lengths[i]); + xmlencode_print(cur[i], lengths[i]); (void) tee_fputs("</TD>", PAGER); } (void) tee_fputs("</TR>", PAGER); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 190bb2383e9..cbc60d8acad 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -115,11 +115,11 @@ static struct my_option my_long_options[]= #endif {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#include <sslopt-longopts.h> {"tmpdir", 't', "Directory for temporary files", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User for login if not current user.", (uchar**) &opt_user, (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#include <sslopt-longopts.h> {"verbose", 'v', "Display more output about the process", (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -231,6 +231,8 @@ get_one_option(int optid, const struct my_option *opt, break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password tty_password= 1; add_option= FALSE; if (argument) diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index df0dc1e7049..9865b67bb3b 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -232,6 +232,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_count_iterations= 1; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; @@ -677,10 +679,16 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) pos=argv[1]; for (;;) { - if (mysql_kill(mysql,(ulong) atol(pos))) + /* We don't use mysql_kill(), since it only handles 32-bit IDs. */ + char buff[26], *out; /* "KILL " + max 20 digs + NUL */ + out= strxmov(buff, "KILL ", NullS); + ullstr(strtoull(pos, NULL, 0), out); + + if (mysql_query(mysql, buff)) { - my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags, - atol(pos), mysql_error(mysql)); + /* out still points to just the number */ + my_printf_error(0, "kill failed on %s; error: '%s'", error_flags, + out, mysql_error(mysql)); error=1; } if (!(pos=strchr(pos,','))) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 1621db5ded8..2cf91ec7da5 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1226,6 +1226,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), one_database = 1; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); @@ -1529,8 +1531,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, If reading from a remote host, ensure the temp_buf for the Log_event class is pointing to the incoming stream. */ - if (remote_opt) - ev->register_temp_buf((char*) net->read_pos + 1); + ev->register_temp_buf((char *) net->read_pos + 1); Log_event_type type= ev->get_type_code(); if (glob_description_event->binlog_version >= 3 || diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index d2edd084c57..1bdb28f5a11 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -286,6 +286,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), what_to_do= DO_UPGRADE; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start = argument; diff --git a/client/mysqldump.c b/client/mysqldump.c index 5a1fa3cc090..323376dd8bf 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -221,7 +221,7 @@ static struct my_option my_long_options[] = (uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"compact", OPT_COMPACT, - "Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks", + "Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset", (uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"complete-insert", 'c', "Use complete insert statements.", @@ -702,6 +702,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 09ba27b287a..ec418244f3d 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -221,6 +221,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 0e696aed211..e401d6cad8f 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -281,6 +281,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_verbose++; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start=argument; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index b8515289df5..4cf8c7204ed 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -712,6 +712,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), verbose++; break; case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { char *start= argument; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 547565d4a83..a39cabdc64d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5716,11 +5716,11 @@ static struct my_option my_long_options[] = {"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select", (uchar**) &sp_protocol, (uchar**) &sp_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#include "sslopt-longopts.h" {"tail-lines", OPT_TAIL_LINES, "Number of lines of the resul to include in a failure report", (uchar**) &opt_tail_lines, (uchar**) &opt_tail_lines, 0, GET_INT, REQUIRED_ARG, 0, 0, 10000, 0, 0, 0}, -#include "sslopt-longopts.h" {"test-file", 'x', "Read test from/in this file (default stdin).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"timer-file", 'm', "File where the timing in micro seconds is stored.", @@ -5854,6 +5854,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case 'p': + if (argument == disabled_my_option) + argument= (char*) ""; // Don't require password if (argument) { my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR)); |