Commit 0f00947b authored by unknown's avatar unknown

Add support for --default-character-set to mysqladmin (Bug #7524)


client/mysqladmin.cc:
  Handle default-character-set being specified
parent d9adebfa
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
char *host= NULL, *user= 0, *opt_password= 0; char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= NULL;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH]; char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN]; char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR]; ulonglong last_values[MAX_MYSQL_VAR];
...@@ -145,6 +146,9 @@ static struct my_option my_long_options[] = ...@@ -145,6 +146,9 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir, "Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR, {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
...@@ -343,6 +347,8 @@ int main(int argc,char *argv[]) ...@@ -343,6 +347,8 @@ int main(int argc,char *argv[])
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (default_charset)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (sql_connect(&mysql, option_wait)) if (sql_connect(&mysql, option_wait))
{ {
unsigned int err= mysql_errno(&mysql); unsigned int err= mysql_errno(&mysql);
......
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