diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-02-10 21:07:03 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-02-10 21:07:03 +0100 |
commit | e3894f5d397722dd50fb91dbbdbad3aaf017a4b0 (patch) | |
tree | 5d10a3e673c780b1588cda82e88a3d899345c416 /client/mysql_upgrade.c | |
parent | cce994057bf7e2bdb62686075de03aeb5db4bbda (diff) | |
parent | 9aa3564e8a06c3d2027fc514213ecf42b049b06e (diff) | |
download | mariadb-git-e3894f5d397722dd50fb91dbbdbad3aaf017a4b0.tar.gz |
Merge branch '10.5 into 10.6mariadb-10.6.7
Diffstat (limited to 'client/mysql_upgrade.c')
-rw-r--r-- | client/mysql_upgrade.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 078b96dcba1..68f82f6f8e0 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -122,7 +122,6 @@ static struct my_option my_long_options[]= &opt_not_used, &opt_not_used, 0 , GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#define PASSWORD_OPT 12 {"password", 'p', "Password to use when connecting to server. If password is not given," " it's solicited on the tty.", &opt_password,&opt_password, @@ -154,7 +153,6 @@ static struct my_option my_long_options[]= {"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.", &opt_systables_only, &opt_systables_only, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#define USER_OPT (array_elements(my_long_options) - 6) {"user", 'u', "User for login.", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.", @@ -262,11 +260,11 @@ static void print_error(const char *error_msg, DYNAMIC_STRING *output) */ static void add_one_option_cmd_line(DYNAMIC_STRING *ds, - const struct my_option *opt, - const char* arg) + const char *name, + const char *arg) { dynstr_append(ds, "--"); - dynstr_append(ds, opt->name); + dynstr_append(ds, name); if (arg) { dynstr_append(ds, "="); @@ -276,10 +274,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds, } static void add_one_option_cnf_file(DYNAMIC_STRING *ds, - const struct my_option *opt, - const char* arg) + const char *name, + const char *arg) { - dynstr_append(ds, opt->name); + dynstr_append(ds, name); if (arg) { dynstr_append(ds, "="); @@ -327,7 +325,7 @@ get_one_option(const struct my_option *opt, const char *argument, */ char *start= (char*) argument; /* Add password to ds_args before overwriting the arg with x's */ - add_one_option_cnf_file(&ds_args, opt, argument); + add_one_option_cnf_file(&ds_args, opt->name, argument); while (*argument) *(char*)argument++= 'x'; /* Destroy argument */ if (*start) @@ -387,7 +385,7 @@ get_one_option(const struct my_option *opt, const char *argument, case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_DEFAULT_AUTH: /* --default-auth */ - add_one_option_cmd_line(&conn_args, opt, argument); + add_one_option_cmd_line(&conn_args, opt->name, argument); break; } @@ -398,7 +396,7 @@ get_one_option(const struct my_option *opt, const char *argument, it can be passed on to "mysql" and "mysqlcheck" Save it in the ds_args string */ - add_one_option_cnf_file(&ds_args, opt, argument); + add_one_option_cnf_file(&ds_args, opt->name, argument); } return 0; } @@ -1435,12 +1433,10 @@ int main(int argc, char **argv) { opt_password= get_tty_password(NullS); /* add password to defaults file */ - add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password); - DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0); + add_one_option_cnf_file(&ds_args, "password", opt_password); } /* add user to defaults file */ - add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user); - DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0); + add_one_option_cnf_file(&ds_args, "user", opt_user); cnf_file_path= strmov(defaults_file, "--defaults-file="); { |