mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge with 4.0
This commit is contained in:
@ -123,14 +123,16 @@ if (($opt_directory ne $PWD) && (!-d $opt_directory && !$opt_dry_run))
|
|||||||
if ($opt_pull)
|
if ($opt_pull)
|
||||||
{
|
{
|
||||||
&logger("Updating BK tree $REPO to latest ChangeSet first");
|
&logger("Updating BK tree $REPO to latest ChangeSet first");
|
||||||
$command= "cd $REPO; bk pull; cd ..";
|
chdir ($REPO) or &abort("Could not chdir to $REPO!");
|
||||||
&run_command($command, "Could not update $REPO!");
|
&run_command("bk pull", "Could not update $REPO!");
|
||||||
|
chdir ($PWD) or &abort("Could not chdir to $PWD!");
|
||||||
|
|
||||||
unless ($opt_skip_manual)
|
unless ($opt_skip_manual)
|
||||||
{
|
{
|
||||||
&logger("Updating manual tree in $opt_docdir");
|
&logger("Updating manual tree in $opt_docdir");
|
||||||
$command= "cd $opt_docdir; bk pull; cd ..";
|
chdir ($opt_docdir) or &abort("Could not chdir to $opt_docdir!");
|
||||||
&run_command($command, "Could not update $opt_docdir!");
|
&run_command("bk pull", "Could not update $opt_docdir!");
|
||||||
|
chdir ($PWD) or &abort("Could not chdir to $PWD!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ static int get_options(int argc, char **argv)
|
|||||||
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
|
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
|
||||||
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
||||||
|
@ -276,7 +276,7 @@ int main(int argc,char *argv[])
|
|||||||
mysql_init(&mysql);
|
mysql_init(&mysql);
|
||||||
load_defaults("my",load_default_groups,&argc,&argv);
|
load_defaults("my",load_default_groups,&argc,&argv);
|
||||||
save_argv = argv; /* Save for free_defaults */
|
save_argv = argv; /* Save for free_defaults */
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
{
|
{
|
||||||
free_defaults(save_argv);
|
free_defaults(save_argv);
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
@ -666,7 +666,7 @@ static int parse_args(int *argc, char*** argv)
|
|||||||
|
|
||||||
result_file = stdout;
|
result_file = stdout;
|
||||||
load_defaults("my",load_default_groups,argc,argv);
|
load_defaults("my",load_default_groups,argc,argv);
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -295,7 +295,7 @@ static int get_options(int *argc, char ***argv)
|
|||||||
|
|
||||||
load_defaults("my", load_default_groups, argc, argv);
|
load_defaults("my", load_default_groups, argc, argv);
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (!what_to_do)
|
if (!what_to_do)
|
||||||
|
@ -604,7 +604,7 @@ static int get_options(int *argc, char ***argv)
|
|||||||
md_result_file= stdout;
|
md_result_file= stdout;
|
||||||
load_defaults("my",load_default_groups,argc,argv);
|
load_defaults("my",load_default_groups,argc,argv);
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
|
||||||
|
@ -228,7 +228,7 @@ static int get_options(int *argc, char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (enclosed && opt_enclosed)
|
if (enclosed && opt_enclosed)
|
||||||
|
@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
|
|||||||
load_defaults("my",load_default_groups,&argc,&argv);
|
load_defaults("my",load_default_groups,&argc,&argv);
|
||||||
default_argv= argv;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -297,7 +297,7 @@ get_options(int *argc,char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (tty_password)
|
if (tty_password)
|
||||||
|
@ -2100,7 +2100,7 @@ int parse_args(int argc, char **argv)
|
|||||||
load_defaults("my",load_default_groups,&argc,&argv);
|
load_defaults("my",load_default_groups,&argc,&argv);
|
||||||
default_argv= argv;
|
default_argv= argv;
|
||||||
|
|
||||||
if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
|
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
|
@ -2452,8 +2452,10 @@ elif test "$extra_charsets" = none; then
|
|||||||
CHARSETS="$CHARSETS"
|
CHARSETS="$CHARSETS"
|
||||||
elif test "$extra_charsets" = complex; then
|
elif test "$extra_charsets" = complex; then
|
||||||
CHARSETS="$CHARSETS $CHARSETS_COMPLEX"
|
CHARSETS="$CHARSETS $CHARSETS_COMPLEX"
|
||||||
|
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS])
|
||||||
elif test "$extra_charsets" = all; then
|
elif test "$extra_charsets" = all; then
|
||||||
CHARSETS="$CHARSETS $CHARSETS_AVAILABLE"
|
CHARSETS="$CHARSETS $CHARSETS_AVAILABLE"
|
||||||
|
AC_DEFINE([DEFINE_ALL_CHARACTER_SETS])
|
||||||
else
|
else
|
||||||
EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
|
EXTRA_CHARSETS=`echo $extra_charsets | sed -e 's/,/ /g'`
|
||||||
CHARSETS="$CHARSETS $EXTRA_CHARSETS"
|
CHARSETS="$CHARSETS $EXTRA_CHARSETS"
|
||||||
|
@ -99,7 +99,7 @@ static int get_options(int *argc,char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (*argc < 1)
|
if (*argc < 1)
|
||||||
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
progname= argv[0];
|
progname= argv[0];
|
||||||
|
|
||||||
if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL))
|
if (handle_options(&argc, &argv, my_long_options, get_one_option))
|
||||||
exit(-1);
|
exit(-1);
|
||||||
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
|
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
|
||||||
(t= atoi(argv[1])) <= 0)
|
(t= atoi(argv[1])) <= 0)
|
||||||
|
@ -157,7 +157,7 @@ static int get_options(int *argc,char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (!*argc && !print_all_codes)
|
if (!*argc && !print_all_codes)
|
||||||
|
@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (*argc == 0)
|
if (*argc == 0)
|
||||||
|
@ -54,15 +54,15 @@ struct my_option
|
|||||||
int app_type; /* To be used by an application */
|
int app_type; /* To be used by an application */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char *disabled_my_option;
|
|
||||||
extern my_bool my_getopt_print_errors;
|
|
||||||
|
|
||||||
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
|
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
|
||||||
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
|
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
|
||||||
|
|
||||||
|
extern char *disabled_my_option;
|
||||||
|
extern my_bool my_getopt_print_errors;
|
||||||
|
extern my_error_reporter my_getopt_error_reporter;
|
||||||
|
|
||||||
extern int handle_options (int *argc, char ***argv,
|
extern int handle_options (int *argc, char ***argv,
|
||||||
const struct my_option *longopts, my_get_one_option,
|
const struct my_option *longopts, my_get_one_option);
|
||||||
my_error_reporter );
|
|
||||||
extern void my_print_help(const struct my_option *options);
|
extern void my_print_help(const struct my_option *options);
|
||||||
extern void my_print_variables(const struct my_option *options);
|
extern void my_print_variables(const struct my_option *options);
|
||||||
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
||||||
|
@ -671,7 +671,7 @@ static void get_options(register int *argc, register char ***argv)
|
|||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
testflag|=T_WRITE_LOOP;
|
testflag|=T_WRITE_LOOP;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (*argc == 0)
|
if (*argc == 0)
|
||||||
|
@ -337,7 +337,7 @@ static void get_options(int *argc, char ***argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
my_progname= argv[0][0];
|
my_progname= argv[0][0];
|
||||||
|
@ -644,7 +644,7 @@ static void get_options(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -68,7 +68,7 @@ int main(int argc,char *argv[])
|
|||||||
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
|
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
|
if (error=handle_options(&argc, &argv, my_long_options, get_one_option))
|
||||||
exit(error);
|
exit(error);
|
||||||
if (count || dump)
|
if (count || dump)
|
||||||
verbose=0;
|
verbose=0;
|
||||||
|
@ -696,7 +696,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
check_param.testflag|=T_WRITE_LOOP;
|
check_param.testflag|=T_WRITE_LOOP;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
/* If using repair, then update checksum if one uses --update-state */
|
/* If using repair, then update checksum if one uses --update-state */
|
||||||
|
@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv)
|
|||||||
if (isatty(fileno(stdout)))
|
if (isatty(fileno(stdout)))
|
||||||
write_loop=1;
|
write_loop=1;
|
||||||
|
|
||||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (!*argc)
|
if (!*argc)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
drop table if exists t1,t2,t3,t4;
|
drop table if exists t1,t2,t3,t4;
|
||||||
|
drop database if exists mysqltest;
|
||||||
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
|
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
|
||||||
create table t4 (id int primary key, Word varchar(40) not null);
|
create table t4 (id int primary key, Word varchar(40) not null);
|
||||||
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
|
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
|
||||||
@ -42,6 +43,23 @@ select count(bags.a) from t1 as Bags;
|
|||||||
count(bags.a)
|
count(bags.a)
|
||||||
0
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create database mysqltest;
|
||||||
|
use MYSQLTEST;
|
||||||
|
select T1.a from MYSQLTEST.T1;
|
||||||
|
a
|
||||||
|
select t1.a from MYSQLTEST.T1;
|
||||||
|
Unknown table 't1' in field list
|
||||||
|
select mysqltest.t1.* from MYSQLTEST.t1;
|
||||||
|
a
|
||||||
|
select MYSQLTEST.t1.* from MYSQLTEST.t1;
|
||||||
|
a
|
||||||
|
select MYSQLTEST.T1.* from MYSQLTEST.T1;
|
||||||
|
a
|
||||||
|
select MYSQLTEST.T1.* from T1;
|
||||||
|
a
|
||||||
|
alter table t1 rename to T1;
|
||||||
|
select MYSQLTEST.t1.* from MYSQLTEST.t1;
|
||||||
|
drop database mysqltest;
|
||||||
create table t1 (a int);
|
create table t1 (a int);
|
||||||
create table t2 (a int);
|
create table t2 (a int);
|
||||||
delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
|
delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t2,t3,t4;
|
drop table if exists t1,t2,t3,t4;
|
||||||
|
drop database if exists mysqltest;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
|
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
|
||||||
@ -31,6 +32,23 @@ select count(T1.a) from t1;
|
|||||||
select count(bags.a) from t1 as Bags;
|
select count(bags.a) from t1 as Bags;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test all caps database name
|
||||||
|
#
|
||||||
|
create database mysqltest;
|
||||||
|
use MYSQLTEST;
|
||||||
|
create table t1 (a int);
|
||||||
|
select T1.a from MYSQLTEST.T1;
|
||||||
|
--error 1109
|
||||||
|
select t1.a from MYSQLTEST.T1;
|
||||||
|
select mysqltest.t1.* from MYSQLTEST.t1;
|
||||||
|
select MYSQLTEST.t1.* from MYSQLTEST.t1;
|
||||||
|
select MYSQLTEST.T1.* from MYSQLTEST.T1;
|
||||||
|
select MYSQLTEST.T1.* from T1;
|
||||||
|
alter table t1 rename to T1;
|
||||||
|
select MYSQLTEST.t1.* from MYSQLTEST.t1;
|
||||||
|
drop database mysqltest;
|
||||||
|
|
||||||
#
|
#
|
||||||
# multiupdate/delete & --lower-case-table-names
|
# multiupdate/delete & --lower-case-table-names
|
||||||
#
|
#
|
||||||
@ -54,13 +72,3 @@ select C.a, c.a from t1 c, t2 C;
|
|||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
show tables;
|
show tables;
|
||||||
|
|
||||||
#
|
|
||||||
# Test all caps database name
|
|
||||||
#
|
|
||||||
create table t1 (a int);
|
|
||||||
select TEST.t1.* from TEST.t1;
|
|
||||||
alter table t1 rename to T1;
|
|
||||||
select TEST.t1.* from TEST.t1;
|
|
||||||
drop table t1;
|
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include <mysys_err.h>
|
#include <mysys_err.h>
|
||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
|
|
||||||
|
static void default_reporter(enum loglevel level, const char *format, ...);
|
||||||
|
my_error_reporter my_getopt_error_reporter= &default_reporter;
|
||||||
|
|
||||||
static int findopt(char *optpat, uint length,
|
static int findopt(char *optpat, uint length,
|
||||||
const struct my_option **opt_res,
|
const struct my_option **opt_res,
|
||||||
char **ffname);
|
char **ffname);
|
||||||
@ -56,7 +59,8 @@ char *disabled_my_option= (char*) "0";
|
|||||||
|
|
||||||
my_bool my_getopt_print_errors= 1;
|
my_bool my_getopt_print_errors= 1;
|
||||||
|
|
||||||
void default_reporter(enum loglevel level, const char *format, ...)
|
static void default_reporter(enum loglevel level __attribute__((unused)),
|
||||||
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
@ -83,8 +87,8 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int handle_options(int *argc, char ***argv,
|
int handle_options(int *argc, char ***argv,
|
||||||
const struct my_option *longopts, my_get_one_option get_one_option,
|
const struct my_option *longopts,
|
||||||
my_error_reporter reporter)
|
my_get_one_option get_one_option)
|
||||||
{
|
{
|
||||||
uint opt_found, argvpos= 0, length, i;
|
uint opt_found, argvpos= 0, length, i;
|
||||||
my_bool end_of_options= 0, must_be_var, set_maximum_value,
|
my_bool end_of_options= 0, must_be_var, set_maximum_value,
|
||||||
@ -100,8 +104,6 @@ int handle_options(int *argc, char ***argv,
|
|||||||
(*argv)++; /* --- || ---- */
|
(*argv)++; /* --- || ---- */
|
||||||
init_variables(longopts);
|
init_variables(longopts);
|
||||||
|
|
||||||
if (! reporter) reporter = &default_reporter;
|
|
||||||
|
|
||||||
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
|
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
|
||||||
{
|
{
|
||||||
char *cur_arg= *pos;
|
char *cur_arg= *pos;
|
||||||
@ -125,7 +127,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: Option '-O' requires an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: Option '-O' requires an argument\n",
|
||||||
my_progname);
|
my_progname);
|
||||||
return EXIT_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
@ -142,7 +145,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!*cur_arg)
|
if (!*cur_arg)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: Option '--set-variable' requires an argument\n",
|
||||||
my_progname);
|
my_progname);
|
||||||
return EXIT_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
@ -155,7 +159,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: Option '--set-variable' requires an argument\n",
|
||||||
my_progname);
|
my_progname);
|
||||||
return EXIT_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
@ -215,10 +220,11 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (opt_found > 1)
|
if (opt_found > 1)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
|
||||||
my_progname, special_opt_prefix[i], opt_str,
|
my_progname, special_opt_prefix[i],
|
||||||
special_opt_prefix[i], prev_found);
|
cur_arg, special_opt_prefix[i],
|
||||||
|
prev_found);
|
||||||
return EXIT_AMBIGUOUS_OPTION;
|
return EXIT_AMBIGUOUS_OPTION;
|
||||||
}
|
}
|
||||||
switch (i) {
|
switch (i) {
|
||||||
@ -250,16 +256,20 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (must_be_var)
|
if (must_be_var)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
|
my_getopt_error_reporter(option_is_loose ?
|
||||||
"%s: unknown variable '%s'\n", my_progname, cur_arg);
|
WARNING_LEVEL : ERROR_LEVEL,
|
||||||
|
"%s: unknown variable '%s'\n",
|
||||||
|
my_progname, cur_arg);
|
||||||
if (!option_is_loose)
|
if (!option_is_loose)
|
||||||
return EXIT_UNKNOWN_VARIABLE;
|
return EXIT_UNKNOWN_VARIABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
|
my_getopt_error_reporter(option_is_loose ?
|
||||||
"%s: unknown option '--%s'\n", my_progname, cur_arg);
|
WARNING_LEVEL : ERROR_LEVEL,
|
||||||
|
"%s: unknown option '--%s'\n",
|
||||||
|
my_progname, cur_arg);
|
||||||
if (!option_is_loose)
|
if (!option_is_loose)
|
||||||
return EXIT_UNKNOWN_OPTION;
|
return EXIT_UNKNOWN_OPTION;
|
||||||
}
|
}
|
||||||
@ -275,15 +285,18 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (must_be_var)
|
if (must_be_var)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: variable prefix '%s' is not unique\n",
|
||||||
my_progname, opt_str);
|
my_progname, opt_str);
|
||||||
return EXIT_VAR_PREFIX_NOT_UNIQUE;
|
return EXIT_VAR_PREFIX_NOT_UNIQUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
my_progname, opt_str, prev_found, optp->name);
|
"%s: ambiguous option '--%s' (%s, %s)\n",
|
||||||
|
my_progname, opt_str, prev_found,
|
||||||
|
optp->name);
|
||||||
return EXIT_AMBIGUOUS_OPTION;
|
return EXIT_AMBIGUOUS_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +316,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG)
|
if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: option '%s' cannot take an argument\n",
|
||||||
my_progname, optp->name);
|
my_progname, optp->name);
|
||||||
return EXIT_NO_ARGUMENT_ALLOWED;
|
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||||
}
|
}
|
||||||
@ -315,7 +329,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
|
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: option '--%s' cannot take an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: option '--%s' cannot take an argument\n",
|
||||||
my_progname, optp->name);
|
my_progname, optp->name);
|
||||||
return EXIT_NO_ARGUMENT_ALLOWED;
|
return EXIT_NO_ARGUMENT_ALLOWED;
|
||||||
}
|
}
|
||||||
@ -354,7 +369,8 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!*++pos)
|
if (!*++pos)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL, "%s: option '--%s' requires an argument\n",
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
|
"%s: option '--%s' requires an argument\n",
|
||||||
my_progname, optp->name);
|
my_progname, optp->name);
|
||||||
return EXIT_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
}
|
}
|
||||||
@ -413,7 +429,7 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!pos[1])
|
if (!pos[1])
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"%s: option '-%c' requires an argument\n",
|
"%s: option '-%c' requires an argument\n",
|
||||||
my_progname, optp->id);
|
my_progname, optp->id);
|
||||||
return EXIT_ARGUMENT_REQUIRED;
|
return EXIT_ARGUMENT_REQUIRED;
|
||||||
@ -426,7 +442,7 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if ((error= setval(optp, optp->value, argument,
|
if ((error= setval(optp, optp->value, argument,
|
||||||
set_maximum_value)))
|
set_maximum_value)))
|
||||||
{
|
{
|
||||||
reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"%s: Error while setting value '%s' to '%s'\n",
|
"%s: Error while setting value '%s' to '%s'\n",
|
||||||
my_progname, argument, optp->name);
|
my_progname, argument, optp->name);
|
||||||
return error;
|
return error;
|
||||||
@ -438,8 +454,9 @@ int handle_options(int *argc, char ***argv,
|
|||||||
if (!opt_found)
|
if (!opt_found)
|
||||||
{
|
{
|
||||||
if (my_getopt_print_errors)
|
if (my_getopt_print_errors)
|
||||||
reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"%s: unknown option '-%c'\n", my_progname, *optend);
|
"%s: unknown option '-%c'\n",
|
||||||
|
my_progname, *optend);
|
||||||
return EXIT_UNKNOWN_OPTION;
|
return EXIT_UNKNOWN_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +465,7 @@ int handle_options(int *argc, char ***argv,
|
|||||||
}
|
}
|
||||||
if ((error= setval(optp, value, argument, set_maximum_value)))
|
if ((error= setval(optp, value, argument, set_maximum_value)))
|
||||||
{
|
{
|
||||||
reporter(ERROR_LEVEL,
|
my_getopt_error_reporter(ERROR_LEVEL,
|
||||||
"%s: Error while setting value '%s' to '%s'\n",
|
"%s: Error while setting value '%s' to '%s'\n",
|
||||||
my_progname, argument, optp->name);
|
my_progname, argument, optp->name);
|
||||||
return error;
|
return error;
|
||||||
|
@ -362,7 +362,7 @@ static int get_options(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
|
if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
if (argc >= 1)
|
if (argc >= 1)
|
||||||
|
117
sql/log.cc
117
sql/log.cc
@ -43,37 +43,41 @@ static bool test_if_number(const char *str,
|
|||||||
|
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
static int eventSource = 0;
|
static int eventSource = 0;
|
||||||
void setupWindowsEventSource()
|
|
||||||
{
|
|
||||||
if (eventSource) return;
|
|
||||||
|
|
||||||
eventSource = 1;
|
void setup_windows_event_source()
|
||||||
HKEY hRegKey = NULL;
|
{
|
||||||
DWORD dwError = 0;
|
HKEY hRegKey= NULL;
|
||||||
TCHAR szPath[ MAX_PATH ];
|
DWORD dwError= 0;
|
||||||
|
TCHAR szPath[MAX_PATH];
|
||||||
|
DWORD dwTypes;
|
||||||
|
|
||||||
|
if (eventSource) // Ensure that we are only called once
|
||||||
|
return;
|
||||||
|
eventSource= 1;
|
||||||
|
|
||||||
// Create the event source registry key
|
// Create the event source registry key
|
||||||
dwError = RegCreateKey(HKEY_LOCAL_MACHINE,
|
dwError= RegCreateKey(HKEY_LOCAL_MACHINE,
|
||||||
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL",
|
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL",
|
||||||
&hRegKey);
|
&hRegKey);
|
||||||
|
|
||||||
// Name of the PE module that contains the message resource
|
/* Name of the PE module that contains the message resource */
|
||||||
GetModuleFileName(NULL, szPath, MAX_PATH);
|
GetModuleFileName(NULL, szPath, MAX_PATH);
|
||||||
|
|
||||||
// Register EventMessageFile
|
/* Register EventMessageFile */
|
||||||
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
|
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
|
||||||
(PBYTE) szPath, strlen(szPath)+1);
|
(PBYTE) szPath, strlen(szPath)+1);
|
||||||
|
|
||||||
|
|
||||||
// Register supported event types
|
/* Register supported event types */
|
||||||
DWORD dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
|
dwTypes= (EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
|
||||||
dwError = RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD,
|
EVENTLOG_INFORMATION_TYPE);
|
||||||
|
dwError= RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD,
|
||||||
(LPBYTE) &dwTypes, sizeof dwTypes);
|
(LPBYTE) &dwTypes, sizeof dwTypes);
|
||||||
|
|
||||||
RegCloseKey(hRegKey);
|
RegCloseKey(hRegKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* __NT__ */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1413,13 +1417,25 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
|
|||||||
|
|
||||||
/* Write log events to reset the 'run environment' of the SQL command */
|
/* Write log events to reset the 'run environment' of the SQL command */
|
||||||
|
|
||||||
if (thd && thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
|
if (thd)
|
||||||
|
{
|
||||||
|
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS)
|
||||||
{
|
{
|
||||||
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
|
Query_log_event e(thd, "SET FOREIGN_KEY_CHECKS=1", 24, 0);
|
||||||
e.set_log_pos(this);
|
e.set_log_pos(this);
|
||||||
if (e.write(file))
|
if (e.write(file))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
#if MYSQL_VERSION_ID < 40100
|
||||||
|
if (thd->variables.convert_set)
|
||||||
|
{
|
||||||
|
Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0);
|
||||||
|
e.set_log_pos(this);
|
||||||
|
if (e.write(file))
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Tell for transactional table handlers up to which position in the
|
Tell for transactional table handlers up to which position in the
|
||||||
@ -1984,8 +2000,8 @@ void print_buffer_to_file(enum loglevel level, const char *buffer)
|
|||||||
time_t skr;
|
time_t skr;
|
||||||
struct tm tm_tmp;
|
struct tm tm_tmp;
|
||||||
struct tm *start;
|
struct tm *start;
|
||||||
|
DBUG_ENTER("print_buffer_to_file");
|
||||||
DBUG_ENTER("print_buffer_to_log");
|
DBUG_PRINT("enter",("buffer: %s", buffer));
|
||||||
|
|
||||||
VOID(pthread_mutex_lock(&LOCK_error_log));
|
VOID(pthread_mutex_lock(&LOCK_error_log));
|
||||||
|
|
||||||
@ -1999,13 +2015,13 @@ void print_buffer_to_file(enum loglevel level, const char *buffer)
|
|||||||
start->tm_hour,
|
start->tm_hour,
|
||||||
start->tm_min,
|
start->tm_min,
|
||||||
start->tm_sec,
|
start->tm_sec,
|
||||||
level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "WARNING" : "INFORMATION",
|
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||||
|
"WARNING" : "INFORMATION"),
|
||||||
buffer);
|
buffer);
|
||||||
|
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
VOID(pthread_mutex_unlock(&LOCK_error_log));
|
VOID(pthread_mutex_unlock(&LOCK_error_log));
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2019,6 +2035,7 @@ void sql_perror(const char *message)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool flush_error_log()
|
bool flush_error_log()
|
||||||
{
|
{
|
||||||
bool result=0;
|
bool result=0;
|
||||||
@ -2204,51 +2221,56 @@ void MYSQL_LOG::report_pos_in_innodb()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, int buffLen)
|
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
||||||
|
uint length, int buffLen)
|
||||||
{
|
{
|
||||||
HANDLE event;
|
HANDLE event;
|
||||||
char *buffptr;
|
char *buffptr;
|
||||||
LPCSTR *buffmsgptr;
|
LPCSTR *buffmsgptr;
|
||||||
|
|
||||||
DBUG_ENTER("print_buffer_to_nt_eventlog");
|
DBUG_ENTER("print_buffer_to_nt_eventlog");
|
||||||
|
|
||||||
buffptr = buff;
|
buffptr= buff;
|
||||||
if (strlen(buff) > (uint)(buffLen-4))
|
if (length > (uint)(buffLen-4))
|
||||||
{
|
{
|
||||||
char *newBuff = new char[ strlen(buff) + 4 ];
|
char *newBuff= new char[length + 4];
|
||||||
strcpy(newBuff, buff);
|
strcpy(newBuff, buff);
|
||||||
buffptr = newBuff;
|
buffptr= newBuff;
|
||||||
}
|
}
|
||||||
strcat(buffptr, "\r\n\r\n");
|
strmov(buffptr+length, "\r\n\r\n");
|
||||||
buffmsgptr = (LPCSTR*)&buffptr;
|
buffmsgptr= (LPCSTR*) &buffptr; // Keep windows happy
|
||||||
|
|
||||||
setupWindowsEventSource();
|
setup_windows_event_source();
|
||||||
if (event = RegisterEventSource(NULL,"MySQL"))
|
if ((event= RegisterEventSource(NULL,"MySQL")))
|
||||||
{
|
{
|
||||||
switch (level){
|
switch (level) {
|
||||||
case ERROR_LEVEL:
|
case ERROR_LEVEL:
|
||||||
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
|
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
|
||||||
|
buffmsgptr, NULL);
|
||||||
break;
|
break;
|
||||||
case WARNING_LEVEL:
|
case WARNING_LEVEL:
|
||||||
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
|
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
|
||||||
|
buffmsgptr, NULL);
|
||||||
break;
|
break;
|
||||||
case INFORMATION_LEVEL:
|
case INFORMATION_LEVEL:
|
||||||
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
|
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1,
|
||||||
|
0, buffmsgptr, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DeregisterEventSource(event);
|
DeregisterEventSource(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we created a string buffer, then delete it
|
/* if we created a string buffer, then delete it */
|
||||||
if (buffptr != buff)
|
if (buffptr != buff)
|
||||||
delete[] buffptr;
|
delete[] buffptr;
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* __NT__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Prints a printf style message to the error log and, under NT, to the Windows event log.
|
Prints a printf style message to the error log and, under NT, to the
|
||||||
|
Windows event log.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
vprint_msg_to_log()
|
vprint_msg_to_log()
|
||||||
@ -2259,27 +2281,24 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, int buffLen)
|
|||||||
NOTE
|
NOTE
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
This function prints the message into a buffer and then sends that buffer to other
|
This function prints the message into a buffer and then sends that buffer
|
||||||
functions to write that message to other logging sources.
|
to other functions to write that message to other logging sources.
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
void
|
void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
|
uint length;
|
||||||
DBUG_ENTER("vprint_msg_to_log");
|
DBUG_ENTER("vprint_msg_to_log");
|
||||||
|
|
||||||
my_vsnprintf(buff, sizeof(buff)-5, format, args);
|
length= my_vsnprintf(buff, sizeof(buff)-5, format, args);
|
||||||
|
|
||||||
print_buffer_to_file(level, buff);
|
print_buffer_to_file(level, buff);
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
|
||||||
DBUG_PRINT("error",("%s",buff));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __NT__
|
#ifdef __NT__
|
||||||
print_buffer_to_nt_eventlog(level, buff, sizeof(buff));
|
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -2288,9 +2307,9 @@ void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
|||||||
|
|
||||||
void sql_print_error(const char *format, ...)
|
void sql_print_error(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
va_list args;
|
||||||
DBUG_ENTER("sql_print_error");
|
DBUG_ENTER("sql_print_error");
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vprint_msg_to_log(ERROR_LEVEL, format, args);
|
vprint_msg_to_log(ERROR_LEVEL, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
@ -2298,11 +2317,12 @@ void sql_print_error(const char *format, ...)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sql_print_warning(const char *format, ...)
|
void sql_print_warning(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
va_list args;
|
||||||
DBUG_ENTER("sql_print_warning");
|
DBUG_ENTER("sql_print_warning");
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vprint_msg_to_log(WARNING_LEVEL, format, args);
|
vprint_msg_to_log(WARNING_LEVEL, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
@ -2310,11 +2330,12 @@ void sql_print_warning(const char *format, ...)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sql_print_information(const char *format, ...)
|
void sql_print_information(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
va_list args;
|
||||||
DBUG_ENTER("sql_print_information");
|
DBUG_ENTER("sql_print_information");
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vprint_msg_to_log(INFORMATION_LEVEL, format, args);
|
vprint_msg_to_log(INFORMATION_LEVEL, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
@ -1084,10 +1084,6 @@ end:
|
|||||||
thd->query= 0; // just to be sure
|
thd->query= 0; // just to be sure
|
||||||
thd->query_length= 0;
|
thd->query_length= 0;
|
||||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||||
// assume no convert for next query unless set explictly
|
|
||||||
#ifdef TO_BE_REMOVED
|
|
||||||
thd->variables.convert_set = 0;
|
|
||||||
#endif
|
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
|
||||||
return (thd->query_error ? thd->query_error : Log_event::exec_event(rli));
|
return (thd->query_error ? thd->query_error : Log_event::exec_event(rli));
|
||||||
|
@ -6108,14 +6108,16 @@ mysql_getopt_value(const char *keyname, uint key_length,
|
|||||||
return option->value;
|
return option->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void option_error_reporter( enum loglevel level, const char *format, ... )
|
|
||||||
|
void option_error_reporter(enum loglevel level, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start( args, format );
|
va_start(args, format);
|
||||||
vprint_msg_to_log( level, format, args );
|
vprint_msg_to_log(level, format, args);
|
||||||
va_end( args );
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void get_options(int argc,char **argv)
|
static void get_options(int argc,char **argv)
|
||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
@ -6123,7 +6125,9 @@ static void get_options(int argc,char **argv)
|
|||||||
my_getopt_register_get_addr(mysql_getopt_value);
|
my_getopt_register_get_addr(mysql_getopt_value);
|
||||||
strmake(def_ft_boolean_syntax, ft_boolean_syntax,
|
strmake(def_ft_boolean_syntax, ft_boolean_syntax,
|
||||||
sizeof(ft_boolean_syntax)-1);
|
sizeof(ft_boolean_syntax)-1);
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, option_error_reporter)))
|
my_getopt_error_reporter= option_error_reporter;
|
||||||
|
if ((ho_error= handle_options(&argc, &argv, my_long_options,
|
||||||
|
get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
{
|
{
|
||||||
|
@ -2450,13 +2450,16 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
|||||||
uint found;
|
uint found;
|
||||||
DBUG_ENTER("insert_fields");
|
DBUG_ENTER("insert_fields");
|
||||||
|
|
||||||
|
|
||||||
if (db_name && lower_case_table_names)
|
if (db_name && lower_case_table_names)
|
||||||
{
|
{
|
||||||
/* convert database to lower case for comparison */
|
/*
|
||||||
|
convert database to lower case for comparison
|
||||||
|
We can't do this in Item_field as this would change the
|
||||||
|
'name' of the item which may be used in the select list
|
||||||
|
*/
|
||||||
strmake(name_buff, db_name, sizeof(name_buff)-1);
|
strmake(name_buff, db_name, sizeof(name_buff)-1);
|
||||||
my_casedn_str(system_charset_info,name_buff);
|
my_casedn_str(name_buff);
|
||||||
db_name = name_buff;
|
db_name= name_buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
12
sql/table.cc
12
sql/table.cc
@ -1084,6 +1084,17 @@ void append_unescaped(String *res, const char *pos, uint length)
|
|||||||
|
|
||||||
for (; pos != end ; pos++)
|
for (; pos != end ; pos++)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_MB) && MYSQL_VERSION_ID < 40100
|
||||||
|
uint mblen;
|
||||||
|
if (use_mb(default_charset_info) &&
|
||||||
|
(mblen= my_ismbchar(default_charset_info, pos, end)))
|
||||||
|
{
|
||||||
|
res->append(pos, mblen);
|
||||||
|
pos+= mblen;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (*pos) {
|
switch (*pos) {
|
||||||
case 0: /* Must be escaped for 'mysql' */
|
case 0: /* Must be escaped for 'mysql' */
|
||||||
res->append('\\');
|
res->append('\\');
|
||||||
@ -1109,6 +1120,7 @@ void append_unescaped(String *res, const char *pos, uint length)
|
|||||||
res->append(*pos);
|
res->append(*pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
res->append('\'');
|
res->append('\'');
|
||||||
}
|
}
|
||||||
|
@ -1335,7 +1335,7 @@ static int parse_args(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ho_error;
|
int ho_error;
|
||||||
|
|
||||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
|
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||||
exit(ho_error);
|
exit(ho_error);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user