Commit 8c1ba819 authored by cmiller@zippy.cornsilk.net's avatar cmiller@zippy.cornsilk.net

Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug34192/my51-bug34192

into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-build
parents a2e9ef37 e0af8674
...@@ -113,6 +113,8 @@ static char *opt_password=0,*current_user=0, ...@@ -113,6 +113,8 @@ static char *opt_password=0,*current_user=0,
*log_error_file= NULL; *log_error_file= NULL;
static char **defaults_argv= 0; static char **defaults_argv= 0;
static char compatible_mode_normal_str[255]; static char compatible_mode_normal_str[255];
/* Server supports character_set_results session variable? */
static my_bool server_supports_switching_charsets= TRUE;
static ulong opt_compatible_mode= 0; static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
...@@ -1239,11 +1241,27 @@ static void restore_time_zone(FILE *sql_file, ...@@ -1239,11 +1241,27 @@ static void restore_time_zone(FILE *sql_file,
} }
/**
Switch charset for results to some specified charset. If the server does not
support character_set_results variable, nothing can be done here. As for
whether something should be done here, future new callers of this function
should be aware that the server lacking the facility of switching charsets is
treated as success.
@note If the server lacks support, then nothing is changed and no error
condition is returned.
@returns whether there was an error or not
*/
static int switch_character_set_results(MYSQL *mysql, const char *cs_name) static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
{ {
char query_buffer[QUERY_LENGTH]; char query_buffer[QUERY_LENGTH];
size_t query_length; size_t query_length;
/* Server lacks facility. This is not an error, by arbitrary decision . */
if (!server_supports_switching_charsets)
return FALSE;
query_length= my_snprintf(query_buffer, query_length= my_snprintf(query_buffer,
sizeof (query_buffer), sizeof (query_buffer),
"SET SESSION character_set_results = '%s'", "SET SESSION character_set_results = '%s'",
...@@ -1457,11 +1475,14 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1457,11 +1475,14 @@ static int connect_to_db(char *host, char *user,char *passwd)
DB_error(&mysql_connection, "when trying to connect"); DB_error(&mysql_connection, "when trying to connect");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/*
Don't dump SET NAMES with a pre-4.1 server (bug#7997).
*/
if (mysql_get_server_version(&mysql_connection) < 40100) 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; opt_set_charset= 0;
/* Don't switch charsets for 4.1 and earlier. (bug#34192). */
server_supports_switching_charsets= FALSE;
}
/* /*
As we're going to set SQL_MODE, it would be lost on reconnect, so we As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect. cannot reconnect.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment