summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc26
-rw-r--r--client/mysql_upgrade.c6
-rw-r--r--client/mysqladmin.cc7
-rw-r--r--client/mysqlbinlog.cc4
-rw-r--r--client/mysqlcheck.c5
-rw-r--r--client/mysqldump.c3
-rw-r--r--client/mysqlimport.c3
-rw-r--r--client/mysqlshow.c3
-rw-r--r--client/mysqlslap.c6
-rw-r--r--client/mysqltest.cc14
10 files changed, 25 insertions, 52 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 19c5dd4e6a9..cb5c2318698 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1174,11 +1174,7 @@ int main(int argc,char *argv[])
close(stdout_fileno_copy); /* Clean up dup(). */
}
- if (load_defaults("my",load_default_groups,&argc,&argv))
- {
- my_end(0);
- exit(1);
- }
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv;
if ((status.exit_status= get_options(argc, (char **) argv)))
{
@@ -1231,15 +1227,17 @@ int main(int argc,char *argv[])
window_resize(0);
#endif
- put_info("Welcome to the MariaDB monitor. Commands end with ; or \\g.",
- INFO_INFO);
- my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(),
- "Your %s connection id is %lu\nServer version: %s\n",
- mysql_get_server_name(&mysql),
- mysql_thread_id(&mysql), server_version_string(&mysql));
- put_info((char*) glob_buffer.ptr(),INFO_INFO);
-
- put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
+ if (!status.batch)
+ {
+ put_info("Welcome to the MariaDB monitor. Commands end with ; or \\g.",
+ INFO_INFO);
+ my_snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(),
+ "Your %s connection id is %lu\nServer version: %s\n",
+ mysql_get_server_name(&mysql),
+ mysql_thread_id(&mysql), server_version_string(&mysql));
+ put_info((char*) glob_buffer.ptr(),INFO_INFO);
+ put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
+ }
#ifdef HAVE_READLINE
initialize_readline((char*) my_progname);
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c7ef8bfc47a..0e0695c9ebe 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -1141,6 +1141,8 @@ int main(int argc, char **argv)
char self_name[FN_REFLEN + 1];
MY_INIT(argv[0]);
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
+ defaults_argv= argv; /* Must be freed by 'free_defaults' */
#if __WIN__
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
@@ -1153,10 +1155,6 @@ int main(int argc, char **argv)
init_dynamic_string(&conn_args, "", 512, 256))
die("Out of memory");
- if (load_defaults("my", load_default_groups, &argc, &argv))
- die(NULL);
- defaults_argv= argv; /* Must be freed by 'free_defaults' */
-
if (handle_options(&argc, &argv, my_long_options, get_one_option))
die(NULL);
if (debug_info_flag)
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index bd80dd01a1e..5e7fb80b2b5 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -320,8 +320,7 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]);
mysql_init(&mysql);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
- if ((error= load_defaults("my",load_default_groups,&argc,&argv)))
- goto err1;
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
save_argv = argv; /* Save for free_defaults */
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option)))
@@ -501,10 +500,8 @@ err2:
my_free(shared_memory_base_name);
#endif
free_defaults(save_argv);
-err1:
my_end(my_end_arg);
- exit(error);
- return 0;
+ return error;
}
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7e5bb435eb4..44675ef7ed9 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -3008,9 +3008,7 @@ int main(int argc, char** argv)
my_init_time(); // for time functions
tzset(); // set tzname
- if (load_defaults("my", load_groups, &argc, &argv))
- exit(1);
-
+ load_defaults_or_exit("my", load_groups, &argc, &argv);
defaults_argv= argv;
if (!(binlog_filter= new Rpl_filter))
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 0854c890824..5e366c5e3d1 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -1181,9 +1181,7 @@ int main(int argc, char **argv)
/*
** Check out the args
*/
- if (load_defaults("my", load_default_groups, &argc, &argv))
- goto end2;
-
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv= argv;
if (get_options(&argc, &argv))
goto end1;
@@ -1259,7 +1257,6 @@ int main(int argc, char **argv)
my_free(shared_memory_base_name);
mysql_library_end();
free_defaults(defaults_argv);
- end2:
my_end(my_end_arg);
return ret;
} /* main */
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 9ea19855f0b..3dbe8412f3c 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -981,8 +981,7 @@ static int get_options(int *argc, char ***argv)
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
md_result_file= stdout;
- if (load_defaults("my",load_default_groups,argc,argv))
- return 1;
+ load_defaults_or_exit("my", load_default_groups, argc, argv);
defaults_argv= *argv;
if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 84bed92bbd4..c7432992d45 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -643,8 +643,7 @@ int main(int argc, char **argv)
MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
- if (load_defaults("my",load_default_groups,&argc,&argv))
- return 1;
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
/* argv is changed in the program */
argv_to_free= argv;
if (get_options(&argc, &argv))
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index f1650a4b26a..484ca661d9e 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -72,8 +72,7 @@ int main(int argc, char **argv)
static char **defaults_argv;
MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
- if (load_defaults("my",load_default_groups,&argc,&argv))
- exit(1);
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv;
get_options(&argc,&argv);
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 83c5838f739..420dc2b94af 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -325,11 +325,7 @@ int main(int argc, char **argv)
MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
- if (load_defaults("my",load_default_groups,&argc,&argv))
- {
- my_end(0);
- exit(1);
- }
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv=argv;
if (get_options(&argc,&argv))
{
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 92c6f9f8b96..efc25f38984 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -2723,7 +2723,8 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
do_eval(&ds_query, query, end, FALSE);
- if (mysql_real_query(mysql, ds_query.str, (ulong)ds_query.length))
+ if (mysql_real_query(mysql, ds_query.str, (ulong)ds_query.length) ||
+ !(res= mysql_store_result(mysql)))
{
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
@@ -2733,13 +2734,6 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
DBUG_VOID_RETURN;
}
- if (!(res= mysql_store_result(mysql)))
- {
- report_or_die("Query '%s' didn't return a result set", ds_query.str);
- dynstr_free(&ds_query);
- eval_expr(var, "", 0);
- DBUG_VOID_RETURN;
- }
dynstr_free(&ds_query);
if ((row= mysql_fetch_row(res)) && row[0])
@@ -7335,9 +7329,7 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
int parse_args(int argc, char **argv)
{
- if (load_defaults("my",load_default_groups,&argc,&argv))
- exit(1);
-
+ load_defaults_or_exit("my", load_default_groups, &argc, &argv);
default_argv= argv;
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))