@@ -141,7 +141,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
141
141
vertical=0 , line_numbers=1 , column_names=1 ,opt_html=0 ,
142
142
opt_xml=0 ,opt_nopager=1 , opt_outfile=0 , named_cmds= 0 ,
143
143
tty_password= 0 , opt_nobeep=0 , opt_reconnect=1 ,
144
- default_charset_used= 0 , opt_secure_auth= 0 ,
144
+ opt_secure_auth= 0 ,
145
145
default_pager_set= 0 , opt_sigint_ignore= 0 ,
146
146
show_warnings= 0 , executing_query= 0 , interrupted_query= 0 ,
147
147
ignore_spaces= 0 ;
@@ -155,7 +155,7 @@ static char * opt_mysql_unix_port=0;
155
155
static int connect_flag=CLIENT_INTERACTIVE;
156
156
static char *current_host,*current_db,*current_user=0 ,*opt_password=0 ,
157
157
*current_prompt=0 , *delimiter_str= 0 ,
158
- *default_charset= (char *) MYSQL_DEFAULT_CHARSET_NAME ,
158
+ *default_charset= (char *) MYSQL_AUTODETECT_CHARSET_NAME ,
159
159
*opt_init_command= 0 ;
160
160
static char *histfile;
161
161
static char *histfile_tmp;
@@ -1581,9 +1581,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
1581
1581
strmake (mysql_charsets_dir, argument, sizeof (mysql_charsets_dir) - 1 );
1582
1582
charsets_dir = mysql_charsets_dir;
1583
1583
break ;
1584
- case OPT_DEFAULT_CHARSET:
1585
- default_charset_used= 1 ;
1586
- break ;
1587
1584
case OPT_DELIMITER:
1588
1585
if (argument == disabled_my_option)
1589
1586
{
@@ -1788,10 +1785,6 @@ static int get_options(int argc, char **argv)
1788
1785
connect_flag= 0 ; /* Not in interactive mode */
1789
1786
}
1790
1787
1791
- if (strcmp (default_charset, charset_info->csname ) &&
1792
- !(charset_info= get_charset_by_csname (default_charset,
1793
- MY_CS_PRIMARY, MYF (MY_WME))))
1794
- exit (1 );
1795
1788
if (argc > 1 )
1796
1789
{
1797
1790
usage (0 );
@@ -2919,7 +2912,6 @@ com_charset(String *buffer __attribute__((unused)), char *line)
2919
2912
charset_info= new_cs;
2920
2913
mysql_set_character_set (&mysql, charset_info->csname );
2921
2914
default_charset= (char *)charset_info->csname ;
2922
- default_charset_used= 1 ;
2923
2915
put_info (" Charset changed" , INFO_INFO);
2924
2916
}
2925
2917
else put_info (" Charset is not found" , INFO_INFO);
@@ -4243,8 +4235,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
4243
4235
select_limit,max_join_size);
4244
4236
mysql_options (&mysql, MYSQL_INIT_COMMAND, init_command);
4245
4237
}
4246
- if (default_charset_used)
4247
- mysql_options (&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
4238
+
4239
+ mysql_options (&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
4240
+
4248
4241
if (!mysql_real_connect (&mysql, host, user, password,
4249
4242
database, opt_mysql_port, opt_mysql_unix_port,
4250
4243
connect_flag | CLIENT_MULTI_STATEMENTS))
@@ -4259,6 +4252,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
4259
4252
}
4260
4253
return -1 ; // Retryable
4261
4254
}
4255
+
4256
+ charset_info= mysql.charset ;
4257
+
4262
4258
connected=1 ;
4263
4259
#ifndef EMBEDDED_LIBRARY
4264
4260
mysql.reconnect = debug_info_flag; // We want to know if this happens
0 commit comments