Commit 7811a61b authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

merge

parents 1e2e4f23 3d289137
...@@ -300,7 +300,8 @@ int handle_options(int *argc, char ***argv, ...@@ -300,7 +300,8 @@ int handle_options(int *argc, char ***argv,
*/ */
*((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1'); *((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1');
(*argc)--; (*argc)--;
continue; /* For GET_BOOL get_one_option() shouldn't be called */ get_one_option(optp->id, optp, argument);
continue;
} }
argument= optend; argument= optend;
} }
...@@ -348,7 +349,8 @@ int handle_options(int *argc, char ***argv, ...@@ -348,7 +349,8 @@ int handle_options(int *argc, char ***argv,
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG) if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
{ {
*((my_bool*) optp->value)= (my_bool) 1; *((my_bool*) optp->value)= (my_bool) 1;
continue; /* For GET_BOOL get_one_option() shouldn't be called */ get_one_option(optp->id, optp, argument);
continue;
} }
else if (optp->arg_type == REQUIRED_ARG || else if (optp->arg_type == REQUIRED_ARG ||
optp->arg_type == OPT_ARG) optp->arg_type == OPT_ARG)
......
...@@ -47,8 +47,10 @@ parse_arguments() { ...@@ -47,8 +47,10 @@ parse_arguments() {
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])! # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
--ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;; --ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;;
# err-log should be removed in 5.0
--err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;; --err-log=*) err_log=`echo "$arg" | sed -e "s;--err-log=;;"` ;;
# QQ The --open-files should be removed --log-error=*) err_log=`echo "$arg" | sed -e "s;--log-error=;;"` ;;
# QQ The --open-files should be removed in 5.0
--open-files=*) open_files=`echo "$arg" | sed -e "s;--open-files=;;"` ;; --open-files=*) open_files=`echo "$arg" | sed -e "s;--open-files=;;"` ;;
--open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;; --open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;;
--core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core-file-size=;;"` ;; --core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core-file-size=;;"` ;;
......
...@@ -1583,7 +1583,7 @@ void sql_perror(const char *message) ...@@ -1583,7 +1583,7 @@ void sql_perror(const char *message)
bool flush_error_log() bool flush_error_log()
{ {
bool result=0; bool result=0;
if (log_error_file[0] != '\0') /* --log-error="" */ if (opt_error_log)
{ {
char err_renamed[FN_REFLEN], *end; char err_renamed[FN_REFLEN], *end;
end= strmake(err_renamed,log_error_file,FN_REFLEN-4); end= strmake(err_renamed,log_error_file,FN_REFLEN-4);
......
...@@ -667,7 +667,7 @@ extern uint delay_key_write_options; ...@@ -667,7 +667,7 @@ extern uint delay_key_write_options;
extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_endinfo, using_udf_functions, locked_in_memory;
extern bool opt_using_transactions, mysql_embedded; extern bool opt_using_transactions, mysql_embedded;
extern bool using_update_log, opt_large_files; extern bool using_update_log, opt_large_files;
extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
extern bool opt_disable_networking, opt_skip_show_db; extern bool opt_disable_networking, opt_skip_show_db;
extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern bool volatile abort_loop, shutdown_in_progress, grant_option;
extern uint volatile thread_count, thread_running, global_read_lock; extern uint volatile thread_count, thread_running, global_read_lock;
......
...@@ -195,7 +195,7 @@ static pthread_cond_t COND_handler_count; ...@@ -195,7 +195,7 @@ static pthread_cond_t COND_handler_count;
static uint handler_count; static uint handler_count;
#endif #endif
#ifdef __WIN__ #ifdef __WIN__
static bool opt_console=0, start_mode=0, use_opt_args; static bool start_mode=0, use_opt_args;
static int opt_argc; static int opt_argc;
static char **opt_argv; static char **opt_argv;
#endif #endif
...@@ -280,6 +280,7 @@ ulong back_log, connect_timeout, concurrency; ...@@ -280,6 +280,7 @@ ulong back_log, connect_timeout, concurrency;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30]; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30];
char log_error_file[FN_REFLEN]; char log_error_file[FN_REFLEN];
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log; bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
bool opt_error_log= IF_WIN(1,0);
bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_disable_networking=0, opt_skip_show_db=0;
my_bool opt_enable_named_pipe= 0; my_bool opt_enable_named_pipe= 0;
my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol; my_bool opt_local_infile, opt_external_locking, opt_slave_compressed_protocol;
...@@ -301,7 +302,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0; ...@@ -301,7 +302,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool lower_case_table_names, opt_old_rpl_compat; my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0; my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0; my_bool opt_log_slave_updates= 0, opt_console= 0;
volatile bool mqh_used = 0; volatile bool mqh_used = 0;
FILE *bootstrap_file=0; FILE *bootstrap_file=0;
...@@ -2208,29 +2209,22 @@ int main(int argc, char **argv) ...@@ -2208,29 +2209,22 @@ int main(int argc, char **argv)
if (opt_slow_log) if (opt_slow_log)
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log", open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
NullS, LOG_NORMAL); NullS, LOG_NORMAL);
#ifdef __WIN__
if (!opt_console) if (opt_error_log)
#endif
{ {
if (log_error_file_ptr != log_error_file) if (!log_error_file_ptr[0])
strmake(log_error_file, log_error_file_ptr, sizeof(log_error_file)); fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", 0);
#ifdef __WIN__ else
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
MY_UNPACK_FILENAME | MY_SAFE_PATH);
if (!log_error_file[0])
opt_error_log= 1; // Too long file name
else else
{ {
char *end;
uint length= ((end=strmake(log_error_file,
mysql_real_data_home,
FN_REFLEN-5)) -
log_error_file);
*strxnmov(end, sizeof(log_error_file)-length-1,
glob_hostname, ".err", NullS)= 0;
}
#endif
if (log_error_file[0] != 0)
if (freopen(log_error_file, "a+", stdout)) if (freopen(log_error_file, "a+", stdout))
freopen(log_error_file, "a+", stderr); freopen(log_error_file, "a+", stderr);
}
} }
if (ha_init()) if (ha_init())
{ {
sql_print_error("Can't init databases"); sql_print_error("Can't init databases");
...@@ -3233,10 +3227,10 @@ struct my_option my_long_options[] = ...@@ -3233,10 +3227,10 @@ struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0, {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __WIN__ {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows",
{"console", OPT_CONSOLE, "Don't remove the console window",
(gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0, (gptr*) &opt_console, (gptr*) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0}, 0, 0, 0},
#ifdef __WIN__
{"standalone", OPT_STANDALONE, {"standalone", OPT_STANDALONE,
"Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG, "Dummy option to start as a standalone program (NT)", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
...@@ -3473,7 +3467,7 @@ struct my_option my_long_options[] = ...@@ -3473,7 +3467,7 @@ struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Log error file", {"log-error", OPT_ERROR_LOG_FILE, "Log error file",
(gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR, (gptr*) &log_error_file_ptr, (gptr*) &log_error_file_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port, {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port,
(gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG, {"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG,
...@@ -4152,7 +4146,6 @@ Starts the MySQL server\n"); ...@@ -4152,7 +4146,6 @@ Starts the MySQL server\n");
printf("Usage: %s [OPTIONS]\n", my_progname); printf("Usage: %s [OPTIONS]\n", my_progname);
#ifdef __WIN__ #ifdef __WIN__
puts("NT and Win32 specific options:\n\ puts("NT and Win32 specific options:\n\
--console Don't remove the console window\n\
--install Install the default service (NT)\n\ --install Install the default service (NT)\n\
--install-manual Install the default service started manually (NT)\n\ --install-manual Install the default service started manually (NT)\n\
--install service_name Install an optional service (NT)\n\ --install service_name Install an optional service (NT)\n\
...@@ -4297,6 +4290,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4297,6 +4290,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_BIN_LOG: case (int) OPT_BIN_LOG:
opt_bin_log=1; opt_bin_log=1;
break; break;
case (int) OPT_ERROR_LOG_FILE:
opt_error_log= 1;
break;
case (int) OPT_INIT_RPL_ROLE: case (int) OPT_INIT_RPL_ROLE:
{ {
int role; int role;
...@@ -4517,6 +4513,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4517,6 +4513,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_STANDALONE: /* Dummy option for NT */ case (int) OPT_STANDALONE: /* Dummy option for NT */
break; break;
#endif #endif
case OPT_CONSOLE:
if (opt_console)
opt_error_log= 0; // Force logs to stdout
break;
#ifdef __NETWARE__ #ifdef __NETWARE__
case (int) OPT_AUTOCLOSE: case (int) OPT_AUTOCLOSE:
setscreenmode(SCR_AUTOCLOSE_ON_EXIT); setscreenmode(SCR_AUTOCLOSE_ON_EXIT);
......
...@@ -145,7 +145,7 @@ void udf_init() ...@@ -145,7 +145,7 @@ void udf_init()
tables.lock_type = TL_READ; tables.lock_type = TL_READ;
tables.db=new_thd->db; tables.db=new_thd->db;
if (open_tables(new_thd, &tables)) if (open_and_lock_tables(new_thd, &tables))
{ {
DBUG_PRINT("error",("Can't open udf table")); DBUG_PRINT("error",("Can't open udf table"));
sql_print_error("Can't open mysql/func table"); sql_print_error("Can't open mysql/func table");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment