summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authormonty@narttu.mysql.fi <>2007-03-24 11:06:09 +0200
committermonty@narttu.mysql.fi <>2007-03-24 11:06:09 +0200
commit28a05d3b33d21ed493bcb73bdf775f5377c3834a (patch)
tree9da46d5da168cf6be98e5d92f1946ee853a76ea4 /client
parent193360364703b5aeba78925aa5cdbf1f28a392c8 (diff)
parent7e2fec44ae270693b5f48d3842056d3623e49b94 (diff)
downloadmariadb-git-28a05d3b33d21ed493bcb73bdf775f5377c3834a.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into mysql.com:/home/my/mysql-5.1
Diffstat (limited to 'client')
-rw-r--r--client/client_priv.h2
-rw-r--r--client/mysql.cc9
-rw-r--r--client/mysqladmin.cc9
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqlcheck.c9
-rw-r--r--client/mysqldump.c35
-rw-r--r--client/mysqlimport.c9
-rw-r--r--client/mysqlshow.c9
-rw-r--r--client/mysqlslap.c11
9 files changed, 41 insertions, 61 deletions
diff --git a/client/client_priv.h b/client/client_priv.h
index 646619f62b1..d5d8cb176ed 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -60,5 +60,5 @@ enum options_client
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
- OPT_DEBUG_INFO, OPT_COLUMN_TYPES
+ OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 48172d97f56..c13fb958a1a 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -885,14 +885,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_nopager= 1;
break;
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
- }
break;
case 'A':
opt_rehash= 0;
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index cb704d716cc..03b37f2ba3a 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -287,15 +287,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
}
- }
if (error)
{
usage();
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 0835e59d547..6a61e010d6e 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -946,14 +946,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
remote_opt= 1;
break;
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
- }
case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str);
break;
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 1a9d07804b4..41c5cde4023 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -310,15 +310,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case 'V': print_version(); exit(0);
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
}
- }
return 0;
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index c86a2fc385f..17d63aecafc 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -109,7 +109,8 @@ static char *opt_password=0,*current_user=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
*where=0, *order_by=0,
*opt_compatible_mode_str= 0,
- *err_ptr= 0;
+ *err_ptr= 0,
+ *log_error_file= NULL;
static char **defaults_argv= 0;
static char compatible_mode_normal_str[255];
static ulong opt_compatible_mode= 0;
@@ -120,7 +121,9 @@ static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
#include <sslopt-vars.h>
-FILE *md_result_file= 0;
+FILE *md_result_file= 0;
+FILE *stderror_file=0;
+
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
@@ -307,6 +310,9 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
+ (gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
@@ -790,14 +796,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
}
case (int) OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
- break;
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
+ break;
}
return 0;
}
@@ -4118,6 +4119,16 @@ int main(int argc, char **argv)
free_resources(0);
exit(exit_code);
}
+
+ if (log_error_file)
+ {
+ if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
+ {
+ free_resources(0);
+ exit(EX_MYSQLERR);
+ }
+ }
+
if (connect_to_db(current_host, current_user, opt_password))
{
free_resources(0);
@@ -4181,5 +4192,9 @@ err:
if (!path)
write_footer(md_result_file);
free_resources();
+
+ if (stderror_file)
+ fclose(stderror_file);
+
return(first_error);
} /* main */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 3e054fba308..c037da9c0b9 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -231,14 +231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
#endif
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
- }
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 1c714cc640f..0c6a6229964 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -287,14 +287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
break;
- }
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
break;
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index ad2c8685ba1..d673f8f6f81 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -568,14 +568,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
- {
- if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0)
- {
- fprintf(stderr, "Unknown option to protocol: %s\n", argument);
- exit(1);
- }
- break;
- }
+ opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
+ opt->name);
+ break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
break;