From 3fe1d299ec01e58ae5afc03dc269a70054ec8865 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 10:28:29 -0700 Subject: [PATCH 1/2] Fix support for -i (--ignore-spaces) in the mysql command line application, which didn't actually do anything. (Bug #39101) --- client/mysql.cc | 11 ++++++++--- mysql-test/r/mysql.result | 6 ++++++ mysql-test/t/mysql.test | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 93aab390e5a..89f1f28bb1b 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -140,7 +140,7 @@ static my_bool info_flag=0,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; + show_warnings= 0, ignore_spaces= 0; static volatile int executing_query= 0, interrupted_query= 0; static my_bool preserve_comments= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; @@ -1350,8 +1350,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.", + (gptr*) &ignore_spaces, (gptr*) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", (gptr*) &opt_local_infile, (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1749,6 +1750,10 @@ static int get_options(int argc, char **argv) } if (tty_password) opt_password= get_tty_password(NullS); + + if (ignore_spaces) + connect_flag|= CLIENT_IGNORE_SPACE; + return(0); } diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 10537f6da16..5f315bca9c2 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -192,4 +192,10 @@ delimiter 1 1 1 +COUNT (*) +1 +COUNT (*) +1 +COUNT (*) +1 End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 12431e26596..0425b4b9022 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -341,4 +341,11 @@ EOF remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql; +# +# Bug #39101: client -i (--ignore-spaces) option does not seem to work +# +--exec $MYSQL -i -e "SELECT COUNT (*)" +--exec $MYSQL --ignore-spaces -e "SELECT COUNT (*)" +--exec $MYSQL -b -i -e "SELECT COUNT (*)" + --echo End of 5.0 tests From df3887f913fa22290e3c05074b7eab1473da1d61 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Thu, 7 May 2009 11:17:07 -0700 Subject: [PATCH 2/2] The get_date() function in mysys interpreted the GETDATE_GMT option backwards, which resulted in the incorrect time being reported at the end of mysqldump. (Bug #44424, patch by Andrew Hutchings) --- mysys/mf_getdate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysys/mf_getdate.c b/mysys/mf_getdate.c index 1ced312848e..247172014d8 100644 --- a/mysys/mf_getdate.c +++ b/mysys/mf_getdate.c @@ -45,15 +45,15 @@ void get_date(register my_string to, int flag, time_t date) skr=date ? (time_t) date : time((time_t*) 0); #if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT) if (flag & GETDATE_GMT) - localtime_r(&skr,&tm_tmp); - else gmtime_r(&skr,&tm_tmp); + else + localtime_r(&skr,&tm_tmp); start_time= &tm_tmp; #else if (flag & GETDATE_GMT) - start_time= localtime(&skr); - else start_time= gmtime(&skr); + else + start_time= localtime(&skr); #endif if (flag & GETDATE_SHORT_DATE) sprintf(to,"%02d%02d%02d",