summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/echo.c3
-rw-r--r--client/mysqladmin.cc69
-rw-r--r--client/mysqlbinlog.cc27
-rw-r--r--client/mysqltest.c7
4 files changed, 52 insertions, 54 deletions
diff --git a/client/echo.c b/client/echo.c
index 4483eaad293..e3d22edb3ae 100644
--- a/client/echo.c
+++ b/client/echo.c
@@ -2,8 +2,7 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 4670cb98caf..03b37f2ba3a 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -40,7 +40,7 @@ ulonglong last_values[MAX_MYSQL_VAR];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
- tty_password= 0, info_flag= 0;
+ tty_password= 0, info_flag= 0, opt_nobeep;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
@@ -54,6 +54,7 @@ static char *opt_ndb_connectstring=0;
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol=0;
+static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
/*
When using extended-status relatively, ex_val_max_len is the estimated
@@ -154,6 +155,8 @@ static struct my_option my_long_options[] =
NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"no-beep", 'b', "Turn off beep on error.", (gptr*) &opt_nobeep,
+ (gptr*) &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's asked from the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -347,6 +350,8 @@ int main(int argc,char *argv[])
#endif
if (default_charset)
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
+ error_flags= (myf)(opt_nobeep ? 0 : ME_BELL);
+
if (sql_connect(&mysql, option_wait))
{
unsigned int err= mysql_errno(&mysql);
@@ -445,7 +450,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (!host)
host= (char*) LOCAL_HOST;
my_printf_error(0,"connect to server at '%s' failed\nerror: '%s'",
- MYF(ME_BELL), host, mysql_error(mysql));
+ error_flags, host, mysql_error(mysql));
if (mysql_errno(mysql) == CR_CONNECTION_ERROR)
{
fprintf(stderr,
@@ -520,14 +525,14 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
char buff[FN_REFLEN+20];
if (argc < 2)
{
- my_printf_error(0,"Too few arguments to create",MYF(ME_BELL));
+ my_printf_error(0, "Too few arguments to create", error_flags);
return 1;
}
sprintf(buff,"create database `%.*s`",FN_REFLEN,argv[1]);
if (mysql_query(mysql,buff))
{
my_printf_error(0,"CREATE DATABASE failed; error: '%-.200s'",
- MYF(ME_BELL), mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
argc--; argv++;
@@ -537,7 +542,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (argc < 2)
{
- my_printf_error(0,"Too few arguments to drop",MYF(ME_BELL));
+ my_printf_error(0, "Too few arguments to drop", error_flags);
return 1;
}
if (drop_db(mysql,argv[1]))
@@ -562,7 +567,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_shutdown(mysql, SHUTDOWN_DEFAULT))
{
- my_printf_error(0,"shutdown failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "shutdown failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -583,7 +588,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_RELOAD:
if (mysql_query(mysql,"flush privileges"))
{
- my_printf_error(0,"reload failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "reload failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -594,7 +599,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
REFRESH_READ_LOCK | REFRESH_SLAVE |
REFRESH_MASTER)))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -602,7 +607,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_FLUSH_THREADS:
if (mysql_refresh(mysql,(uint) REFRESH_THREADS))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -646,7 +651,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
"show processlist")) ||
!(result = mysql_store_result(mysql)))
{
- my_printf_error(0,"process list failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "process list failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -669,7 +674,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
char *pos;
if (argc < 2)
{
- my_printf_error(0,"Too few arguments to 'kill'",MYF(ME_BELL));
+ my_printf_error(0, "Too few arguments to 'kill'", error_flags);
return 1;
}
pos=argv[1];
@@ -677,7 +682,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (mysql_kill(mysql,(ulong) atol(pos)))
{
- my_printf_error(0,"kill failed on %ld; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags,
atol(pos), mysql_error(mysql));
error=1;
}
@@ -693,7 +698,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_DEBUG:
if (mysql_dump_debug_info(mysql))
{
- my_printf_error(0,"debug failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "debug failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -707,7 +712,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql,"show /*!40003 GLOBAL */ variables") ||
!(res=mysql_store_result(mysql)))
{
- my_printf_error(0,"unable to show variables; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "unable to show variables; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -729,7 +734,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql, "show /*!50002 GLOBAL */ status") ||
!(res = mysql_store_result(mysql)))
{
- my_printf_error(0, "unable to show status; error: '%s'", MYF(ME_BELL),
+ my_printf_error(0, "unable to show status; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -779,7 +784,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (mysql_refresh(mysql,REFRESH_LOG))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -789,7 +794,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (mysql_query(mysql,"flush hosts"))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -799,7 +804,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (mysql_query(mysql,"flush tables"))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -809,7 +814,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (mysql_query(mysql,"flush status"))
{
- my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "refresh failed; error: '%s'", error_flags,
mysql_error(mysql));
return -1;
}
@@ -826,7 +831,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (argc < 2)
{
- my_printf_error(0,"Too few arguments to change password",MYF(ME_BELL));
+ my_printf_error(0, "Too few arguments to change password", error_flags);
return 1;
}
if (argv[1][0])
@@ -849,7 +854,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'old_passwords'"))
{
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
- MYF(ME_BELL),mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
else
@@ -860,7 +865,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
my_printf_error(0,
"Could not get old_passwords setting from "
"server; error: '%s'",
- MYF(ME_BELL),mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
if (!mysql_num_rows(res))
@@ -885,7 +890,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_query(mysql,"set sql_log_off=1"))
{
my_printf_error(0, "Can't turn off logging; error: '%s'",
- MYF(ME_BELL),mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
if (mysql_query(mysql,buff))
@@ -893,7 +898,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (mysql_errno(mysql)!=1290)
{
my_printf_error(0,"unable to change password; error: '%s'",
- MYF(ME_BELL),mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
else
@@ -907,7 +912,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
" with grant tables disabled (was started with"
" --skip-grant-tables).\n"
"Use: \"mysqladmin flush-privileges password '*'\""
- " instead", MYF(ME_BELL));
+ " instead", error_flags);
return -1;
}
}
@@ -918,7 +923,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_START_SLAVE:
if (mysql_query(mysql, "START SLAVE"))
{
- my_printf_error(0, "Error starting slave: %s", MYF(ME_BELL),
+ my_printf_error(0, "Error starting slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
@@ -928,7 +933,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_STOP_SLAVE:
if (mysql_query(mysql, "STOP SLAVE"))
{
- my_printf_error(0, "Error stopping slave: %s", MYF(ME_BELL),
+ my_printf_error(0, "Error stopping slave: %s", error_flags,
mysql_error(mysql));
return -1;
}
@@ -954,7 +959,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
else
{
my_printf_error(0,"mysqld doesn't answer to ping, error: '%s'",
- MYF(ME_BELL),mysql_error(mysql));
+ error_flags, mysql_error(mysql));
return -1;
}
}
@@ -965,7 +970,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if (argc < 2)
{
- my_printf_error(0,"Too few arguments to ndb-mgm",MYF(ME_BELL));
+ my_printf_error(0, "Too few arguments to ndb-mgm", error_flags);
return 1;
}
{
@@ -979,7 +984,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
break;
#endif
default:
- my_printf_error(0,"Unknown command: '%-.60s'",MYF(ME_BELL),argv[0]);
+ my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]);
return 1;
}
}
@@ -1057,7 +1062,7 @@ static int drop_db(MYSQL *mysql, const char *db)
sprintf(name_buff,"drop database `%.*s`",FN_REFLEN,db);
if (mysql_query(mysql,name_buff))
{
- my_printf_error(0,"DROP DATABASE %s failed;\nerror: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "DROP DATABASE %s failed;\nerror: '%s'", error_flags,
db,mysql_error(mysql));
return 1;
}
@@ -1282,7 +1287,7 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
{
- my_printf_error(0,"query failed; error: '%s'",MYF(ME_BELL),
+ my_printf_error(0, "query failed; error: '%s'", error_flags,
mysql_error(mysql));
}
result = mysql_store_result(mysql);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index a0a7572d92e..6a61e010d6e 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -158,11 +158,7 @@ class Load_log_processor
public:
Load_log_processor() {}
- ~Load_log_processor()
- {
- destroy();
- delete_dynamic(&file_names);
- }
+ ~Load_log_processor() {}
int init()
{
@@ -182,20 +178,22 @@ public:
target_dir_name_len= strlen(target_dir_name);
}
void destroy()
+ {
+ File_name_record *ptr= (File_name_record *)file_names.buffer;
+ File_name_record *end= ptr + file_names.elements;
+ for (; ptr < end; ptr++)
{
- File_name_record *ptr= (File_name_record *)file_names.buffer;
- File_name_record *end= ptr + file_names.elements;
- for (; ptr<end; ptr++)
+ if (ptr->fname)
{
- if (ptr->fname)
- {
- my_free(ptr->fname, MYF(MY_WME));
- delete ptr->event;
- bzero((char *)ptr, sizeof(File_name_record));
- }
+ my_free(ptr->fname, MYF(MY_WME));
+ delete ptr->event;
+ bzero((char *)ptr, sizeof(File_name_record));
}
}
+ delete_dynamic(&file_names);
+ }
+
/*
Obtain Create_file event for LOAD DATA statement by its file_id.
@@ -1572,6 +1570,7 @@ int main(int argc, char** argv)
cleanup();
free_defaults(defaults_argv);
my_free_open_file_info();
+ load_processor.destroy();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 528e169f471..bb6cc037b84 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -106,7 +106,7 @@ static my_bool parsing_disabled= 0;
static my_bool info_flag;
static my_bool display_result_vertically= FALSE, display_metadata= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0;
-static my_bool disable_warnings= 0, disable_ps_warnings= 0;
+static my_bool disable_warnings= 0;
static my_bool disable_info= 1;
static my_bool abort_on_error= 1;
static my_bool server_initialized= 0;
@@ -266,7 +266,6 @@ enum enum_commands {
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
Q_WAIT_FOR_SLAVE_TO_STOP,
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
- Q_ENABLE_PS_WARNINGS, Q_DISABLE_PS_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
Q_EXEC, Q_DELIMITER,
@@ -330,8 +329,6 @@ const char *command_names[]=
"wait_for_slave_to_stop",
"enable_warnings",
"disable_warnings",
- "enable_ps_warnings",
- "disable_ps_warnings",
"enable_info",
"disable_info",
"enable_metadata",
@@ -6088,8 +6085,6 @@ int main(int argc, char **argv)
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
- case Q_ENABLE_PS_WARNINGS: disable_ps_warnings=0; break;
- case Q_DISABLE_PS_WARNINGS: disable_ps_warnings=1; break;
case Q_ENABLE_INFO: disable_info=0; break;
case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_METADATA: display_metadata=1; break;