summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/mirrors.texi11
-rw-r--r--client/mysql.cc272
-rw-r--r--client/mysqladmin.c11
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqlcheck.c8
-rw-r--r--client/mysqldump.c10
-rw-r--r--client/mysqlimport.c9
-rw-r--r--client/mysqlmanager-pwgen.c9
-rw-r--r--client/mysqlmanagerc.c10
-rw-r--r--client/mysqlshow.c8
-rw-r--r--client/mysqltest.c8
-rw-r--r--client/thread_test.c6
-rw-r--r--extra/my_print_defaults.c9
-rw-r--r--extra/mysql_install.c9
-rw-r--r--extra/perror.c9
-rw-r--r--extra/resolve_stack_dump.c9
-rw-r--r--extra/resolveip.c9
-rw-r--r--include/my_getopt.h1
-rw-r--r--include/mysys_err.h16
-rw-r--r--isam/isamchk.c8
-rw-r--r--isam/pack_isam.c9
-rw-r--r--myisam/ft_dump.c6
-rw-r--r--myisam/ft_eval.c7
-rw-r--r--myisam/ft_test1.c6
-rw-r--r--myisam/mi_test1.c9
-rw-r--r--myisam/myisamchk.c8
-rw-r--r--myisam/myisampack.c9
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result12
-rw-r--r--mysql-test/t/rpl_empty_master_crash.test7
-rw-r--r--mysys/my_getopt.c128
-rw-r--r--sql/gen_lex_hash.cc9
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/repl_failsafe.cc3
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/slave.h2
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_repl.cc2
-rw-r--r--sql/sql_repl.h2
-rw-r--r--support-files/my-huge.cnf.sh19
-rw-r--r--tools/mysqlmanager.c11
40 files changed, 340 insertions, 374 deletions
diff --git a/Docs/mirrors.texi b/Docs/mirrors.texi
index 4f570b03da9..6042d168316 100644
--- a/Docs/mirrors.texi
+++ b/Docs/mirrors.texi
@@ -184,16 +184,16 @@ WWW (@uref{http://darkstar.ist.utl.pt/mysql/})
FTP (@uref{ftp://darkstar.ist.utl.pt/pub/mysql/})
@item
-@image{Flags/portugal} Portugal [Netc] @@
-WWW (@uref{http://ftp.netc.pt/pub/mysql/})
-FTP (@uref{ftp://ftp.netc.pt/pub/mysql/})
-
-@item
@image{Flags/portugal} Portugal [Netvisão] @@
WWW (@uref{http://mysql.netvisao.pt/})
FTP (@uref{ftp://mirrors2.netvisao.pt/pub/mysql/})
@item
+@image{Flags/portugal} Portugal [VIZZAVI] @@
+WWW (@uref{http://ftp.vizzavi.pt/pub/mysql/})
+FTP (@uref{ftp://ftp.vizzavi.pt/pub/mysql/})
+
+@item
@image{Flags/romania} Romania [roedu.net/Bucharest] @@
FTP (@uref{ftp://ftp.roedu.net/pub/mirrors/ftp.mysql.com/})
@@ -432,3 +432,4 @@ FTP (@uref{ftp://ftp.is.co.za/linux/mysql/})
@end itemize
+
diff --git a/client/mysql.cc b/client/mysql.cc
index 10c3709c166..656f8afcad5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
-const char *VER= "12.7";
+const char *VER= "12.10";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@@ -440,7 +440,7 @@ static struct my_option my_long_options[] =
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table and field completion, but startup and reconnecting may take a longer time. Disable with --disable-auto-rehash.",
(gptr*) &rehash, (gptr*) &rehash, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-auto-rehash", 'A',
- "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options depricated; use --disable-auto-rehash instead.",
+ "No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect. WARNING: options deprecated; use --disable-auto-rehash instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
"Print results with a tab as separator, each row on new line. Doesn't use history file.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -468,7 +468,7 @@ static struct my_option my_long_options[] =
(gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"no-named-commands", 'g',
- "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option depricated; use --disable-named-commands instead.",
+ "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
@@ -489,14 +489,14 @@ static struct my_option my_long_options[] =
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
(gptr*) &line_numbers, (gptr*) &line_numbers, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is depricated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
+ {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef __WIN__
{"no-pager", OPT_NOPAGER,
- "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option depricated; use --disable-pager instead.",
+ "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option depricated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
+ {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered,
(gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -504,10 +504,10 @@ static struct my_option my_long_options[] =
(gptr*) &column_names, (gptr*) &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
- "Don't write column names in results. WARNING: -N is depricated, use long version of this options instead.",
+ "Don't write column names in results. WARNING: -N is deprecated, use long version of this options instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Only update the default database. This is useful for skipping updates to other database in the update log.",
@@ -604,115 +604,115 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch(optid) {
- case OPT_CHARSETS_DIR:
- strmov(mysql_charsets_dir, argument);
- charsets_dir = mysql_charsets_dir;
- break;
- case OPT_LOCAL_INFILE:
- using_opt_local_infile=1;
- opt_local_infile= test(!argument || atoi(argument)>0);
- break;
- case OPT_TEE:
- if (argument == disabled_my_option)
- {
- if (opt_outfile)
- end_tee();
- opt_outfile= 0;
- }
- else
- if (!opt_outfile)
- {
- strmov(outfile, argument);
- opt_outfile= 1;
- init_tee();
- }
- break;
- case OPT_NOTEE:
- printf("WARNING: option depricated; use --disable-tee instead.\n");
+ case OPT_CHARSETS_DIR:
+ strmov(mysql_charsets_dir, argument);
+ charsets_dir = mysql_charsets_dir;
+ break;
+ case OPT_LOCAL_INFILE:
+ using_opt_local_infile=1;
+ opt_local_infile= test(!argument || atoi(argument)>0);
+ break;
+ case OPT_TEE:
+ if (argument == disabled_my_option)
+ {
if (opt_outfile)
end_tee();
- opt_outfile= 0;
- break;
- case OPT_PAGER:
- opt_nopager= 0;
- if (argument)
- strmov(pager, argument);
- else
- strmov(pager, default_pager);
- strmov(default_pager, pager);
- break;
- case OPT_NOPAGER:
- printf("WARNING: option depricated; use --disable-pager instead.\n");
- opt_nopager= 1;
- break;
- case 'A':
- rehash= 0;
- break;
- case 'e':
- status.batch= 1;
- status.add_to_history= 0;
- batch_readline_end(status.line_buff); // If multiple -e
- if (!(status.line_buff= batch_readline_command(argument)))
- return 1;
- ignore_errors= 0;
- break;
- case 'o':
- if (argument == disabled_my_option)
- one_database= 0;
- else
- one_database= skip_updates= 1;
- break;
- case 'p':
- if (argument == disabled_my_option)
- argument= (char*) ""; // Don't require password
- if (argument)
- {
- char *start= argument;
- my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
- opt_password= my_strdup(argument, MYF(MY_FAE));
- while (*argument) *argument++= 'x'; // Destroy argument
- if (*start)
- start[1]=0 ;
- }
- else
- tty_password= 1;
- break;
- case '#':
- DBUG_PUSH(argument ? argument : default_dbug_option);
- info_flag= 1;
- break;
- case 's':
- if (argument == disabled_my_option)
- opt_silent= 0;
- else
- opt_silent++;
- break;
- case 'v':
- if (argument == disabled_my_option)
- verbose= 0;
- else
- verbose++;
- break;
- case 'B':
- if (!status.batch)
+ }
+ else
+ if (!opt_outfile)
{
- status.batch= 1;
- status.add_to_history= 0;
- opt_silent++; // more silent
+ strmov(outfile, argument);
+ init_tee();
}
- break;
- case 'W':
+ break;
+ case OPT_NOTEE:
+ printf("WARNING: option deprecated; use --disable-tee instead.\n");
+ if (opt_outfile)
+ end_tee();
+ break;
+ case OPT_PAGER:
+ opt_nopager= 0;
+ if (argument)
+ strmov(pager, argument);
+ else
+ strmov(pager, default_pager);
+ strmov(default_pager, pager);
+ break;
+ case OPT_NOPAGER:
+ printf("WARNING: option deprecated; use --disable-pager instead.\n");
+ opt_nopager= 1;
+ break;
+ case 'A':
+ rehash= 0;
+ break;
+ case 'N':
+ column_names= 0;
+ break;
+ case 'e':
+ status.batch= 1;
+ status.add_to_history= 0;
+ batch_readline_end(status.line_buff); // If multiple -e
+ if (!(status.line_buff= batch_readline_command(argument)))
+ return 1;
+ ignore_errors= 0;
+ break;
+ case 'o':
+ if (argument == disabled_my_option)
+ one_database= 0;
+ else
+ one_database= skip_updates= 1;
+ break;
+ case 'p':
+ if (argument == disabled_my_option)
+ argument= (char*) ""; // Don't require password
+ if (argument)
+ {
+ char *start= argument;
+ my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+ opt_password= my_strdup(argument, MYF(MY_FAE));
+ while (*argument) *argument++= 'x'; // Destroy argument
+ if (*start)
+ start[1]=0 ;
+ }
+ else
+ tty_password= 1;
+ break;
+ case '#':
+ DBUG_PUSH(argument ? argument : default_dbug_option);
+ info_flag= 1;
+ break;
+ case 's':
+ if (argument == disabled_my_option)
+ opt_silent= 0;
+ else
+ opt_silent++;
+ break;
+ case 'v':
+ if (argument == disabled_my_option)
+ verbose= 0;
+ else
+ verbose++;
+ break;
+ case 'B':
+ if (!status.batch)
+ {
+ status.batch= 1;
+ status.add_to_history= 0;
+ opt_silent++; // more silent
+ }
+ break;
+ case 'W':
#ifdef __WIN__
- opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
+ opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
#endif
- break;
- case 'V':
- usage(1);
- exit(0);
- case 'I':
- case '?':
- usage(0);
- exit(0);
+ break;
+ case 'V':
+ usage(1);
+ exit(0);
+ case 'I':
+ case '?':
+ usage(0);
+ exit(0);
#include "sslopt-case.h"
}
return 0;
@@ -739,11 +739,7 @@ static int get_options(int argc, char **argv)
strmov(default_pager, pager);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (status.batch) /* disable pager and outfile in this case */
{
@@ -1514,17 +1510,22 @@ static void end_pager()
static void init_tee()
{
+ if (opt_outfile)
+ end_tee();
if (!(OUTFILE= my_fopen(outfile, O_APPEND | O_WRONLY, MYF(MY_WME))))
{
- opt_outfile=0;
+ opt_outfile= 0;
init_pager();
return;
}
+ opt_outfile= 1;
+ tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
}
static void end_tee()
{
my_fclose(OUTFILE, MYF(0));
+ opt_outfile= 0;
return;
}
@@ -1599,18 +1600,19 @@ print_table_data(MYSQL_RES *result)
tee_puts(separator.c_ptr(), PAGER);
}
- while ((cur = mysql_fetch_row(result)))
+ while ((cur= mysql_fetch_row(result)))
{
(void) tee_fputs("|", PAGER);
- mysql_field_seek(result,0);
- for (uint off=0 ; off < mysql_num_fields(result); off++)
+ mysql_field_seek(result, 0);
+ for (uint off= 0; off < mysql_num_fields(result); off++)
{
- const char *str=cur[off] ? cur[off] : "NULL";
- field = mysql_fetch_field(result);
- uint length=field->max_length;
+ const char *str= cur[off] ? cur[off] : "NULL";
+ field= mysql_fetch_field(result);
+ uint length= field->max_length;
if (length > MAX_COLUMN_LENGTH)
{
- tee_fputs(str,PAGER); tee_fputs(" |",PAGER);
+ tee_fputs(str, PAGER);
+ tee_fputs(" |", PAGER);
}
else
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
@@ -1811,7 +1813,7 @@ print_tab_data(MYSQL_RES *result)
for (uint off=1 ; off < mysql_num_fields(result); off++)
{
(void) tee_fputs("\t", PAGER);
- safe_put_field(cur[off],lengths[off]);
+ safe_put_field(cur[off], lengths[off]);
}
(void) tee_fputs("\n", PAGER);
}
@@ -1830,8 +1832,8 @@ com_tee(String *buffer, char *line __attribute__((unused)))
{
if (!strlen(outfile))
{
- printf("No previous outfile available, you must give the filename!\n");
- opt_outfile=0;
+ printf("No previous outfile available, you must give a filename!\n");
+ opt_outfile= 0;
return 0;
}
}
@@ -1839,10 +1841,10 @@ com_tee(String *buffer, char *line __attribute__((unused)))
{
while (isspace(*param))
param++;
- end=strmake(file_name, param, sizeof(file_name)-1);
+ end= strmake(file_name, param, sizeof(file_name) - 1);
while (end > file_name && (isspace(end[-1]) || iscntrl(end[-1])))
end--;
- end[0]=0;
+ end[0]= 0;
strmov(outfile, file_name);
}
if (!strlen(outfile))
@@ -1850,12 +1852,7 @@ com_tee(String *buffer, char *line __attribute__((unused)))
printf("No outfile specified!\n");
return 0;
}
- if (!opt_outfile)
- {
- init_tee();
- opt_outfile=1;
- }
- tee_fprintf(stdout, "Logging to file '%s'\n", outfile);
+ init_tee();
return 0;
}
@@ -1865,7 +1862,6 @@ com_notee(String *buffer __attribute__((unused)),
{
if (opt_outfile)
end_tee();
- opt_outfile=0;
tee_fprintf(stdout, "Outfile disabled.\n");
return 0;
}
@@ -2288,11 +2284,11 @@ com_status(String *buffer __attribute__((unused)),
}
#ifdef HAVE_OPENSSL
if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
- tee_fprintf(stdout, "SSL cipher in use is %s\n",
+ tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
SSL_get_cipher(mysql.net.vio->ssl_));
else
#endif /* HAVE_OPENSSL */
- tee_puts("SSL is not in use\n", stdout);
+ tee_puts("SSL:\t\t\tNot in use", stdout);
}
else
{
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 6fa8e8220f4..fd2a17eee31 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -23,7 +23,7 @@
#include <my_pthread.h> /* because of signal() */
#endif
-#define ADMIN_VERSION "8.34"
+#define ADMIN_VERSION "8.35"
#define MAX_MYSQL_VAR 64
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@@ -130,7 +130,7 @@ static struct my_option my_long_options[] =
(gptr*) &opt_relative, (gptr*) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Silently exit if one can't connect to server",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -247,11 +247,8 @@ int main(int argc,char *argv[])
free_defaults()
*/
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (argc == 0)
{
usage();
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index e420e3b6ad8..3020e105954 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -124,7 +124,7 @@ static void die(const char* fmt, ...)
static void print_version()
{
- printf("%s Ver 2.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 2.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
@@ -223,11 +223,8 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index f0d7e998aa9..78cd277f9be 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -16,7 +16,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.3"
+#define CHECK_VERSION "2.4"
#include "client_priv.h"
#include <m_ctype.h>
@@ -265,11 +265,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (!what_to_do)
{
diff --git a/client/mysqldump.c b/client/mysqldump.c
index e2b9ab3f6b5..8d9e44eba1b 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -35,7 +35,7 @@
** and adapted to mysqldump 05/11/01 by Jani Tolonen
*/
-#define DUMP_VERSION "9.05"
+#define DUMP_VERSION "9.06"
#include <my_global.h>
#include <my_sys.h>
@@ -180,7 +180,7 @@ static struct my_option my_long_options[] =
{"no-data", 'd', "No row information.", (gptr*) &dFlag, (gptr*) &dFlag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-variable", 'O',
- "Change the value of a variable. Please note that this option is depricated; you can set variables directly with --variable-name=value.",
+ "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table --add-locks --all --quick --extended-insert --lock-tables --disable-keys",
@@ -360,11 +360,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (opt_delayed)
opt_lock=0; /* Can't have lock with delayed */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index bc7860a052d..1933ea41bcf 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "3.3"
+#define IMPORT_VERSION "3.4"
#include "client_priv.h"
#include "mysql_version.h"
@@ -204,11 +204,8 @@ static int get_options(int *argc, char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (enclosed && opt_enclosed)
{
fprintf(stderr, "You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n");
diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c
index cd308a53d46..40126e279b5 100644
--- a/client/mysqlmanager-pwgen.c
+++ b/client/mysqlmanager-pwgen.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define MANAGER_PWGEN_VERSION "1.3"
+#define MANAGER_PWGEN_VERSION "1.4"
#include <my_global.h>
#include <m_ctype.h>
@@ -96,11 +96,8 @@ int parse_args(int argc, char** argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/client/mysqlmanagerc.c b/client/mysqlmanagerc.c
index 82b70ed1b44..f200b993147 100644
--- a/client/mysqlmanagerc.c
+++ b/client/mysqlmanagerc.c
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#define MANAGER_CLIENT_VERSION "1.3"
+#define MANAGER_CLIENT_VERSION "1.4"
#include <my_global.h>
#include <mysql.h>
@@ -132,12 +132,10 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
+
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
int main(int argc, char** argv)
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 74a41e69b1f..81b4d2ab4f7 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -16,7 +16,7 @@
/* Show databases, tables or columns */
-#define SHOW_VERSION "9.3"
+#define SHOW_VERSION "9.4"
#include <my_global.h>
#include "client_priv.h"
@@ -241,11 +241,7 @@ get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (tty_password)
opt_password=get_tty_password(NullS);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 1a4e61027fe..2421ae69af5 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -42,7 +42,7 @@
**********************************************************************/
-#define MTEST_VERSION "1.22"
+#define MTEST_VERSION "1.23"
#include <my_global.h>
#include <mysql_embed.h>
@@ -1957,11 +1957,7 @@ int parse_args(int argc, char **argv)
default_argv= argv;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (argc > 1)
{
diff --git a/client/thread_test.c b/client/thread_test.c
index 10183ca5150..2900ab712e2 100644
--- a/client/thread_test.c
+++ b/client/thread_test.c
@@ -173,11 +173,7 @@ static void get_options(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
free_defaults(argv);
if (tty_password)
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 2c87ee11820..c0f8a54f432 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -55,7 +55,7 @@ static struct my_option my_long_options[] =
static void usage(my_bool version)
{
- printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.5 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
if (version)
return;
@@ -92,11 +92,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (*argc < 1)
{
usage(0);
diff --git a/extra/mysql_install.c b/extra/mysql_install.c
index 0153ad3bf70..e2783f906b9 100644
--- a/extra/mysql_install.c
+++ b/extra/mysql_install.c
@@ -18,7 +18,7 @@
/* Install or upgrade MySQL server. By Sasha Pachev <sasha@mysql.com>
*/
-#define INSTALL_VERSION "1.1"
+#define INSTALL_VERSION "1.2"
#define DONT_USE_RAID
#include <my_global.h>
@@ -219,11 +219,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}
diff --git a/extra/perror.c b/extra/perror.c
index da62913b4a4..4d05adf29aa 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -16,7 +16,7 @@
/* Return error-text for system error messages and nisam messages */
-#define PERROR_VERSION "2.8"
+#define PERROR_VERSION "2.9"
#include <my_global.h>
#include <my_sys.h>
@@ -141,11 +141,8 @@ static int get_options(int *argc,char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (!*argc && !print_all_codes)
{
usage();
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 23f22e276a6..8379da97795 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -30,7 +30,7 @@
#define INIT_SYM_TABLE 4096
#define INC_SYM_TABLE 4096
#define MAX_SYM_SIZE 128
-#define DUMP_VERSION "1.3"
+#define DUMP_VERSION "1.4"
#define HEX_INVALID (uchar)255
typedef ulong my_long_addr_t ; /* at some point, we need to fix configure
@@ -121,11 +121,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
/*
The following code is to make the command compatible with the old
version that required one to use the -n and -s options
diff --git a/extra/resolveip.c b/extra/resolveip.c
index f4b703bec4f..6665ceebf1d 100644
--- a/extra/resolveip.c
+++ b/extra/resolveip.c
@@ -16,7 +16,7 @@
/* Resolves IP's to hostname and hostnames to IP's */
-#define RESOLVE_VERSION "2.1"
+#define RESOLVE_VERSION "2.2"
#include <my_global.h>
#include <m_ctype.h>
@@ -94,11 +94,8 @@ static int get_options(int *argc,char ***argv)
/* load_defaults("my",load_default_groups,argc,argv); */
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (*argc == 0)
{
usage();
diff --git a/include/my_getopt.h b/include/my_getopt.h
index ae12e921aa0..3b50fbe2ded 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -39,6 +39,7 @@ struct my_option
};
extern char *disabled_my_option;
+extern my_bool my_getopt_print_errors;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts,
diff --git a/include/mysys_err.h b/include/mysys_err.h
index b3d058aff3e..a86765c74fd 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -54,7 +54,23 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
+ /* exit codes for all MySQL programs */
+
+#define EXIT_UNSPECIFIED_ERROR 1
+#define EXIT_UNKNOWN_OPTION 2
+#define EXIT_AMBIGUOUS_OPTION 3
+#define EXIT_NO_ARGUMENT_ALLOWED 4
+#define EXIT_ARGUMENT_REQUIRED 5
+#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
+#define EXIT_UNKNOWN_VARIABLE 7
+#define EXIT_OUT_OF_MEMORY 8
+#define EXIT_UNKNOWN_SUFFIX 9
+#define EXIT_NO_PTR_TO_VARIABLE 10
+#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
+
+
#ifdef __cplusplus
}
#endif
#endif
+
diff --git a/isam/isamchk.c b/isam/isamchk.c
index 7c604973108..23bded29f79 100644
--- a/isam/isamchk.c
+++ b/isam/isamchk.c
@@ -335,7 +335,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 6.00 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 6.01 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -665,11 +665,7 @@ static void get_options(register int *argc, register char ***argv)
testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
if (*argc == 0)
{
diff --git a/isam/pack_isam.c b/isam/pack_isam.c
index d0a2111c34a..a08f710c89b 100644
--- a/isam/pack_isam.c
+++ b/isam/pack_isam.c
@@ -278,7 +278,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 5.9 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 5.10 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
static void usage(void)
@@ -353,11 +353,8 @@ static void get_options(int *argc, char ***argv)
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
my_progname= argv[0][0];
if (isatty(fileno(stdout)))
write_loop=1;
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 619e59efc3e..822603212a0 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -245,11 +245,7 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
} /* get options */
diff --git a/myisam/ft_eval.c b/myisam/ft_eval.c
index 1b40209563d..e196121d7af 100644
--- a/myisam/ft_eval.c
+++ b/myisam/ft_eval.c
@@ -179,11 +179,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if(!(d_file=argv[optind])) print_error(1,"No d_file");
if(!(df=fopen(d_file,"r")))
print_error(1,"fopen(%s)",d_file);
diff --git a/myisam/ft_test1.c b/myisam/ft_test1.c
index 728ea4cd047..6fa347f594a 100644
--- a/myisam/ft_test1.c
+++ b/myisam/ft_test1.c
@@ -284,11 +284,7 @@ static void get_options(int argc,char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
return;
} /* get options */
diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c
index 84810cb25ea..d0ce3ea966e 100644
--- a/myisam/mi_test1.c
+++ b/myisam/mi_test1.c
@@ -623,7 +623,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
key_cacheing=1;
break;
case 'V':
- printf("test1 Ver 1.1 \n");
+ printf("test1 Ver 1.2 \n");
exit(0);
case '#':
DEBUGGER_ON;
@@ -644,11 +644,8 @@ static void get_options(int argc, char *argv[])
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return;
} /* get options */
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 0cd3e5f3139..379a985705d 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -292,7 +292,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 2.6 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -615,13 +615,15 @@ get_one_option(int optid,
static void get_options(register int *argc,register char ***argv)
{
+ int ho_error;
+
load_defaults("my", load_default_groups, argc, argv);
default_argv= *argv;
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
- if (handle_options(argc, argv, my_long_options, get_one_option))
- exit(1);
+ if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
+ exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */
if ((check_param.testflag & T_UPDATE_STATE) &&
diff --git a/myisam/myisampack.c b/myisam/myisampack.c
index 2cadeaae72a..0064b50348f 100644
--- a/myisam/myisampack.c
+++ b/myisam/myisampack.c
@@ -269,7 +269,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.20 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+ printf("%s Ver 1.21 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
}
static void usage(void)
@@ -347,11 +347,8 @@ static void get_options(int *argc,char ***argv)
write_loop=1;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (!*argc)
{
usage();
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
new file mode 100644
index 00000000000..6ae5d15031b
--- /dev/null
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -0,0 +1,12 @@
+slave stop;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+use test;
+drop table if exists t1;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+ 0 0 0 0 No No 0 0 0 0
+load table t1 from master;
+Error in fetch_master_table
diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test
new file mode 100644
index 00000000000..158b59169ee
--- /dev/null
+++ b/mysql-test/t/rpl_empty_master_crash.test
@@ -0,0 +1,7 @@
+source include/master-slave.inc;
+connection master;
+use test;
+drop table if exists t1;
+show slave status;
+--error 1218
+load table t1 from master;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 80904fb46f6..76cdbede78d 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -20,6 +20,7 @@
#include <my_getopt.h>
#include <assert.h>
#include <my_sys.h>
+#include <mysys_err.h>
static int findopt (char *optpat, uint length,
const struct my_option **opt_res,
@@ -42,17 +43,11 @@ static const char *special_opt_prefix[]=
char *disabled_my_option= (char*) "0";
-/* Return error values from handle_options */
+/* This is a flag that can be set in client programs. 0 means that
+ my_getopt will not print error messages, but the client should do
+ it by itself */
-#define ERR_UNKNOWN_OPTION 1
-#define ERR_AMBIGUOUS_OPTION 2
-#define ERR_NO_ARGUMENT_ALLOWED 3
-#define ERR_ARGUMENT_REQUIRED 4
-#define ERR_VAR_PREFIX_NOT_UNIQUE 5
-#define ERR_UNKNOWN_VARIABLE 6
-#define ERR_OUT_OF_MEMORY 7
-#define ERR_UNKNOWN_SUFFIX 8
-#define ERR_NO_PTR_TO_VARIABLE 9
+my_bool my_getopt_print_errors= 1;
/*
@@ -106,9 +101,10 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
- fprintf(stderr, "%s: Option '-O' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: Option '-O' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
@@ -128,10 +124,11 @@ int handle_options(int *argc, char ***argv,
cur_arg+= 14;
if (!*cur_arg)
{
- fprintf(stderr,
- "%s: Option '--set-variable' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: Option '--set-variable' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
}
else if (cur_arg[14]) /* garbage, or another option. break out */
@@ -141,10 +138,11 @@ int handle_options(int *argc, char ***argv,
/* the argument must be in next argv */
if (!*++pos)
{
- fprintf(stderr,
- "%s: Option '--set-variable' requires an argument\n",
- progname);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: Option '--set-variable' requires an argument\n",
+ progname);
+ return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
(*argc)--;
@@ -200,11 +198,12 @@ int handle_options(int *argc, char ***argv,
{
if (opt_found > 1)
{
- fprintf(stderr,
- "%s: ambiguous option '--%s-%s' (--%s-%s)\n",
- progname, special_opt_prefix[i], cur_arg,
- special_opt_prefix[i], prev_found);
- return ERR_AMBIGUOUS_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: ambiguous option '--%s-%s' (--%s-%s)\n",
+ progname, special_opt_prefix[i], cur_arg,
+ special_opt_prefix[i], prev_found);
+ return EXIT_AMBIGUOUS_OPTION;
}
if (i < DISABLE_OPTION_COUNT)
optend= disabled_my_option;
@@ -224,19 +223,21 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
- fprintf(stderr,
- "%s: %s: unknown variable '%s'\n", progname,
- option_is_loose ? "WARNING" : "ERROR", cur_arg);
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: %s: unknown variable '%s'\n", progname,
+ option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
- return ERR_UNKNOWN_VARIABLE;
+ return EXIT_UNKNOWN_VARIABLE;
}
else
{
- fprintf(stderr,
- "%s: %s: unknown option '--%s'\n", progname,
- option_is_loose ? "WARNING" : "ERROR", cur_arg);
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: %s: unknown option '--%s'\n", progname,
+ option_is_loose ? "WARNING" : "ERROR", cur_arg);
if (!option_is_loose)
- return ERR_UNKNOWN_OPTION;
+ return EXIT_UNKNOWN_OPTION;
}
if (option_is_loose)
{
@@ -249,30 +250,34 @@ int handle_options(int *argc, char ***argv,
{
if (must_be_var)
{
- fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
- progname, cur_arg);
- return ERR_VAR_PREFIX_NOT_UNIQUE;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
+ progname, cur_arg);
+ return EXIT_VAR_PREFIX_NOT_UNIQUE;
}
else
{
- fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
- progname, cur_arg, prev_found, optp->name);
- return ERR_AMBIGUOUS_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
+ progname, cur_arg, prev_found, optp->name);
+ return EXIT_AMBIGUOUS_OPTION;
}
}
if (must_be_var && (!optp->value || optp->var_type == GET_BOOL))
{
- fprintf(stderr, "%s: option '%s' cannot take an argument\n",
- progname, optp->name);
- return ERR_NO_ARGUMENT_ALLOWED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '%s' cannot take an argument\n",
+ progname, optp->name);
+ return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->arg_type == NO_ARG)
{
if (optend && !special_used)
{
- fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
- progname, optp->name);
- return ERR_NO_ARGUMENT_ALLOWED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
+ progname, optp->name);
+ return EXIT_NO_ARGUMENT_ALLOWED;
}
if (optp->var_type == GET_BOOL)
{
@@ -306,9 +311,10 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
- fprintf(stderr, "%s: option '--%s' requires an argument\n",
- progname, optp->name);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr, "%s: option '--%s' requires an argument\n",
+ progname, optp->name);
+ return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
@@ -318,8 +324,9 @@ int handle_options(int *argc, char ***argv,
}
else /* must be short option */
{
- for (optend= cur_arg; *optend; optend++, opt_found= 0)
+ for (optend= cur_arg; *optend; optend++)
{
+ opt_found= 0;
for (optp= longopts; optp->id; optp++)
{
if (optp->id == (int) (uchar) *optend)
@@ -347,9 +354,11 @@ int handle_options(int *argc, char ***argv,
/* Check if there are more arguments after this one */
if (!*++pos)
{
- fprintf(stderr, "%s: option '-%c' requires an argument\n",
- progname, optp->id);
- return ERR_ARGUMENT_REQUIRED;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: option '-%c' requires an argument\n",
+ progname, optp->id);
+ return EXIT_ARGUMENT_REQUIRED;
}
argument= *pos;
(*argc)--;
@@ -369,9 +378,10 @@ int handle_options(int *argc, char ***argv,
}
if (!opt_found)
{
- fprintf(stderr,
- "%s: unknown option '-%c'\n", progname, *cur_arg);
- return ERR_UNKNOWN_OPTION;
+ if (my_getopt_print_errors)
+ fprintf(stderr,
+ "%s: unknown option '-%c'\n", progname, *optend);
+ return EXIT_UNKNOWN_OPTION;
}
}
(*argc)--; /* option handled (short), decrease argument count */
@@ -412,7 +422,7 @@ static int setval (const struct my_option *opts, char *argument,
opts->u_max_value : opts->value;
if (!result_pos)
- return ERR_NO_PTR_TO_VARIABLE;
+ return EXIT_NO_PTR_TO_VARIABLE;
switch (opts->var_type) {
case GET_INT:
@@ -437,13 +447,13 @@ static int setval (const struct my_option *opts, char *argument,
my_free((*(char**) result_pos),
MYF(MY_WME | MY_FAE));
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
- return ERR_OUT_OF_MEMORY;
+ return EXIT_OUT_OF_MEMORY;
break;
default: /* dummy default to avoid compiler warnings */
break;
}
if (err)
- return ERR_UNKNOWN_SUFFIX;
+ return EXIT_UNKNOWN_SUFFIX;
}
return 0;
}
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index ba1d27f2bf6..a4f0791d105 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -356,7 +356,7 @@ void print_arrays()
static void usage(int version)
{
- printf("%s Ver 3.4 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 3.5 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -394,11 +394,8 @@ static int get_options(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
if (argc >= 1)
{
usage(0);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1f70829239c..9c0d6bffe6c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3053,7 +3053,6 @@ static struct my_option my_long_options[] =
*/
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifndef DBUG_OFF
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Undocumented: Meant for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count,
@@ -3070,7 +3069,6 @@ static struct my_option my_long_options[] =
(gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
-#endif
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -4422,11 +4420,7 @@ static void get_options(int argc,char **argv)
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
fix_paths();
default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 257418d1682..fab1491fc2b 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -608,6 +608,9 @@ int show_slave_hosts(THD* thd)
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
{
+ if (!mi->host || !*mi->host) /* empty host */
+ return 1;
+
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, 0))
{
diff --git a/sql/slave.cc b/sql/slave.cc
index 19e093a75d2..93e711f2e14 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -48,12 +48,10 @@ ulong relay_log_space_limit = 0; /* TODO: fix variables to access ulonglong
// can re-use them on slave start
// TODO: move the vars below under MASTER_INFO
-#ifndef DBUG_OFF
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
static int events_till_disconnect = -1;
int events_till_abort = -1;
static int stuck_count = 0;
-#endif
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE;
diff --git a/sql/slave.h b/sql/slave.h
index 34df17f2851..16735891815 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -415,9 +415,7 @@ extern bool do_table_inited, ignore_table_inited,
wild_do_table_inited, wild_ignore_table_inited;
extern bool table_rules_on;
-#ifndef DBUG_OFF
extern int disconnect_slave_event_count, abort_slave_event_count ;
-#endif
// the master variables are defaults read from my.cnf or command line
extern uint master_port, master_connect_retry, report_port;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 123a95070b9..3f2d4808cbe 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -160,7 +160,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
uc->connections = 1;
uc->questions=uc->updates=uc->conn_per_hour=0;
uc->user_resources=*mqh;
- if (mqh->connections > max_user_connections)
+ if (max_user_connections && mqh->connections > max_user_connections)
uc->user_resources.connections = max_user_connections;
uc->intime=thd->thr_create_time;
if (hash_insert(&hash_user_connections, (byte*) uc))
@@ -298,7 +298,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
goto end;
}
uc->connections++;
-if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
+ if (uc->user_resources.connections && uc->conn_per_hour++ >= uc->user_resources.connections)
{
net_printf(&current_thd->net, ER_USER_LIMIT_REACHED, uc->user, "max_connections",
(long) uc->user_resources.connections);
@@ -317,12 +317,7 @@ static void decrease_user_connections(USER_CONN *uc)
*/
DBUG_ENTER("decrease_user_connections");
- if (mqh_used)
- {
- if (uc->conn_per_hour)
- uc->conn_per_hour--;
- }
- else if (!--uc->connections)
+ if (!mqh_used && uc->connections && !--uc->connections)
{
/* Last connection for user; Delete it */
(void) pthread_mutex_lock(&LOCK_user_conn);
@@ -1797,6 +1792,7 @@ mysql_execute_command(void)
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
if ((res=open_and_lock_tables(thd,tables)))
break;
+ thd->select_limit=HA_POS_ERROR;
if (!setup_fields(thd,tables,select_lex->item_list,1,0,0) &&
!setup_fields(thd,tables,lex->value_list,0,0,0) && ! thd->fatal_error &&
(result=new multi_update(thd,tables,select_lex->item_list,lex->duplicates,
@@ -2746,7 +2742,7 @@ void mysql_init_multi_delete(LEX *lex)
{
lex->sql_command = SQLCOM_DELETE_MULTI;
mysql_init_select(lex);
- lex->select->select_limit=HA_POS_ERROR;
+ lex->select->select_limit=lex->thd->select_limit=HA_POS_ERROR;
lex->auxilliary_table_list=lex->select_lex.table_list;
lex->select->table_list.elements=0;
lex->select->table_list.first=0;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 398ff443ad4..b6c7c98a4cf 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -27,11 +27,9 @@
extern const char* any_db;
-#ifndef DBUG_OFF
int max_binlog_dump_events = 0; // unlimited
bool opt_sporadic_binlog_dump_fail = 0;
static int binlog_dump_count = 0;
-#endif
int check_binlog_magic(IO_CACHE* log, const char** errmsg)
{
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 360fd50a1e3..b15c72a0bde 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -21,10 +21,8 @@ extern uint32 server_id;
extern bool server_id_supplied;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
-#ifndef DBUG_OFF
extern int max_binlog_dump_events;
extern bool opt_sporadic_binlog_dump_fail;
-#endif
#define KICK_SLAVE(thd) thd->awake(0 /* do not prepare to die*/);
diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh
index ce9b5b18586..88d83afb986 100644
--- a/support-files/my-huge.cnf.sh
+++ b/support-files/my-huge.cnf.sh
@@ -35,8 +35,23 @@ set-variable = thread_cache=8
# Try number of CPU's*2 for thread_concurrency
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=64M
-log-bin
-server-id = 1
+
+# Replication Master Server (default)
+log-bin # required for replication
+server-id = 1 # required unique id between 1 and 2^32 - 1
+ # defaults to 1 if master-host is not set
+ # but will not function as a master if omitted
+
+# Replication Slave Server (comment out master section to use this)
+#master-host = # MUST BE SET
+#master-user = # MUST BE SET
+#master-password = # MUST BE SET
+#master-port = # optional--defaults to 3306
+#log-bin # not required for slaves, but recommended
+#server-id = 2 # required unique id between 2 and 2^32 - 1
+ # (and different from the master)
+ # defaults to 2 if master-host is set
+ # but will not function as a slave if omitted
# Point the following paths to different dedicated disks
#tmpdir = /tmp/
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index c8abb996794..82bc149ab34 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -41,8 +41,8 @@
#include <sys/wait.h>
#endif
-#define MANAGER_VERSION "1.1"
-#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.0"
+#define MANAGER_VERSION "1.2"
+#define MANAGER_GREETING "MySQL Server Management Daemon v. 1.2"
#define LOG_ERR 1
#define LOG_WARN 2
@@ -1332,11 +1332,8 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- {
- printf("%s: handle_options() failed with error %d\n", my_progname,
- ho_error);
- exit(1);
- }
+ exit(ho_error);
+
return 0;
}