From: Date: March 10 2008 4:44pm Subject: bk commit into 5.0 tree (cmiller:1.2572) BUG#34192 List-Archive: http://lists.mysql.com/commits/43692 X-Bug: 34192 Message-Id: <20080310154435.165E78305A@cornsilk.net> Below is the list of changes that have just been committed into a local 5.0 repository of cmiller. When cmiller does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-03-10 11:44:31-04:00, cmiller@stripped +1 -0 Bug#34192: mysqldump from mysql 5.0.51 silently fails on dumping \ databases from 4.0 server Contribution from Arkadiusz Miskiewicz. No CLA required for this size. mysqldump treated a failure to set the results charset as a severe error. Now, don't try to set the charset for the SHOW CREATE TABLE statement, if remote server's version is earlier than 4.1, which means it doesn't support changing charsets. client/mysqldump.c@stripped, 2008-03-10 11:44:29-04:00, cmiller@stripped +19 -6 Don't set the charset for receiving results if the server doesn't support it. diff -Nrup a/client/mysqldump.c b/client/mysqldump.c --- a/client/mysqldump.c 2007-12-04 22:07:00 -05:00 +++ b/client/mysqldump.c 2008-03-10 11:44:29 -04:00 @@ -109,6 +109,7 @@ static char *opt_password=0,*current_us *log_error_file= NULL; static char **defaults_argv= 0; static char compatible_mode_normal_str[255]; +static my_bool server_supports_switching_charsets= TRUE; static ulong opt_compatible_mode= 0; #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 @@ -1111,11 +1112,13 @@ static int connect_to_db(char *host, cha DB_error(&mysql_connection, "when trying to connect"); DBUG_RETURN(1); } - /* - Don't dump SET NAMES with a pre-4.1 server (bug#7997). - */ if (mysql_get_server_version(&mysql_connection) < 40100) + { + /* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */ opt_set_charset= 0; + + server_supports_switching_charsets= FALSE; + } /* As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. @@ -1705,10 +1708,20 @@ static uint get_table_structure(char *ta my_snprintf(buff, sizeof(buff), "show create table %s", result_table); - if (switch_character_set_results(mysql, "binary") || - mysql_query_with_error_report(mysql, &result, buff) || - switch_character_set_results(mysql, default_charset)) + if (server_supports_switching_charsets) + { + if (switch_character_set_results(mysql, "binary") != 0) + DBUG_RETURN(0); + } + + if (mysql_query_with_error_report(mysql, &result, buff) != 0) DBUG_RETURN(0); + + if (server_supports_switching_charsets) + { + if (switch_character_set_results(mysql, default_charset) != 0) + DBUG_RETURN(0); + } if (path) {