diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-19 20:55:37 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-19 20:55:37 +0200 |
commit | c07325f932abef2032b2e56532f6cb615e2a1161 (patch) | |
tree | 754ca158e45ebc014e5cbeaf4c3e7581f9575d76 /client | |
parent | 7f8187bc432f79afe4c0549d68845a68e6c159ab (diff) | |
parent | 2ae83affef5a4d89f38272db31a400f968279a7a (diff) | |
download | mariadb-git-c07325f932abef2032b2e56532f6cb615e2a1161.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'client')
-rw-r--r-- | client/CMakeLists.txt | 2 | ||||
-rw-r--r-- | client/client_priv.h | 2 | ||||
-rw-r--r-- | client/completion_hash.cc | 2 | ||||
-rw-r--r-- | client/completion_hash.h | 2 | ||||
-rw-r--r-- | client/echo.c | 2 | ||||
-rw-r--r-- | client/my_readline.h | 2 | ||||
-rw-r--r-- | client/mysql.cc | 2 | ||||
-rw-r--r-- | client/mysql_plugin.c | 10 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 2 | ||||
-rw-r--r-- | client/mysqladmin.cc | 2 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 2 | ||||
-rw-r--r-- | client/mysqlcheck.c | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 70 | ||||
-rw-r--r-- | client/mysqlimport.c | 15 | ||||
-rw-r--r-- | client/mysqlshow.c | 2 | ||||
-rw-r--r-- | client/mysqlslap.c | 2 | ||||
-rw-r--r-- | client/mysqltest.cc | 2 | ||||
-rw-r--r-- | client/readline.cc | 2 | ||||
-rw-r--r-- | client/sql_string.cc.dontuse | 2 | ||||
-rw-r--r-- | client/sql_string.h.dontuse | 2 |
20 files changed, 68 insertions, 61 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e9640fd4365..96346808a62 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -12,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include diff --git a/client/client_priv.h b/client/client_priv.h index 54fed943313..5b6b31ccda9 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* Common defines for all clients */ diff --git a/client/completion_hash.cc b/client/completion_hash.cc index be89dd41441..0d88aa9b15e 100644 --- a/client/completion_hash.cc +++ b/client/completion_hash.cc @@ -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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* Quick & light hash implementation for tab completion purposes * diff --git a/client/completion_hash.h b/client/completion_hash.h index 70c2cf1b371..57483e0f8b8 100644 --- a/client/completion_hash.h +++ b/client/completion_hash.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301, USA */ + MA 02110-1335 USA */ #ifndef _HASH_ #define _HASH_ diff --git a/client/echo.c b/client/echo.c index 2a3cb915d23..90a538faf62 100644 --- a/client/echo.c +++ b/client/echo.c @@ -12,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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* echo is a replacement for the "echo" command builtin to cmd.exe diff --git a/client/my_readline.h b/client/my_readline.h index 57537308fed..ec43d81f2c0 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -15,7 +15,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* readline for batch mode */ diff --git a/client/mysql.cc b/client/mysql.cc index 3ab3c1192b7..f1311991afe 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -13,7 +13,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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* mysql command tool * Commands compatible with mSQL by David J. Hughes diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 40560613a89..8e5897b4b86 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -12,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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ #include <my_global.h> @@ -321,7 +321,7 @@ static int get_default_values() int ret= 0; FILE *file= 0; - bzero(tool_path, FN_REFLEN); + memset(tool_path, 0, FN_REFLEN); if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path))) goto exit; else @@ -334,9 +334,9 @@ static int get_default_values() char *format_str= 0; if (has_spaces(tool_path) || has_spaces(defaults_file)) - format_str = "\"%s mysqld > %s\""; + format_str = "\"%s --mysqld > %s\""; else - format_str = "%s mysqld > %s"; + format_str = "%s --mysqld > %s"; snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, add_quotes(tool_path), add_quotes(defaults_file)); @@ -347,7 +347,7 @@ static int get_default_values() } #else snprintf(defaults_cmd, sizeof(defaults_cmd), - "%s mysqld > %s", tool_path, defaults_file); + "%s --mysqld > %s", tool_path, defaults_file); #endif /* Execute the command */ diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index ee10996d678..59ec622ad8c 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "client_priv.h" diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 5c9f9cd05f3..3ad6ae40ab2 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -13,7 +13,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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* maintaince of mysql databases */ diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index e31058f3477..11566a8b628 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index e4ab18d52c4..7eec7ee9f4f 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* By Jani Tolonen, 2001-04-20, MySQL Development Team */ diff --git a/client/mysqldump.c b/client/mysqldump.c index 48eb2dfdb5e..f1746dcabc4 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -13,7 +13,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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /* mysqldump.c - Dump a tables contents and format to an ASCII file @@ -3310,7 +3310,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs, char name_buff[NAME_LEN * 4 + 3]; const char *xml_msg= "\nWarning! mysqldump being run against old server " - "that does not\nsupport 'SHOW CREATE TRIGGERS' " + "that does not\nsupport 'SHOW CREATE TRIGGER' " "statement. Skipping..\n"; DBUG_ENTER("dump_trigger_old"); @@ -3469,12 +3469,14 @@ static int dump_triggers_for_table(char *table_name, char *db_name) char db_cl_name[MY_CS_NAME_SIZE]; int ret= TRUE; + /* Servers below 5.1.21 do not support SHOW CREATE TRIGGER */ + const int use_show_create_trigger= mysql_get_server_version(mysql) >= 50121; DBUG_ENTER("dump_triggers_for_table"); DBUG_PRINT("enter", ("db: %s, table_name: %s", db_name, table_name)); - if (path && !(sql_file= open_sql_file_for_table(table_name, - O_WRONLY | O_APPEND))) + if (path && + !(sql_file= open_sql_file_for_table(table_name, O_WRONLY | O_APPEND))) DBUG_RETURN(1); /* Do not use ANSI_QUOTES on triggers in dump */ @@ -3490,11 +3492,15 @@ static int dump_triggers_for_table(char *table_name, char *db_name) /* Get list of triggers. */ - my_snprintf(query_buff, sizeof(query_buff), - "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS " - "WHERE EVENT_OBJECT_SCHEMA = DATABASE() AND " - "EVENT_OBJECT_TABLE = %s", - quote_for_equal(table_name, name_buff)); + if (use_show_create_trigger) + my_snprintf(query_buff, sizeof(query_buff), + "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS " + "WHERE EVENT_OBJECT_SCHEMA = DATABASE() AND " + "EVENT_OBJECT_TABLE = %s", + quote_for_equal(table_name, name_buff)); + else + my_snprintf(query_buff, sizeof(query_buff), "SHOW TRIGGERS LIKE %s", + quote_for_like(table_name, name_buff)); if (mysql_query_with_error_report(mysql, &show_triggers_rs, query_buff)) goto done; @@ -3510,35 +3516,28 @@ static int dump_triggers_for_table(char *table_name, char *db_name) while ((row= mysql_fetch_row(show_triggers_rs))) { - - my_snprintf(query_buff, sizeof (query_buff), - "SHOW CREATE TRIGGER %s", - quote_name(row[0], name_buff, TRUE)); - - if (mysql_query(mysql, query_buff)) + if (use_show_create_trigger) { - /* - mysqldump is being run against old server, that does not support - SHOW CREATE TRIGGER statement. We should use SHOW TRIGGERS output. + MYSQL_RES *show_create_trigger_rs; - NOTE: the dump may be incorrect, as old SHOW TRIGGERS does not - provide all the necessary information to restore trigger properly. - */ + my_snprintf(query_buff, sizeof (query_buff), "SHOW CREATE TRIGGER %s", + quote_name(row[0], name_buff, TRUE)); - dump_trigger_old(sql_file, show_triggers_rs, &row, table_name); - } - else - { - MYSQL_RES *show_create_trigger_rs= mysql_store_result(mysql); - - int error= (!show_create_trigger_rs || - dump_trigger(sql_file, show_create_trigger_rs, db_name, - db_cl_name)); - mysql_free_result(show_create_trigger_rs); - if (error) + if (mysql_query_with_error_report(mysql, &show_create_trigger_rs, + query_buff)) goto done; + else + { + int error= (!show_create_trigger_rs || + dump_trigger(sql_file, show_create_trigger_rs, db_name, + db_cl_name)); + mysql_free_result(show_create_trigger_rs); + if (error) + goto done; + } } - + else + dump_trigger_old(sql_file, show_triggers_rs, &row, table_name); } if (opt_xml) @@ -4286,7 +4285,8 @@ static int dump_tablespaces(char* ts_where) " EXTRA" " FROM INFORMATION_SCHEMA.FILES" " WHERE FILE_TYPE = 'UNDO LOG'" - " AND FILE_NAME IS NOT NULL", + " AND FILE_NAME IS NOT NULL" + " AND LOGFILE_GROUP_NAME IS NOT NULL", 256, 1024); if(ts_where) { @@ -4301,7 +4301,7 @@ static int dump_tablespaces(char* ts_where) } dynstr_append_checked(&sqlbuf, " GROUP BY LOGFILE_GROUP_NAME, FILE_NAME" - ", ENGINE" + ", ENGINE, TOTAL_EXTENTS, INITIAL_SIZE" " ORDER BY LOGFILE_GROUP_NAME"); if (mysql_query(mysql, sqlbuf.str) || diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 977e0e6ca1e..3e250bdd9ed 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* @@ -48,8 +48,8 @@ static char *add_load_option(char *ptr,const char *object, const char *statement); static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0, - replace=0,silent=0,ignore=0,opt_compress=0, - opt_low_priority= 0, tty_password= 0; + replace, silent, ignore, ignore_foreign_keys, + opt_compress, opt_low_priority, tty_password; static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0; static char *opt_password=0, *current_user=0, @@ -119,6 +119,10 @@ static struct my_option my_long_options[] = ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ignore", 'i', "If duplicate unique key was found, keep old row.", &ignore, &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"ignore-foreign-keys", 'k', + "Disable foreign key checks while importing the data.", + &ignore_foreign_keys, &ignore_foreign_keys, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, {"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", &opt_ignore_lines, &opt_ignore_lines, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -477,6 +481,9 @@ static MYSQL *db_connect(char *host, char *database, ignore_errors=0; db_error(mysql); } + if (ignore_foreign_keys) + mysql_query(mysql, "set foreign_key_checks= 0;"); + return mysql; } @@ -502,8 +509,8 @@ static void safe_exit(int error, MYSQL *mysql) if (mysql) mysql_close(mysql); - free_defaults(argv_to_free); mysql_library_end(); + free_defaults(argv_to_free); my_free(opt_password); if (error) sf_leaking_memory= 1; /* dirty exit, some threads are still running */ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index a6108ef4fc1..54c2a6e39fa 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* Show databases, tables or columns */ diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 8c79da88e41..3339acce314 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -13,7 +13,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 80d4d70be2c..be4080384c4 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -12,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* mysqltest diff --git a/client/readline.cc b/client/readline.cc index 23b1f8d7ac7..12df8b312ad 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -12,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* readline for batch mode */ diff --git a/client/sql_string.cc.dontuse b/client/sql_string.cc.dontuse index 65b14e36cd1..72736ef5511 100644 --- a/client/sql_string.cc.dontuse +++ b/client/sql_string.cc.dontuse @@ -12,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* This file is originally from the mysql distribution. Coded by monty */ diff --git a/client/sql_string.h.dontuse b/client/sql_string.h.dontuse index 94f844dc689..e5bf8e0b67c 100644 --- a/client/sql_string.h.dontuse +++ b/client/sql_string.h.dontuse @@ -14,7 +14,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* This file is originally from the mysql distribution. Coded by monty */ |