mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
[MDEV-14978] Client programs to use $MARIADB_HOST consistently
Only `mysql` client program was using $MYSQL_HOST as the default host. Add the same feature in most other client programs but using $MARIADB_HOST instead. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
committed by
Andrew Hutchings
parent
383d1f90dd
commit
eedbb901e5
@@ -1738,8 +1738,9 @@ static struct my_option my_long_options[] =
|
||||
{"force", 'f',
|
||||
"Continue even if we get an SQL error. Sets abort-source-on-error to 0",
|
||||
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"host", 'h', "Connect to host.", ¤t_host,
|
||||
¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"host", 'h', "Connect to host. Defaults in the following order: "
|
||||
"$MARIADB_HOST, $MYSQL_HOST, and then localhost",
|
||||
¤t_host, ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ignore-spaces", 'i', "Ignore space after function names.",
|
||||
@@ -2127,7 +2128,10 @@ static int get_options(int argc, char **argv)
|
||||
int ho_error;
|
||||
MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
|
||||
|
||||
tmp= (char *) getenv("MYSQL_HOST");
|
||||
//MARIADB_HOST will be preferred over MYSQL_HOST.
|
||||
tmp= getenv("MARIADB_HOST");
|
||||
if (tmp == NULL)
|
||||
tmp= getenv("MYSQL_HOST");
|
||||
if (tmp)
|
||||
current_host= my_strdup(PSI_NOT_INSTRUMENTED, tmp, MYF(MY_WME));
|
||||
|
||||
|
Reference in New Issue
Block a user