diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-24 18:48:58 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-24 18:48:58 +0200 |
commit | 69204571425ed3221e94c7eb1e030c00089bca26 (patch) | |
tree | 3d9cfbc44a057883c7db6bce267c8ebfd5fa9313 /client | |
parent | e3e60a4102d6918e4231e402bef89b1a6b2a20cb (diff) | |
parent | d26aefb0775048128495eaab151ee4118f8f7afd (diff) | |
download | mariadb-git-69204571425ed3221e94c7eb1e030c00089bca26.tar.gz |
Merge with MariaDB 5.1
Diffstat (limited to 'client')
-rwxr-xr-x | client/CMakeLists.txt | 3 | ||||
-rw-r--r-- | client/Makefile.am | 8 | ||||
-rw-r--r-- | client/client_priv.h | 6 | ||||
-rw-r--r-- | client/my_readline.h | 6 | ||||
-rw-r--r-- | client/mysql.cc | 4 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 9 | ||||
-rw-r--r-- | client/mysqladmin.cc | 6 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 9 | ||||
-rw-r--r-- | client/mysqlcheck.c | 8 | ||||
-rw-r--r-- | client/mysqldump.c | 8 | ||||
-rw-r--r-- | client/mysqlimport.c | 12 | ||||
-rw-r--r-- | client/mysqlshow.c | 7 | ||||
-rw-r--r-- | client/mysqlslap.c | 5 | ||||
-rw-r--r-- | client/mysqltest.cc | 52 | ||||
-rw-r--r-- | client/readline.cc | 6 | ||||
-rw-r--r-- | client/sql_string.cc | 13 | ||||
-rw-r--r-- | client/sql_string.h | 6 |
17 files changed, 110 insertions, 58 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index ecfd3a0f0ce..5780da71bef 100755 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,4 +1,5 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (c) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc. +# Use is subject to license terms. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/client/Makefile.am b/client/Makefile.am index f3f964ace7b..4e7fe46d9fc 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright (c) 2000, 2011, Oracle and/or its affiliates # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # This file is public domain and comes with NO WARRANTY of any kind @@ -115,9 +115,9 @@ link_sources: @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \ done; \ for f in $(strings_src) ; do \ - rm -f $(srcdir)/$$f; \ + rm -f $$f; \ @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \ done; \ - rm -f $(srcdir)/my_user.c; \ + rm -f my_user.c; \ @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c; echo timestamp > link_sources; diff --git a/client/client_priv.h b/client/client_priv.h index fe9081c4b91..9ad627f0832 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2001-2006 MySQL AB +/* + Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Common defines for all clients */ diff --git a/client/my_readline.h b/client/my_readline.h index 3376fc81761..30e59b613bc 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* readline for batch mode */ diff --git a/client/mysql.cc b/client/mysql.cc index 03c1e669f60..82ffaa22032 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,5 +1,5 @@ /* Copyright (C) 2000-2009 MySQL AB - Copyright 2000, 2010, Oracle and/or its affiliates. + Copyright 2000, 2010-2011, Oracle and/or its affiliates. Copyright 2000-2010 Monty Program Ab This program is free software; you can redistribute it and/or modify @@ -4386,7 +4386,7 @@ sql_real_connect(char *host,char *database,char *user,char *password, { char init_command[100]; sprintf(init_command, - "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,SQL_MAX_JOIN_SIZE=%lu", + "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,MAX_JOIN_SIZE=%lu", select_limit,max_join_size); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index b67ca5456d7..c6e54cba67b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1,5 +1,7 @@ -/* Copyright (C) 2000 MySQL AB - Copyright (C) 2010 Monty Program Ab +/* + Copyright (C) 2000 MySQL AB + Copyright (c) 2006, 2011, Oracle and/or its affiliates. + Copyright (C) 2010-2011 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include "client_priv.h" #include <sslopt-vars.h> diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 3cc315ce1bc..0716e391ab4 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* maintaince of mysql databases */ diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 5d458090352..c1473b18486 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2001-2004 MySQL AB +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* @@ -1013,7 +1015,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev, passed --short-form, because --short-form disables printing row events. */ - if (!print_event_info->printed_fd_event && !short_form) + if (!print_event_info->printed_fd_event && !short_form && + opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS) { const char* type_str= ev->get_type_str(); if (opt_base64_output_mode == BASE64_OUTPUT_NEVER) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 22f4b70ed81..8bf6cbe8d83 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,5 +1,6 @@ /* Copyright (C) 2000 MySQL AB & Jani Tolonen - Copyright (C) 2010 Monty Program Ab + Copyright (c) 2001, 2011, Oracle and/or its affiliates. + Copyright (C) 2010- 2011 Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,9 +13,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* By Jani Tolonen, 2001-04-20, MySQL Development Team */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #define CHECK_VERSION "2.7.0" diff --git a/client/mysqldump.c b/client/mysqldump.c index ef32026987d..ee376e36e1a 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,4 +1,5 @@ -/* Copyright 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc. +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* mysqldump.c - Dump a tables contents and format to an ASCII file ** @@ -568,7 +570,7 @@ static void short_usage_sub(void) static void usage(void) { print_version(); - puts("By Igor Romanenko, Monty, Jani & Sinisa."); + puts("By Igor Romanenko, Monty, Jani & Sinisa and others."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n"); puts("Dumping structure and contents of MySQL databases and tables."); short_usage_sub(); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 3367eb77cbc..654f19f6f57 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc. +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* ** mysqlimport.c - Imports all given files @@ -198,10 +200,10 @@ static void print_version(void) static void usage(void) { - print_version(); puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n"); - printf("\ + puts("Copyright 2008-2011 Oracle and Monty Program Ab."); + print_version(); + printf("\n\ Loads tables from text files in various formats. The base name of the\n\ text file must be the name of the table that should be used.\n\ If one uses sockets to connect to the MySQL server, the server will open and\n\ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index fafb07cfcbb..e1cbfcb9404 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Show databases, tables or columns */ @@ -255,6 +257,7 @@ static void usage(void) { print_version(); puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); + puts("Copyright 2008-2011 Oracle and Monty Program Ab."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n"); puts("Shows the structure of a MySQL database (databases, tables, and columns).\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index c38380c7306..196cdc6f394 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc. +/* + Copyright (c) 2005, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA original idea: Brian Aker via playing with ab for too many years coded by: Patrick Galbraith diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 772dd69c089..84cbd314b4a 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -12,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* mysqltest @@ -30,6 +31,7 @@ Monty Jani Holyfoot + And many others */ #define MTEST_VERSION "3.3" @@ -471,6 +473,7 @@ TYPELIB command_typelib= {array_elements(command_names),"", command_names, 0}; DYNAMIC_STRING ds_res; +struct st_command *curr_command= 0; char builtin_echo[FN_REFLEN]; @@ -2285,9 +2288,16 @@ void var_query_set(VAR *var, const char *query, const char** query_end) init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); do_eval(&ds_query, query, end, FALSE); - if (mysql_real_query(mysql, ds_query.str, ds_query.length)) - die("Error running query '%s': %d %s", ds_query.str, - mysql_errno(mysql), mysql_error(mysql)); + if (mysql_real_query(mysql, ds_query.str, ds_query.length)) + { + handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); + /* If error was acceptable, return empty string */ + dynstr_free(&ds_query); + eval_expr(var, "", 0); + DBUG_VOID_RETURN; + } + if (!(res= mysql_store_result(mysql))) die("Query '%s' didn't return a result set", ds_query.str); dynstr_free(&ds_query); @@ -2388,8 +2398,15 @@ void var_set_query_get_value(struct st_command *command, VAR *var) /* Run the query */ if (mysql_real_query(mysql, ds_query.str, ds_query.length)) - die("Error running query '%s': %d %s", ds_query.str, - mysql_errno(mysql), mysql_error(mysql)); + { + handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); + /* If error was acceptable, return empty string */ + dynstr_free(&ds_query); + eval_expr(var, "", 0); + DBUG_VOID_RETURN; + } + if (!(res= mysql_store_result(mysql))) die("Query '%s' didn't return a result set", ds_query.str); @@ -4540,13 +4557,14 @@ static int my_kill(int pid, int sig) command called command DESCRIPTION - shutdown [<timeout>] + shutdown_server [<timeout>] */ void do_shutdown_server(struct st_command *command) { - int timeout=60, pid; + long timeout=60; + int pid; DYNAMIC_STRING ds_pidfile_name; MYSQL* mysql = cur_con->mysql; static DYNAMIC_STRING ds_timeout; @@ -4561,8 +4579,9 @@ void do_shutdown_server(struct st_command *command) if (ds_timeout.length) { - timeout= atoi(ds_timeout.str); - if (timeout == 0) + char* endptr; + timeout= strtol(ds_timeout.str, &endptr, 10); + if (*endptr != '\0') die("Illegal argument for timeout: '%s'", ds_timeout.str); } dynstr_free(&ds_timeout); @@ -4604,7 +4623,7 @@ void do_shutdown_server(struct st_command *command) DBUG_PRINT("info", ("Process %d does not exist anymore", pid)); DBUG_VOID_RETURN; } - DBUG_PRINT("info", ("Sleeping, timeout: %d", timeout)); + DBUG_PRINT("info", ("Sleeping, timeout: %ld", timeout)); my_sleep(1000000L); } @@ -5235,7 +5254,8 @@ void do_connect(struct st_command *command) int con_port= opt_port; char *con_options; my_bool con_ssl= 0, con_compress= 0; - my_bool con_pipe= 0, con_shm= 0; + my_bool con_pipe= 0; + my_bool con_shm __attribute__ ((unused))= 0; struct st_connection* con_slot; static DYNAMIC_STRING ds_connection_name; @@ -6215,7 +6235,7 @@ void print_version(void) void usage() { print_version(); - printf("MySQL AB, by Sasha, Matt, Monty & Jani\n"); + printf("MySQL AB, by Sasha, Matt, Monty & Jani and others\n"); printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); printf("Runs a test against the mysql server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); @@ -8276,6 +8296,8 @@ int main(int argc, char **argv) { command->last_argument= command->first_argument; processed = 1; + /* Need to remember this for handle_error() */ + curr_command= command; switch (command->type) { case Q_CONNECT: do_connect(command); @@ -9869,7 +9891,7 @@ int find_set(REP_SETS *sets,REP_SET *find) return i; } } - return i; /* return new postion */ + return i; /* return new position */ } /* find if there is a found_set with same table_offset & found_offset @@ -9889,7 +9911,7 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset) found_set[i].table_offset=table_offset; found_set[i].found_offset=found_offset; found_sets++; - return -i-2; /* return new postion */ + return -i-2; /* return new position */ } /* Return 1 if regexp starts with \b or ends with \b*/ diff --git a/client/readline.cc b/client/readline.cc index 4edccebef39..cb020d62241 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* + Copyright (c) 2000, 2011, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* readline for batch mode */ diff --git a/client/sql_string.cc b/client/sql_string.cc index 9fa8fae2860..3afc69b3ea6 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* + Copyright (c) 2000, 2010, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is originally from the mysql distribution. Coded by monty */ @@ -107,7 +109,7 @@ bool String::set(ulonglong num, CHARSET_INFO *cs) bool String::set(double num,uint decimals, CHARSET_INFO *cs) { - char buff[331]; + char buff[FLOATING_POINT_BUFFER]; uint dummy_errors; str_charset=cs; @@ -176,7 +178,10 @@ end: #else #ifdef HAVE_SNPRINTF buff[sizeof(buff)-1]=0; // Safety - snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num); + IF_DBUG(int num_chars= ) + snprintf(buff, sizeof(buff)-1, "%.*f",(int) decimals, num); + DBUG_ASSERT(num_chars > 0); + DBUG_ASSERT(num_chars < (int) sizeof(buff)); #else sprintf(buff,"%.*f",(int) decimals,num); #endif diff --git a/client/sql_string.h b/client/sql_string.h index a0f1f5b3a6c..6d8269a4b31 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* + Copyright (c) 2000, 2010, Oracle and/or its affiliates This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +12,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* This file is originally from the mysql distribution. Coded by monty */ |