1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.6' into 10.7

This commit is contained in:
Sergei Golubchik
2022-02-10 21:16:50 +01:00
26 changed files with 5576 additions and 39 deletions

View File

@@ -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=");
{