mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main
into a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
This commit is contained in:
commit
1569f152da
62 changed files with 3452 additions and 1441 deletions
|
@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
|||
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
|
||||
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32)
|
||||
|
||||
ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c ../mysys/my_copy.c)
|
||||
ADD_EXECUTABLE(mysqltest mysqltest.c ../mysys/my_getsystime.c
|
||||
../mysys/my_copy.c ../mysys/my_mkdir.c)
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient_notls regex wsock32)
|
||||
|
||||
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
|
||||
|
|
|
@ -88,7 +88,8 @@ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
|
|||
|
||||
mysqltest_SOURCES= mysqltest.c \
|
||||
$(top_srcdir)/mysys/my_getsystime.c \
|
||||
$(top_srcdir)/mysys/my_copy.c
|
||||
$(top_srcdir)/mysys/my_copy.c \
|
||||
$(top_srcdir)/mysys/my_mkdir.c
|
||||
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
|
||||
|
||||
mysql_upgrade_SOURCES= mysql_upgrade.c \
|
||||
|
|
|
@ -45,6 +45,10 @@
|
|||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef __WIN__
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* Use cygwin for --exec and --system before 5.0 */
|
||||
#if MYSQL_VERSION_ID < 50000
|
||||
|
@ -263,7 +267,7 @@ enum enum_commands {
|
|||
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
|
||||
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
|
||||
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
|
||||
Q_SEND_QUIT, Q_CHANGE_USER,
|
||||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
|
@ -353,6 +357,9 @@ const char *command_names[]=
|
|||
"diff_files",
|
||||
"send_quit",
|
||||
"change_user",
|
||||
"mkdir",
|
||||
"rmdir",
|
||||
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -2736,6 +2743,67 @@ void do_file_exist(struct st_command *command)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_mkdir
|
||||
command called command
|
||||
|
||||
DESCRIPTION
|
||||
mkdir <dir_name>
|
||||
Create the directory <dir_name>
|
||||
*/
|
||||
|
||||
void do_mkdir(struct st_command *command)
|
||||
{
|
||||
int error;
|
||||
static DYNAMIC_STRING ds_dirname;
|
||||
const struct command_arg mkdir_args[] = {
|
||||
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create"
|
||||
};
|
||||
DBUG_ENTER("do_mkdir");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg),
|
||||
' ');
|
||||
|
||||
DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str));
|
||||
error= my_mkdir(ds_dirname.str, 0777, MYF(0)) != 0;
|
||||
handle_command_error(command, error);
|
||||
dynstr_free(&ds_dirname);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
SYNOPSIS
|
||||
do_rmdir
|
||||
command called command
|
||||
|
||||
DESCRIPTION
|
||||
rmdir <dir_name>
|
||||
Remove the empty directory <dir_name>
|
||||
*/
|
||||
|
||||
void do_rmdir(struct st_command *command)
|
||||
{
|
||||
int error;
|
||||
static DYNAMIC_STRING ds_dirname;
|
||||
const struct command_arg rmdir_args[] = {
|
||||
"dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove"
|
||||
};
|
||||
DBUG_ENTER("do_rmdir");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg),
|
||||
' ');
|
||||
|
||||
DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
|
||||
error= rmdir(ds_dirname.str) != 0;
|
||||
handle_command_error(command, error);
|
||||
dynstr_free(&ds_dirname);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read characters from line buffer or file. This is needed to allow
|
||||
my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file
|
||||
|
@ -6913,6 +6981,8 @@ int main(int argc, char **argv)
|
|||
case Q_ECHO: do_echo(command); command_executed++; break;
|
||||
case Q_SYSTEM: do_system(command); break;
|
||||
case Q_REMOVE_FILE: do_remove_file(command); break;
|
||||
case Q_MKDIR: do_mkdir(command); break;
|
||||
case Q_RMDIR: do_rmdir(command); break;
|
||||
case Q_FILE_EXIST: do_file_exist(command); break;
|
||||
case Q_WRITE_FILE: do_write_file(command); break;
|
||||
case Q_APPEND_FILE: do_append_file(command); break;
|
||||
|
|
21
configure.in
21
configure.in
|
@ -813,8 +813,8 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
|
|||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
||||
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
|
||||
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
|
||||
sys/prctl.h \
|
||||
sys/resource.h sys/param.h port.h ieeefp.h)
|
||||
sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h \
|
||||
execinfo.h)
|
||||
|
||||
AC_CHECK_HEADERS([xfs/xfs.h])
|
||||
|
||||
|
@ -2041,7 +2041,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
|||
sighold sigset sigthreadmask port_create sleep \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
|
||||
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
posix_fallocate)
|
||||
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -2331,6 +2331,21 @@ then
|
|||
fi
|
||||
AC_MSG_RESULT("$netinet_inc")
|
||||
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_CHECK_HEADERS(cxxabi.h)
|
||||
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
|
||||
[AC_TRY_LINK([#include <cxxabi.h>], [
|
||||
char *foo= 0; int bar= 0;
|
||||
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
|
||||
], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
|
||||
AC_LANG_RESTORE
|
||||
|
||||
if test "x$mysql_cv_cxa_demangle" = xyes; then
|
||||
AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
|
||||
[Define to 1 if you have the `abi::__cxa_demangle' function.])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for requested features
|
||||
#--------------------------------------------------------------------
|
||||
|
|
|
@ -108,6 +108,23 @@ drop table t1;
|
|||
set global binlog_cache_size=@bcs;
|
||||
set session autocommit = @ac;
|
||||
|
||||
#
|
||||
# Bug#33798: prepared statements improperly handle large unsigned ints
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
execute stmt using @a, @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
||||
show binlog events from 0;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
|
|
|
@ -1743,4 +1743,50 @@ t1 CREATE TABLE `t1` (
|
|||
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
|
||||
# --
|
||||
# -- Bug#21380: DEFAULT definition not always transfered by CREATE
|
||||
# -- TABLE/SELECT to the new table.
|
||||
# --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
CREATE TABLE t1(
|
||||
c1 INT DEFAULT 12 COMMENT 'column1',
|
||||
c2 INT NULL COMMENT 'column2',
|
||||
c3 INT NOT NULL COMMENT 'column3',
|
||||
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
|
||||
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
|
||||
c6 VARCHAR(255))
|
||||
COLLATE latin1_bin;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) DEFAULT '12' COMMENT 'column1',
|
||||
`c2` int(11) DEFAULT NULL COMMENT 'column2',
|
||||
`c3` int(11) NOT NULL COMMENT 'column3',
|
||||
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
|
||||
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
|
||||
`c6` varchar(255) COLLATE latin1_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
|
||||
|
||||
CREATE TABLE t2 AS SELECT * FROM t1;
|
||||
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c1` int(11) DEFAULT '12' COMMENT 'column1',
|
||||
`c2` int(11) DEFAULT NULL COMMENT 'column2',
|
||||
`c3` int(11) NOT NULL COMMENT 'column3',
|
||||
`c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
|
||||
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
|
||||
`c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
DROP TABLE t2;
|
||||
|
||||
# -- End of test case for Bug#21380.
|
||||
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -722,4 +722,17 @@ DROP USER mysqltest_u1@localhost;
|
|||
#
|
||||
#####################################################################
|
||||
|
||||
drop procedure if exists p;
|
||||
set @old_mode= @@sql_mode;
|
||||
set @@sql_mode= pow(2,32)-1;
|
||||
create event e1 on schedule every 1 day do select 1;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
set @@sql_mode= @old_mode;
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
||||
name
|
||||
drop event e1;
|
||||
DROP DATABASE events_test;
|
||||
|
|
|
@ -1218,6 +1218,28 @@ DROP USER mysqltest_1@localhost;
|
|||
DROP DATABASE db27878;
|
||||
use test;
|
||||
DROP TABLE t1;
|
||||
drop table if exists test;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test'
|
||||
drop function if exists test_function;
|
||||
Warnings:
|
||||
Note 1305 FUNCTION test_function does not exist
|
||||
drop view if exists v1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.v1'
|
||||
create table test (col1 varchar(30));
|
||||
create function test_function() returns varchar(30)
|
||||
begin
|
||||
declare tmp varchar(30);
|
||||
select col1 from test limit 1 into tmp;
|
||||
return '1';
|
||||
end|
|
||||
create view v1 as select test.* from test where test.col1=test_function();
|
||||
grant update (col1) on v1 to 'greg'@'localhost';
|
||||
drop user 'greg'@'localhost';
|
||||
drop view v1;
|
||||
drop table test;
|
||||
drop function test_function;
|
||||
End of 5.0 tests
|
||||
set names utf8;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
|
@ -1282,5 +1304,6 @@ CALL mysqltest1.test();
|
|||
1
|
||||
DROP DATABASE mysqltest1;
|
||||
RENAME TABLE mysql.procs_gone TO mysql.procs_priv;
|
||||
DROP USER mysqltest_1@localhost;
|
||||
FLUSH PRIVILEGES;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -588,7 +588,7 @@ proc body longblob
|
|||
proc definer char(77)
|
||||
proc created timestamp
|
||||
proc modified timestamp
|
||||
proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE')
|
||||
proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')
|
||||
proc comment char(64)
|
||||
proc character_set_client char(32)
|
||||
proc collation_connection char(32)
|
||||
|
@ -1623,4 +1623,19 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
|
|||
show events where Db= 'information_schema';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
use test;
|
||||
#
|
||||
# Bug#34166: Server crash in SHOW OPEN TABLES and prelocking
|
||||
#
|
||||
drop table if exists t1;
|
||||
drop function if exists f1;
|
||||
create table t1 (a int);
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 (a) values (1);
|
||||
return 0;
|
||||
end|
|
||||
show open tables where f1()=0;
|
||||
show open tables where f1()=0;
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
End of 5.1 tests.
|
||||
|
|
|
@ -143,4 +143,14 @@ connection: default
|
|||
flush tables;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
lock tables t1 read;
|
||||
insert into t1 values(1);;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
select @tlwa < @tlwb;
|
||||
@tlwa < @tlwb
|
||||
1
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1717,6 +1717,22 @@ t1 CREATE TABLE `t1` (
|
|||
`?` decimal(2,1) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
insert into t1 values (@a, @b);
|
||||
select * from t1 where a = @a and b = @b;
|
||||
a b
|
||||
9999999999999999 14632475938453979136
|
||||
execute stmt using @a, @b;
|
||||
select * from t1 where a = @a and b = @b;
|
||||
a b
|
||||
9999999999999999 14632475938453979136
|
||||
9999999999999999 14632475938453979136
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
create procedure proc_1() reset query cache;
|
||||
call proc_1();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1427,4 +1427,9 @@ DROP FUNCTION f1;
|
|||
DROP TABLE t1;
|
||||
DROP EVENT ev1;
|
||||
SHOW TABLE TYPES;
|
||||
CREATE USER test_u@localhost;
|
||||
GRANT PROCESS ON *.* TO test_u@localhost;
|
||||
SHOW ENGINE MYISAM MUTEX;
|
||||
SHOW ENGINE MYISAM STATUS;
|
||||
DROP USER test_u@localhost;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1627,3 +1627,14 @@ end loop label1;
|
|||
end loop;
|
||||
end|
|
||||
ERROR 42000: End-label label1 without match
|
||||
drop procedure if exists p1;
|
||||
create procedure p1()
|
||||
begin
|
||||
create table t1 (a int) type=MyISAM;
|
||||
drop table t1;
|
||||
end|
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 5.2. Please use 'ENGINE=storage_engine' instead
|
||||
call p1();
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
|
|
|
@ -6963,6 +6963,22 @@ END latin1 latin1_swedish_ci latin1_swedish_ci
|
|||
|
||||
DROP FUNCTION f1;
|
||||
|
||||
drop procedure if exists p;
|
||||
set @old_mode= @@sql_mode;
|
||||
set @@sql_mode= pow(2,32)-1;
|
||||
select @@sql_mode into @full_mode;
|
||||
create procedure p() begin end;
|
||||
call p();
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
|
||||
set @@sql_mode= @old_mode;
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
|
||||
name
|
||||
p
|
||||
drop procedure p;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
@ -201,7 +201,7 @@ proc CREATE TABLE `proc` (
|
|||
`definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
|
@ -226,7 +226,7 @@ event CREATE TABLE `event` (
|
|||
`ends` datetime DEFAULT NULL,
|
||||
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
|
||||
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`originator` int(10) NOT NULL,
|
||||
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
|
||||
|
|
|
@ -1072,6 +1072,22 @@ master-bin.000001 30301 Rotate 1 30345 master-bin.000002;pos=4
|
|||
drop table t1;
|
||||
set global binlog_cache_size=@bcs;
|
||||
set session autocommit = @ac;
|
||||
drop table if exists t1;
|
||||
reset master;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
execute stmt using @a, @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
show binlog events from 0;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 227 Table_map 1 269 table_id: # (test.t1)
|
||||
master-bin.000001 269 Write_rows 1 315 table_id: # flags: STMT_END_F
|
||||
master-bin.000001 315 Query 1 391 use `test`; drop table t1
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
|
|
@ -579,6 +579,21 @@ master-bin.000001 36593 Rotate 1 36637 master-bin.000002;pos=4
|
|||
drop table t1;
|
||||
set global binlog_cache_size=@bcs;
|
||||
set session autocommit = @ac;
|
||||
drop table if exists t1;
|
||||
reset master;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
execute stmt using @a, @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
show binlog events from 0;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4
|
||||
master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 351 Query 1 427 use `test`; drop table t1
|
||||
End of 5.0 tests
|
||||
reset master;
|
||||
create table t1 (id tinyint auto_increment primary key);
|
||||
|
|
|
@ -20,3 +20,8 @@ rpl_ndb_mix_innodb : Bug #32720 Test rpl_ndb_mix_innodb fails on SPARC a
|
|||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
|
||||
#rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly
|
||||
|
||||
|
||||
rpl_ndb_innodb_trans : Bug#34454: Some test cases from the 'rpl_ndb' suite fail
|
||||
rpl_ndb_charset : Bug#34454: Some test cases from the 'rpl_ndb' suite fail
|
||||
rpl_ndb_multi : Bug#34454: Some test cases from the 'rpl_ndb' suite fail
|
||||
|
|
|
@ -1341,4 +1341,48 @@ create table t1 like information_schema.character_sets;
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
|
||||
--echo # -- TABLE/SELECT to the new table.
|
||||
--echo # --
|
||||
--echo
|
||||
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1(
|
||||
c1 INT DEFAULT 12 COMMENT 'column1',
|
||||
c2 INT NULL COMMENT 'column2',
|
||||
c3 INT NOT NULL COMMENT 'column3',
|
||||
c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
|
||||
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
|
||||
c6 VARCHAR(255))
|
||||
COLLATE latin1_bin;
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t2 AS SELECT * FROM t1;
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE TABLE t2;
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t2;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#21380.
|
||||
--echo
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -23,3 +23,4 @@ wait_timeout : Bug#32801 wait_timeout.test fails randomly
|
|||
ctype_create : Bug#32965 main.ctype_create fails
|
||||
status : Bug#32966 main.status fails
|
||||
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
|
||||
query_cache_debug : Bug#34424: query_cache_debug.test leads to valgrind warnings
|
||||
|
|
|
@ -935,6 +935,26 @@ DROP USER mysqltest_u1@localhost;
|
|||
--echo #####################################################################
|
||||
--echo
|
||||
|
||||
#
|
||||
# Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
|
||||
#
|
||||
# Ensure that when new SQL modes are introduced, they are also added to
|
||||
# the mysql.event table.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p;
|
||||
--enable_warnings
|
||||
set @old_mode= @@sql_mode;
|
||||
set @@sql_mode= pow(2,32)-1;
|
||||
create event e1 on schedule every 1 day do select 1;
|
||||
select @@sql_mode;
|
||||
set @@sql_mode= @old_mode;
|
||||
# Rename SQL modes that differ in name between the server and the table definition.
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.event where name = 'p' and sql_mode = @full_mode;
|
||||
drop event e1;
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
|
|
|
@ -1266,6 +1266,28 @@ DROP DATABASE db27878;
|
|||
use test;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #33201 Crash occurs when granting update privilege on one column of a view
|
||||
#
|
||||
drop table if exists test;
|
||||
drop function if exists test_function;
|
||||
drop view if exists v1;
|
||||
create table test (col1 varchar(30));
|
||||
delimiter |;
|
||||
create function test_function() returns varchar(30)
|
||||
begin
|
||||
declare tmp varchar(30);
|
||||
select col1 from test limit 1 into tmp;
|
||||
return '1';
|
||||
end|
|
||||
delimiter ;|
|
||||
create view v1 as select test.* from test where test.col1=test_function();
|
||||
grant update (col1) on v1 to 'greg'@'localhost';
|
||||
drop user 'greg'@'localhost';
|
||||
drop view v1;
|
||||
drop table test;
|
||||
drop function test_function;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -1374,6 +1396,7 @@ GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
|
|||
CALL mysqltest1.test();
|
||||
DROP DATABASE mysqltest1;
|
||||
RENAME TABLE mysql.procs_gone TO mysql.procs_priv;
|
||||
DROP USER mysqltest_1@localhost;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
|
||||
|
|
|
@ -1248,4 +1248,26 @@ show events from information_schema;
|
|||
show events where Db= 'information_schema';
|
||||
use test;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#34166: Server crash in SHOW OPEN TABLES and prelocking
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop function if exists f1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 (a) values (1);
|
||||
return 0;
|
||||
end|
|
||||
delimiter ;|
|
||||
--disable_result_log
|
||||
show open tables where f1()=0;
|
||||
show open tables where f1()=0;
|
||||
--enable_result_log
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
|
|
@ -439,4 +439,34 @@ connection default;
|
|||
disconnect flush;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#30331: Table_locks_waited shows inaccurate values
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
lock tables t1 read;
|
||||
let $tlwa= `show status like 'Table_locks_waited'`;
|
||||
connect (waiter,localhost,root,,);
|
||||
connection waiter;
|
||||
--send insert into t1 values(1);
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "insert into t1 values(1)";
|
||||
--source include/wait_condition.inc
|
||||
let $tlwb= `show status like 'Table_locks_waited'`;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
disconnect waiter;
|
||||
connection default;
|
||||
--disable_query_log
|
||||
eval SET @tlwa= SUBSTRING_INDEX('$tlwa', ' ', -1);
|
||||
eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1);
|
||||
--enable_query_log
|
||||
select @tlwa < @tlwb;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -2101,5 +2101,28 @@ drop table t1;
|
|||
--change_user root,,
|
||||
--change_user root,,test
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test mkdir and rmdir command
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
|
||||
# Directory already exist
|
||||
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
--error 1
|
||||
mkdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
|
||||
# Remove dir with file inside
|
||||
write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
|
||||
hello
|
||||
EOF
|
||||
--error 1
|
||||
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
|
||||
rmdir $MYSQLTEST_VARDIR/tmp/testdir;
|
||||
|
||||
|
||||
--echo End of tests
|
||||
|
||||
|
|
|
@ -1821,6 +1821,23 @@ execute stmt using @a;
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#33798: prepared statements improperly handle large unsigned ints
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
insert into t1 values (@a, @b);
|
||||
select * from t1 where a = @a and b = @b;
|
||||
execute stmt using @a, @b;
|
||||
select * from t1 where a = @a and b = @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1115,5 +1115,24 @@ DROP EVENT ev1;
|
|||
SHOW TABLE TYPES;
|
||||
--enable_result_log
|
||||
|
||||
#
|
||||
# Bug #32710: SHOW INNODB STATUS requires SUPER
|
||||
#
|
||||
|
||||
|
||||
CREATE USER test_u@localhost;
|
||||
GRANT PROCESS ON *.* TO test_u@localhost;
|
||||
|
||||
connect (conn1, localhost, test_u,,);
|
||||
|
||||
--disable_result_log
|
||||
SHOW ENGINE MYISAM MUTEX;
|
||||
SHOW ENGINE MYISAM STATUS;
|
||||
--enable_result_log
|
||||
|
||||
disconnect conn1;
|
||||
connection default;
|
||||
DROP USER test_u@localhost;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -2368,6 +2368,24 @@ end|
|
|||
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# Bug#21801: SQL exception handlers and warnings
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
delimiter |;
|
||||
create procedure p1()
|
||||
begin
|
||||
create table t1 (a int) type=MyISAM;
|
||||
drop table t1;
|
||||
end|
|
||||
delimiter ;|
|
||||
call p1();
|
||||
call p1();
|
||||
drop procedure p1;
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
|
|
@ -8135,6 +8135,29 @@ DROP FUNCTION f1;
|
|||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
|
||||
#
|
||||
# Ensure that when new SQL modes are introduced, they are also added to
|
||||
# the mysql.proc table.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p;
|
||||
--enable_warnings
|
||||
set @old_mode= @@sql_mode;
|
||||
set @@sql_mode= pow(2,32)-1;
|
||||
select @@sql_mode into @full_mode;
|
||||
create procedure p() begin end;
|
||||
call p();
|
||||
select @@sql_mode;
|
||||
set @@sql_mode= @old_mode;
|
||||
# Rename SQL modes that differ in name between the server and the table definition.
|
||||
select replace(@full_mode, '?', 'NOT_USED') into @full_mode;
|
||||
select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
|
||||
select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
|
||||
drop procedure p;
|
||||
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo # -- End of 5.1 tests
|
||||
--echo # ------------------------------------------------------------------
|
||||
|
|
|
@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NU
|
|||
|
||||
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
||||
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
-- source include/not_embedded.inc
|
||||
|
||||
# Temporary disabled on windows,
|
||||
# because of --exec mkdir
|
||||
# TODO: implement Bug#31004 and remove this limitation
|
||||
--source include/not_windows.inc
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists `mysqltest1`;
|
||||
drop database if exists `mysqltest-1`;
|
||||
|
@ -75,7 +70,7 @@ create table tabc.t1 (a int);
|
|||
FLUSH TABLES;
|
||||
|
||||
# Manually make a 5.0 database from the template
|
||||
--exec mkdir $MYSQLTEST_VARDIR/master-data/a-b-c
|
||||
--mkdir $MYSQLTEST_VARDIR/master-data/a-b-c
|
||||
--copy_file $MYSQLTEST_VARDIR/master-data/tabc/db.opt $MYSQLTEST_VARDIR/master-data/a-b-c/db.opt
|
||||
--copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.frm $MYSQLTEST_VARDIR/master-data/a-b-c/t1.frm
|
||||
--copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYD $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYD
|
||||
|
|
|
@ -405,6 +405,8 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
|
|||
wait->last= &data->next;
|
||||
}
|
||||
|
||||
statistic_increment(locks_waited, &THR_LOCK_lock);
|
||||
|
||||
/* Set up control struct to allow others to abort locks */
|
||||
thread_var->current_mutex= &data->lock->mutex;
|
||||
thread_var->current_cond= cond;
|
||||
|
@ -469,7 +471,6 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
|
|||
else
|
||||
{
|
||||
result= THR_LOCK_SUCCESS;
|
||||
statistic_increment(locks_waited, &THR_LOCK_lock);
|
||||
if (data->lock->get_status)
|
||||
(*data->lock->get_status)(data->status_param, 0);
|
||||
check_locks(data->lock,"got wait_for_lock",0);
|
||||
|
|
|
@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign
|
|||
CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
|
||||
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
||||
|
||||
|
@ -80,7 +80,7 @@ PREPARE stmt FROM @str;
|
|||
EXECUTE stmt;
|
||||
DROP PREPARE stmt;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
||||
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
|
||||
|
|
|
@ -375,7 +375,9 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
|
|||
'ERROR_FOR_DIVISION_BY_ZERO',
|
||||
'TRADITIONAL',
|
||||
'NO_AUTO_CREATE_USER',
|
||||
'HIGH_NOT_PRECEDENCE'
|
||||
'HIGH_NOT_PRECEDENCE',
|
||||
'NO_ENGINE_SUBSTITUTION',
|
||||
'PAD_CHAR_TO_FULL_LENGTH'
|
||||
) DEFAULT '' NOT NULL,
|
||||
DEFAULT CHARACTER SET utf8;
|
||||
|
||||
|
@ -461,7 +463,9 @@ ALTER TABLE event ADD sql_mode
|
|||
'ERROR_FOR_DIVISION_BY_ZERO',
|
||||
'TRADITIONAL',
|
||||
'NO_AUTO_CREATE_USER',
|
||||
'HIGH_NOT_PRECEDENCE'
|
||||
'HIGH_NOT_PRECEDENCE',
|
||||
'NO_ENGINE_SUBSTITUTION',
|
||||
'PAD_CHAR_TO_FULL_LENGTH'
|
||||
) DEFAULT '' NOT NULL AFTER on_completion;
|
||||
ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
|
||||
ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL AFTER comment;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <my_user.h>
|
||||
#include <m_string.h>
|
||||
|
||||
#include <mysql_com.h>
|
||||
|
||||
/*
|
||||
Parse user value to user name and host name parts.
|
||||
|
@ -47,6 +47,12 @@ void parse_user(const char *user_id_str, size_t user_id_len,
|
|||
*user_name_len= p - user_id_str;
|
||||
*host_name_len= user_id_len - *user_name_len - 1;
|
||||
|
||||
if (*user_name_len > USERNAME_LENGTH)
|
||||
*user_name_len= USERNAME_LENGTH;
|
||||
|
||||
if (*host_name_len > HOSTNAME_LENGTH)
|
||||
*host_name_len= HOSTNAME_LENGTH;
|
||||
|
||||
memcpy(user_name_str, user_id_str, *user_name_len);
|
||||
memcpy(host_name_str, p + 1, *host_name_len);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] =
|
|||
"'ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES',"
|
||||
"'STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES',"
|
||||
"'ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER',"
|
||||
"'HIGH_NOT_PRECEDENCE')") },
|
||||
"'HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')") },
|
||||
{NULL, 0}
|
||||
},
|
||||
{
|
||||
|
@ -172,11 +172,13 @@ mysql_event_fill_row(THD *thd,
|
|||
TABLE *table,
|
||||
Event_parse_data *et,
|
||||
sp_head *sp,
|
||||
ulong sql_mode,
|
||||
my_bool is_update)
|
||||
{
|
||||
CHARSET_INFO *scs= system_charset_info;
|
||||
enum enum_events_table_field f_num;
|
||||
Field **fields= table->field;
|
||||
int rs= FALSE;
|
||||
|
||||
DBUG_ENTER("mysql_event_fill_row");
|
||||
|
||||
|
@ -205,12 +207,9 @@ mysql_event_fill_row(THD *thd,
|
|||
goto err_truncate;
|
||||
|
||||
/* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
|
||||
fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
|
||||
|
||||
fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
|
||||
fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
|
||||
|
||||
rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
|
||||
rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
|
||||
|
||||
/*
|
||||
Change the SQL_MODE only if body was present in an ALTER EVENT and of course
|
||||
|
@ -220,7 +219,7 @@ mysql_event_fill_row(THD *thd,
|
|||
{
|
||||
DBUG_ASSERT(sp->m_body.str);
|
||||
|
||||
fields[ET_FIELD_SQL_MODE]->store((longlong)thd->variables.sql_mode, TRUE);
|
||||
rs|= fields[ET_FIELD_SQL_MODE]->store((longlong)sql_mode, TRUE);
|
||||
|
||||
if (fields[f_num= ET_FIELD_BODY]->store(sp->m_body.str,
|
||||
sp->m_body.length,
|
||||
|
@ -236,16 +235,16 @@ mysql_event_fill_row(THD *thd,
|
|||
if (!is_update || !et->starts_null)
|
||||
{
|
||||
fields[ET_FIELD_TIME_ZONE]->set_notnull();
|
||||
fields[ET_FIELD_TIME_ZONE]->store(tz_name->ptr(), tz_name->length(),
|
||||
rs|= fields[ET_FIELD_TIME_ZONE]->store(tz_name->ptr(), tz_name->length(),
|
||||
tz_name->charset());
|
||||
}
|
||||
|
||||
fields[ET_FIELD_INTERVAL_EXPR]->set_notnull();
|
||||
fields[ET_FIELD_INTERVAL_EXPR]->store((longlong)et->expression, TRUE);
|
||||
rs|= fields[ET_FIELD_INTERVAL_EXPR]->store((longlong)et->expression, TRUE);
|
||||
|
||||
fields[ET_FIELD_TRANSIENT_INTERVAL]->set_notnull();
|
||||
|
||||
fields[ET_FIELD_TRANSIENT_INTERVAL]->
|
||||
rs|= fields[ET_FIELD_TRANSIENT_INTERVAL]->
|
||||
store(interval_type_to_name[et->interval].str,
|
||||
interval_type_to_name[et->interval].length,
|
||||
scs);
|
||||
|
@ -274,7 +273,7 @@ mysql_event_fill_row(THD *thd,
|
|||
{
|
||||
const String *tz_name= thd->variables.time_zone->get_name();
|
||||
fields[ET_FIELD_TIME_ZONE]->set_notnull();
|
||||
fields[ET_FIELD_TIME_ZONE]->store(tz_name->ptr(), tz_name->length(),
|
||||
rs|= fields[ET_FIELD_TIME_ZONE]->store(tz_name->ptr(), tz_name->length(),
|
||||
tz_name->charset());
|
||||
|
||||
fields[ET_FIELD_INTERVAL_EXPR]->set_null();
|
||||
|
@ -308,13 +307,13 @@ mysql_event_fill_row(THD *thd,
|
|||
}
|
||||
|
||||
fields[ET_FIELD_CHARACTER_SET_CLIENT]->set_notnull();
|
||||
fields[ET_FIELD_CHARACTER_SET_CLIENT]->store(
|
||||
rs|= fields[ET_FIELD_CHARACTER_SET_CLIENT]->store(
|
||||
thd->variables.character_set_client->csname,
|
||||
strlen(thd->variables.character_set_client->csname),
|
||||
system_charset_info);
|
||||
|
||||
fields[ET_FIELD_COLLATION_CONNECTION]->set_notnull();
|
||||
fields[ET_FIELD_COLLATION_CONNECTION]->store(
|
||||
rs|= fields[ET_FIELD_COLLATION_CONNECTION]->store(
|
||||
thd->variables.collation_connection->name,
|
||||
strlen(thd->variables.collation_connection->name),
|
||||
system_charset_info);
|
||||
|
@ -323,15 +322,23 @@ mysql_event_fill_row(THD *thd,
|
|||
CHARSET_INFO *db_cl= get_default_db_collation(thd, et->dbname.str);
|
||||
|
||||
fields[ET_FIELD_DB_COLLATION]->set_notnull();
|
||||
fields[ET_FIELD_DB_COLLATION]->store(
|
||||
db_cl->name, strlen(db_cl->name), system_charset_info);
|
||||
rs|= fields[ET_FIELD_DB_COLLATION]->store(db_cl->name,
|
||||
strlen(db_cl->name),
|
||||
system_charset_info);
|
||||
}
|
||||
|
||||
if (et->body_changed)
|
||||
{
|
||||
fields[ET_FIELD_BODY_UTF8]->set_notnull();
|
||||
fields[ET_FIELD_BODY_UTF8]->store(
|
||||
sp->m_body_utf8.str, sp->m_body_utf8.length, system_charset_info);
|
||||
rs|= fields[ET_FIELD_BODY_UTF8]->store(sp->m_body_utf8.str,
|
||||
sp->m_body_utf8.length,
|
||||
system_charset_info);
|
||||
}
|
||||
|
||||
if (rs)
|
||||
{
|
||||
my_error(ER_EVENT_STORE_FAILED, MYF(0), fields[f_num]->field_name, rs);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -585,12 +592,16 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
int ret= 1;
|
||||
TABLE *table= NULL;
|
||||
sp_head *sp= thd->lex->sphead;
|
||||
ulong saved_mode= thd->variables.sql_mode;
|
||||
|
||||
DBUG_ENTER("Event_db_repository::create_event");
|
||||
|
||||
DBUG_PRINT("info", ("open mysql.event for update"));
|
||||
DBUG_ASSERT(sp);
|
||||
|
||||
/* Reset sql_mode during data dictionary operations. */
|
||||
thd->variables.sql_mode= 0;
|
||||
|
||||
if (open_event_table(thd, TL_WRITE, &table))
|
||||
goto end;
|
||||
|
||||
|
@ -646,7 +657,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
mysql_event_fill_row() calls my_error() in case of error so no need to
|
||||
handle it here
|
||||
*/
|
||||
if (mysql_event_fill_row(thd, table, parse_data, sp, FALSE))
|
||||
if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE))
|
||||
goto end;
|
||||
|
||||
table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
|
||||
|
@ -661,6 +672,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
end:
|
||||
if (table)
|
||||
close_thread_tables(thd);
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
DBUG_RETURN(test(ret));
|
||||
}
|
||||
|
||||
|
@ -691,6 +703,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
CHARSET_INFO *scs= system_charset_info;
|
||||
TABLE *table= NULL;
|
||||
sp_head *sp= thd->lex->sphead;
|
||||
ulong saved_mode= thd->variables.sql_mode;
|
||||
int ret= 1;
|
||||
|
||||
DBUG_ENTER("Event_db_repository::update_event");
|
||||
|
@ -698,6 +711,9 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
/* None or both must be set */
|
||||
DBUG_ASSERT(new_dbname && new_name || new_dbname == new_name);
|
||||
|
||||
/* Reset sql_mode during data dictionary operations. */
|
||||
thd->variables.sql_mode= 0;
|
||||
|
||||
if (open_event_table(thd, TL_WRITE, &table))
|
||||
goto end;
|
||||
|
||||
|
@ -736,7 +752,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
mysql_event_fill_row() calls my_error() in case of error so no need to
|
||||
handle it here
|
||||
*/
|
||||
if (mysql_event_fill_row(thd, table, parse_data, sp, TRUE))
|
||||
if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, TRUE))
|
||||
goto end;
|
||||
|
||||
if (new_dbname)
|
||||
|
@ -755,6 +771,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
end:
|
||||
if (table)
|
||||
close_thread_tables(thd);
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
DBUG_RETURN(test(ret));
|
||||
}
|
||||
|
||||
|
@ -950,13 +967,17 @@ bool
|
|||
Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname,
|
||||
LEX_STRING name, Event_basic *etn)
|
||||
{
|
||||
TABLE *table= NULL;
|
||||
bool ret;
|
||||
TABLE *table= NULL;
|
||||
ulong saved_mode= thd->variables.sql_mode;
|
||||
|
||||
DBUG_ENTER("Event_db_repository::load_named_event");
|
||||
DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd,
|
||||
(int) name.length, name.str));
|
||||
|
||||
/* Reset sql_mode during data dictionary operations. */
|
||||
thd->variables.sql_mode= 0;
|
||||
|
||||
if (!(ret= open_event_table(thd, TL_READ, &table)))
|
||||
{
|
||||
if ((ret= find_named_event(dbname, name, table)))
|
||||
|
@ -967,7 +988,7 @@ Event_db_repository::load_named_event(THD *thd, LEX_STRING dbname,
|
|||
close_thread_tables(thd);
|
||||
}
|
||||
|
||||
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -2628,6 +2628,7 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry)
|
|||
if (entry && entry->value)
|
||||
{
|
||||
item_result_type= entry->type;
|
||||
unsigned_flag= entry->unsigned_flag;
|
||||
if (strict_type && required_result_type != item_result_type)
|
||||
DBUG_RETURN(1);
|
||||
switch (item_result_type) {
|
||||
|
@ -2925,7 +2926,7 @@ const String *Item_param::query_val_str(String* str) const
|
|||
{
|
||||
switch (state) {
|
||||
case INT_VALUE:
|
||||
str->set(value.integer, &my_charset_bin);
|
||||
str->set_int(value.integer, unsigned_flag, &my_charset_bin);
|
||||
break;
|
||||
case REAL_VALUE:
|
||||
str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin);
|
||||
|
|
23
sql/log.cc
23
sql/log.cc
|
@ -73,23 +73,28 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all);
|
|||
*/
|
||||
class Silence_log_table_errors : public Internal_error_handler
|
||||
{
|
||||
char m_message[MYSQL_ERRMSG_SIZE];
|
||||
public:
|
||||
Silence_log_table_errors()
|
||||
{}
|
||||
{
|
||||
m_message[0]= '\0';
|
||||
}
|
||||
|
||||
virtual ~Silence_log_table_errors() {}
|
||||
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd);
|
||||
const char *message() const { return m_message; }
|
||||
};
|
||||
|
||||
bool
|
||||
Silence_log_table_errors::handle_error(uint /* sql_errno */,
|
||||
const char * /* message */,
|
||||
const char *message_arg,
|
||||
MYSQL_ERROR::enum_warning_level /* level */,
|
||||
THD * /* thd */)
|
||||
{
|
||||
strmake(m_message, message_arg, sizeof(m_message)-1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -436,8 +441,9 @@ bool Log_to_csv_event_handler::
|
|||
result= FALSE;
|
||||
|
||||
err:
|
||||
if (result)
|
||||
sql_print_error("Failed to write to mysql.general_log");
|
||||
if (result && !thd->killed)
|
||||
sql_print_error("Failed to write to mysql.general_log: %s",
|
||||
error_handler.message());
|
||||
|
||||
if (need_rnd_end)
|
||||
{
|
||||
|
@ -495,11 +501,13 @@ bool Log_to_csv_event_handler::
|
|||
bool result= TRUE;
|
||||
bool need_close= FALSE;
|
||||
bool need_rnd_end= FALSE;
|
||||
Silence_log_table_errors error_handler;
|
||||
Open_tables_state open_tables_backup;
|
||||
CHARSET_INFO *client_cs= thd->variables.character_set_client;
|
||||
bool save_time_zone_used;
|
||||
DBUG_ENTER("Log_to_csv_event_handler::log_slow");
|
||||
|
||||
thd->push_internal_handler(& error_handler);
|
||||
/*
|
||||
CSV uses TIME_to_timestamp() internally if table needs to be repaired
|
||||
which will set thd->time_zone_used
|
||||
|
@ -629,8 +637,11 @@ bool Log_to_csv_event_handler::
|
|||
result= FALSE;
|
||||
|
||||
err:
|
||||
if (result)
|
||||
sql_print_error("Failed to write to mysql.slow_log");
|
||||
thd->pop_internal_handler();
|
||||
|
||||
if (result && !thd->killed)
|
||||
sql_print_error("Failed to write to mysql.slow_log: %s",
|
||||
error_handler.message());
|
||||
|
||||
if (need_rnd_end)
|
||||
{
|
||||
|
|
|
@ -1034,7 +1034,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
|||
bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
|
||||
bool no_grant, bool no_errors, bool schema_db);
|
||||
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
bool no_errors);
|
||||
uint number, bool no_errors);
|
||||
bool check_global_access(THD *thd, ulong want_access);
|
||||
#else
|
||||
inline bool check_access(THD *thd, ulong access, const char *db,
|
||||
|
@ -1046,7 +1046,7 @@ inline bool check_access(THD *thd, ulong access, const char *db,
|
|||
return false;
|
||||
}
|
||||
inline bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
bool no_errors)
|
||||
uint number, bool no_errors)
|
||||
{ return false; }
|
||||
inline bool check_global_access(THD *thd, ulong want_access)
|
||||
{ return false; }
|
||||
|
|
|
@ -222,6 +222,11 @@ extern "C" int gethostname(char *name, int namelen);
|
|||
/* Constants */
|
||||
|
||||
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
|
||||
/*
|
||||
WARNING: When adding new SQL modes don't forget to update the
|
||||
tables definitions that stores it's value.
|
||||
(ie: mysql.event, mysql.proc)
|
||||
*/
|
||||
static const char *sql_mode_names[]=
|
||||
{
|
||||
"REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
|
||||
|
@ -2180,6 +2185,16 @@ static void check_data_home(const char *path)
|
|||
#define UNSAFE_DEFAULT_LINUX_THREADS 200
|
||||
#endif
|
||||
|
||||
|
||||
#if BACKTRACE_DEMANGLE
|
||||
#include <cxxabi.h>
|
||||
extern "C" char *my_demangle(const char *mangled_name, int *status)
|
||||
{
|
||||
return abi::__cxa_demangle(mangled_name, NULL, NULL, status);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" sig_handler handle_segfault(int sig)
|
||||
{
|
||||
time_t curr_time;
|
||||
|
@ -2251,10 +2266,29 @@ the thread stack. Please read http://dev.mysql.com/doc/mysql/en/linux.html\n\n",
|
|||
}
|
||||
if (thd)
|
||||
{
|
||||
const char *kreason= "UNKNOWN";
|
||||
switch (thd->killed) {
|
||||
case THD::NOT_KILLED:
|
||||
kreason= "NOT_KILLED";
|
||||
break;
|
||||
case THD::KILL_BAD_DATA:
|
||||
kreason= "KILL_BAD_DATA";
|
||||
break;
|
||||
case THD::KILL_CONNECTION:
|
||||
kreason= "KILL_CONNECTION";
|
||||
break;
|
||||
case THD::KILL_QUERY:
|
||||
kreason= "KILL_QUERY";
|
||||
break;
|
||||
case THD::KILLED_NO_VALUE:
|
||||
kreason= "KILLED_NO_VALUE";
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "Trying to get some variables.\n\
|
||||
Some pointers may be invalid and cause the dump to abort...\n");
|
||||
safe_print_str("thd->query", thd->query, 1024);
|
||||
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
|
||||
fprintf(stderr, "thd->killed=%s\n", kreason);
|
||||
}
|
||||
fprintf(stderr, "\
|
||||
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains\n\
|
||||
|
|
|
@ -33,7 +33,10 @@ Relay_log_info::Relay_log_info()
|
|||
:Slave_reporting_capability("SQL"),
|
||||
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
|
||||
info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
|
||||
group_relay_log_pos(0),
|
||||
group_relay_log_pos(0), event_relay_log_pos(0),
|
||||
#if HAVE_purify
|
||||
is_fake(FALSE),
|
||||
#endif
|
||||
cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0),
|
||||
ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0),
|
||||
abort_pos_wait(0), slave_run_id(0), sql_thd(0),
|
||||
|
|
|
@ -154,6 +154,10 @@ public:
|
|||
ulonglong event_relay_log_pos;
|
||||
ulonglong future_event_relay_log_pos;
|
||||
|
||||
#ifdef HAVE_purify
|
||||
bool is_fake; /* Mark that this is a fake relay log info structure */
|
||||
#endif
|
||||
|
||||
/*
|
||||
Original log name and position of the group we're currently executing
|
||||
(whose coordinates are group_relay_log_name/pos in the relay log)
|
||||
|
|
|
@ -1021,7 +1021,7 @@ bool sys_var_set::update(THD *thd, set_var *var)
|
|||
{
|
||||
*value= var->save_result.ulong_value;
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
uchar *sys_var_set::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
|
|
|
@ -1892,7 +1892,13 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
|||
if (exec_res == 0)
|
||||
{
|
||||
int error= ev->update_pos(rli);
|
||||
#ifdef HAVE_purify
|
||||
if (!rli->is_fake)
|
||||
#endif
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
char buf[22];
|
||||
#endif
|
||||
DBUG_PRINT("info", ("update_pos error = %d", error));
|
||||
DBUG_PRINT("info", ("group %s %s",
|
||||
llstr(rli->group_relay_log_pos, buf),
|
||||
|
@ -1900,6 +1906,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
|||
DBUG_PRINT("info", ("event %s %s",
|
||||
llstr(rli->event_relay_log_pos, buf),
|
||||
rli->event_relay_log_name));
|
||||
}
|
||||
/*
|
||||
The update should not fail, so print an error message and
|
||||
return an error code.
|
||||
|
@ -1909,6 +1916,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
|
|||
*/
|
||||
if (error)
|
||||
{
|
||||
char buf[22];
|
||||
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR,
|
||||
"It was not possible to update the positions"
|
||||
" of the relay log information: the slave may"
|
||||
|
|
41
sql/sp.cc
41
sql/sp.cc
|
@ -388,7 +388,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
|
|||
uint length;
|
||||
char buff[65];
|
||||
String str(buff, sizeof(buff), &my_charset_bin);
|
||||
ulong sql_mode;
|
||||
ulong sql_mode, saved_mode= thd->variables.sql_mode;
|
||||
Open_tables_state open_tables_state_backup;
|
||||
Stored_program_creation_ctx *creation_ctx;
|
||||
|
||||
|
@ -400,6 +400,9 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
|
|||
if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
|
||||
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
|
||||
|
||||
/* Reset sql_mode during data dictionary operations. */
|
||||
thd->variables.sql_mode= 0;
|
||||
|
||||
if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
|
||||
goto done;
|
||||
|
||||
|
@ -503,10 +506,36 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
|
|||
done:
|
||||
if (table)
|
||||
close_system_tables(thd, &open_tables_state_backup);
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Silence DEPRECATED SYNTAX warnings when loading a stored procedure
|
||||
into the cache.
|
||||
*/
|
||||
struct Silence_deprecated_warning : public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd);
|
||||
};
|
||||
|
||||
bool
|
||||
Silence_deprecated_warning::handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd)
|
||||
{
|
||||
if (sql_errno == ER_WARN_DEPRECATED_SYNTAX &&
|
||||
level == MYSQL_ERROR::WARN_LEVEL_WARN)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
||||
ulong sql_mode, const char *params, const char *returns,
|
||||
|
@ -523,6 +552,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
ulong old_sql_mode= thd->variables.sql_mode;
|
||||
ha_rows old_select_limit= thd->variables.select_limit;
|
||||
sp_rcontext *old_spcont= thd->spcont;
|
||||
Silence_deprecated_warning warning_handler;
|
||||
|
||||
char definer_user_name_holder[USERNAME_LENGTH + 1];
|
||||
LEX_STRING definer_user_name= { definer_user_name_holder,
|
||||
|
@ -583,7 +613,9 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
|
||||
lex_start(thd);
|
||||
|
||||
thd->push_internal_handler(&warning_handler);
|
||||
ret= parse_sql(thd, &lip, creation_ctx) || newlex.sphead == NULL;
|
||||
thd->pop_internal_handler();
|
||||
|
||||
/*
|
||||
Force switching back to the saved current database (if changed),
|
||||
|
@ -675,6 +707,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
int ret;
|
||||
TABLE *table;
|
||||
char definer[USER_HOST_BUFF_SIZE];
|
||||
ulong saved_mode= thd->variables.sql_mode;
|
||||
|
||||
CHARSET_INFO *db_cs= get_default_db_collation(thd, sp->m_db.str);
|
||||
|
||||
|
@ -689,6 +722,9 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
DBUG_ASSERT(type == TYPE_ENUM_PROCEDURE ||
|
||||
type == TYPE_ENUM_FUNCTION);
|
||||
|
||||
/* Reset sql_mode during data dictionary operations. */
|
||||
thd->variables.sql_mode= 0;
|
||||
|
||||
/*
|
||||
This statement will be replicated as a statement, even when using
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
|
@ -790,7 +826,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
|
||||
store_failed= store_failed ||
|
||||
table->field[MYSQL_PROC_FIELD_SQL_MODE]->
|
||||
store((longlong)thd->variables.sql_mode, TRUE);
|
||||
store((longlong)saved_mode, TRUE);
|
||||
|
||||
if (sp->m_chistics->comment.str)
|
||||
{
|
||||
|
@ -890,6 +926,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
|
|||
|
||||
done:
|
||||
thd->count_cuted_fields= saved_count_cuted_fields;
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
|
||||
close_thread_tables(thd);
|
||||
DBUG_RETURN(ret);
|
||||
|
|
|
@ -2309,7 +2309,7 @@ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access)
|
|||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db= (char*) "mysql";
|
||||
tables.table_name= tables.alias= (char*) "proc";
|
||||
*full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1) ||
|
||||
*full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1, TRUE) ||
|
||||
(!strcmp(sp->m_definer_user.str,
|
||||
thd->security_ctx->priv_user) &&
|
||||
!strcmp(sp->m_definer_host.str,
|
||||
|
@ -2753,7 +2753,7 @@ int sp_instr::exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||
Check whenever we have access to tables for this statement
|
||||
and open and lock them before executing instructions core function.
|
||||
*/
|
||||
if (check_table_access(thd, SELECT_ACL, tables, 0)
|
||||
if (check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE)
|
||||
|| open_and_lock_tables(thd, tables))
|
||||
result= -1;
|
||||
else
|
||||
|
|
|
@ -3041,6 +3041,12 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
The lock api is depending on the thd->lex variable which needs to be
|
||||
re-initialized.
|
||||
*/
|
||||
Query_tables_list backup;
|
||||
thd->lex->reset_n_backup_query_tables_list(&backup);
|
||||
if (simple_open_n_lock_tables(thd,tables))
|
||||
{ // Should never happen
|
||||
close_thread_tables(thd); /* purecov: deadcode */
|
||||
|
@ -3173,6 +3179,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
send_ok(thd);
|
||||
|
||||
/* Tables are automatically closed */
|
||||
thd->lex->restore_backup_query_tables_list(&backup);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
@ -3862,7 +3869,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
|
|||
of other queries). For simple queries first_not_own_table is 0.
|
||||
*/
|
||||
for (i= 0, table= tables;
|
||||
table != first_not_own_table && i < number;
|
||||
i < number && table != first_not_own_table;
|
||||
table= table->next_global, i++)
|
||||
{
|
||||
/* Remove SHOW_VIEW_ACL, because it will be checked during making view */
|
||||
|
|
|
@ -799,7 +799,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
|
|||
table_list.table_name= share->table_name.str;
|
||||
table_list.grant.privilege=0;
|
||||
|
||||
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
|
||||
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list, 1, TRUE))
|
||||
continue;
|
||||
/* need to check if we haven't already listed it */
|
||||
for (table= open_list ; table ; table=table->next)
|
||||
|
|
|
@ -56,6 +56,9 @@ void mysql_client_binlog_statement(THD* thd)
|
|||
if (!thd->rli_fake)
|
||||
{
|
||||
thd->rli_fake= new Relay_log_info;
|
||||
#ifdef HAVE_purify
|
||||
thd->rli_fake->is_fake= TRUE;
|
||||
#endif
|
||||
have_fd_event= FALSE;
|
||||
}
|
||||
if (thd->rli_fake && !thd->rli_fake->relay_log.description_event_for_exec)
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
my_bool is_clear_all() const { return bitmap_is_clear_all(&map); }
|
||||
my_bool is_set_all() const { return bitmap_is_set_all(&map); }
|
||||
my_bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); }
|
||||
my_bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, map2.map); }
|
||||
my_bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); }
|
||||
my_bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); }
|
||||
char *print(char *buf) const
|
||||
{
|
||||
|
|
|
@ -1384,7 +1384,7 @@ def_week_frmt: %lu",
|
|||
table_list.db = table->db();
|
||||
table_list.alias= table_list.table_name= table->table();
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list,1))
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list, 1, TRUE))
|
||||
{
|
||||
DBUG_PRINT("qcache",
|
||||
("probably no SELECT access to %s.%s => return to normal processing",
|
||||
|
|
|
@ -406,7 +406,7 @@ Diagnostics_area::set_ok_status(THD *thd, ha_rows affected_rows_arg,
|
|||
m_affected_rows= affected_rows_arg;
|
||||
m_last_insert_id= last_insert_id_arg;
|
||||
if (message_arg)
|
||||
strmake(m_message, message_arg, sizeof(m_message));
|
||||
strmake(m_message, message_arg, sizeof(m_message) - 1);
|
||||
else
|
||||
m_message[0]= '\0';
|
||||
m_status= DA_OK;
|
||||
|
@ -456,7 +456,7 @@ Diagnostics_area::set_error_status(THD *thd, uint sql_errno_arg,
|
|||
DBUG_ASSERT(! is_set() || can_overwrite_status);
|
||||
|
||||
m_sql_errno= sql_errno_arg;
|
||||
strmake(m_message, message_arg, sizeof(m_message));
|
||||
strmake(m_message, message_arg, sizeof(m_message) - 1);
|
||||
|
||||
m_status= DA_ERROR;
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ static bool check_merge_table_access(THD *thd, char *db,
|
|||
tlist->db= db; /* purecov: inspected */
|
||||
}
|
||||
error= check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
|
||||
table_list,0);
|
||||
table_list, UINT_MAX, FALSE);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
@ -2046,7 +2046,7 @@ mysql_execute_command(THD *thd)
|
|||
res= check_table_access(thd,
|
||||
lex->exchange ? SELECT_ACL | FILE_ACL :
|
||||
SELECT_ACL,
|
||||
all_tables, 0);
|
||||
all_tables, UINT_MAX, FALSE);
|
||||
}
|
||||
else
|
||||
res= check_access(thd,
|
||||
|
@ -2071,7 +2071,7 @@ mysql_execute_command(THD *thd)
|
|||
break;
|
||||
}
|
||||
case SQLCOM_DO:
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables))
|
||||
goto error;
|
||||
|
||||
|
@ -2181,7 +2181,7 @@ mysql_execute_command(THD *thd)
|
|||
case SQLCOM_BACKUP_TABLE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
|
@ -2193,7 +2193,7 @@ mysql_execute_command(THD *thd)
|
|||
case SQLCOM_RESTORE_TABLE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, INSERT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, INSERT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
|
@ -2270,14 +2270,14 @@ mysql_execute_command(THD *thd)
|
|||
#endif /* HAVE_REPLICATION */
|
||||
case SQLCOM_SHOW_ENGINE_STATUS:
|
||||
{
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
if (check_global_access(thd, PROCESS_ACL))
|
||||
goto error;
|
||||
res = ha_show_status(thd, lex->create_info.db_type, HA_ENGINE_STATUS);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SHOW_ENGINE_MUTEX:
|
||||
{
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
if (check_global_access(thd, PROCESS_ACL))
|
||||
goto error;
|
||||
res = ha_show_status(thd, lex->create_info.db_type, HA_ENGINE_MUTEX);
|
||||
break;
|
||||
|
@ -2742,7 +2742,8 @@ end_with_restore_list:
|
|||
case SQLCOM_CHECKSUM:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
res = mysql_checksum_table(thd, first_table, &lex->check_opt);
|
||||
break;
|
||||
|
@ -2750,7 +2751,8 @@ end_with_restore_list:
|
|||
case SQLCOM_REPAIR:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= mysql_repair_table(thd, first_table, &lex->check_opt);
|
||||
|
@ -2769,7 +2771,8 @@ end_with_restore_list:
|
|||
case SQLCOM_CHECK:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL , all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL , all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res = mysql_check_table(thd, first_table, &lex->check_opt);
|
||||
|
@ -2780,7 +2783,8 @@ end_with_restore_list:
|
|||
case SQLCOM_ANALYZE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= mysql_analyze_table(thd, first_table, &lex->check_opt);
|
||||
|
@ -2800,7 +2804,8 @@ end_with_restore_list:
|
|||
case SQLCOM_OPTIMIZE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
|
||||
|
@ -3129,7 +3134,7 @@ end_with_restore_list:
|
|||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (!lex->drop_temporary)
|
||||
{
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
if (end_active_trans(thd))
|
||||
goto error;
|
||||
|
@ -3233,7 +3238,7 @@ end_with_restore_list:
|
|||
if (lex->autocommit && end_active_trans(thd))
|
||||
goto error;
|
||||
|
||||
if ((check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if ((check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables)))
|
||||
goto error;
|
||||
if (lex->one_shot_set && not_all_support_one_shot(lex_var_list))
|
||||
|
@ -3275,7 +3280,8 @@ end_with_restore_list:
|
|||
/* we must end the trasaction first, regardless of anything */
|
||||
if (end_active_trans(thd))
|
||||
goto error;
|
||||
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error;
|
||||
thd->in_lock_tables=1;
|
||||
thd->options|= OPTION_TABLE_LOCK;
|
||||
|
@ -3769,7 +3775,7 @@ end_with_restore_list:
|
|||
#endif
|
||||
case SQLCOM_HA_OPEN:
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE))
|
||||
goto error;
|
||||
res= mysql_ha_open(thd, first_table, 0);
|
||||
break;
|
||||
|
@ -4017,7 +4023,7 @@ create_sp_error:
|
|||
This will cache all SP and SF and open and lock all tables
|
||||
required for execution.
|
||||
*/
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables))
|
||||
goto error;
|
||||
|
||||
|
@ -4364,7 +4370,7 @@ create_sp_error:
|
|||
}
|
||||
case SQLCOM_DROP_VIEW:
|
||||
{
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
end_active_trans(thd))
|
||||
goto error;
|
||||
/* Conditionally writes to binlog. */
|
||||
|
@ -4840,7 +4846,7 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
|
|||
subselects_tables= subselects_tables->next_global;
|
||||
}
|
||||
if (subselects_tables &&
|
||||
(check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
|
||||
(check_table_access(thd, SELECT_ACL, subselects_tables, UINT_MAX, FALSE)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -5077,6 +5083,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
|
|||
@param thd Thread context
|
||||
@param want_access Privileges requested
|
||||
@param tables List of tables to be checked
|
||||
@param number Check at most this number of tables.
|
||||
@param no_errors FALSE/TRUE - report/don't report error to
|
||||
the client (using my_error() call).
|
||||
|
||||
|
@ -5087,25 +5094,25 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
|
|||
(the latter should be either 0 or point to next_global member
|
||||
of one of elements of this table list).
|
||||
|
||||
@retval
|
||||
FALSE OK
|
||||
@retval
|
||||
TRUE Access denied
|
||||
@retval FALSE OK
|
||||
@retval TRUE Access denied
|
||||
*/
|
||||
|
||||
bool
|
||||
check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
||||
bool no_errors)
|
||||
uint number, bool no_errors)
|
||||
{
|
||||
TABLE_LIST *org_tables= tables;
|
||||
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
|
||||
uint i= 0;
|
||||
Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
|
||||
/*
|
||||
The check that first_not_own_table is not reached is for the case when
|
||||
the given table list refers to the list for prelocking (contains tables
|
||||
of other queries). For simple queries first_not_own_table is 0.
|
||||
*/
|
||||
for (; tables != first_not_own_table; tables= tables->next_global)
|
||||
for (; i < number && tables != first_not_own_table;
|
||||
tables= tables->next_global, i++)
|
||||
{
|
||||
if (tables->security_ctx)
|
||||
sctx= tables->security_ctx;
|
||||
|
@ -5155,7 +5162,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
|||
}
|
||||
thd->security_ctx= backup_ctx;
|
||||
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
|
||||
test(want_access & EXTRA_ACL), UINT_MAX, no_errors);
|
||||
test(want_access & EXTRA_ACL), number, no_errors);
|
||||
deny:
|
||||
thd->security_ctx= backup_ctx;
|
||||
return TRUE;
|
||||
|
@ -6884,7 +6891,7 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
|
|||
|
||||
/* sql_yacc guarantees that tables and aux_tables are not zero */
|
||||
DBUG_ASSERT(aux_tables != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
|
@ -6893,7 +6900,7 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
|
|||
call check_table_access() safely.
|
||||
*/
|
||||
thd->lex->query_tables_own_last= 0;
|
||||
if (check_table_access(thd, DELETE_ACL, aux_tables, 0))
|
||||
if (check_table_access(thd, DELETE_ACL, aux_tables, UINT_MAX, FALSE))
|
||||
{
|
||||
thd->lex->query_tables_own_last= save_query_tables_own_last;
|
||||
DBUG_RETURN(TRUE);
|
||||
|
@ -7132,7 +7139,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables,0))
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
goto err;
|
||||
}
|
||||
else if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
||||
|
|
|
@ -1622,7 +1622,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
|
|||
bzero(&tables, sizeof(tables));
|
||||
tables.db= (char *)"mysql";
|
||||
tables.table_name= tables.alias= (char *)"plugin";
|
||||
if (check_table_access(thd, INSERT_ACL, &tables, 0))
|
||||
if (check_table_access(thd, INSERT_ACL, &tables, 1, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* need to open before acquiring LOCK_plugin or it will deadlock */
|
||||
|
|
|
@ -1280,7 +1280,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
|
||||
if (tables)
|
||||
{
|
||||
if (check_table_access(thd, privilege, tables,0))
|
||||
if (check_table_access(thd, privilege, tables, UINT_MAX, FALSE))
|
||||
goto error;
|
||||
}
|
||||
else if (check_access(thd, privilege, any_db,0,0,0,0))
|
||||
|
@ -1349,7 +1349,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt,
|
|||
THD *thd= stmt->thd;
|
||||
|
||||
DBUG_ENTER("mysql_test_do_fields");
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (open_normal_and_derived_tables(thd, tables, 0))
|
||||
|
@ -1380,7 +1380,7 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
|
|||
THD *thd= stmt->thd;
|
||||
set_var_base *var;
|
||||
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0) ||
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE) ||
|
||||
open_normal_and_derived_tables(thd, tables, 0))
|
||||
goto error;
|
||||
|
||||
|
|
|
@ -4077,7 +4077,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
proc_tables.table_name= proc_tables.alias= (char*) "proc";
|
||||
proc_tables.table_name_length= 4;
|
||||
proc_tables.lock_type= TL_READ;
|
||||
full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1);
|
||||
full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1, TRUE);
|
||||
if (!(proc_table= open_proc_table_for_read(thd, &open_tables_state_backup)))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
|
@ -4465,10 +4465,8 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
|
|||
Table_triggers_list *triggers= tables->table->triggers;
|
||||
int event, timing;
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (check_table_access(thd, TRIGGER_ACL, tables, 1))
|
||||
if (check_table_access(thd, TRIGGER_ACL, tables, 1, TRUE))
|
||||
goto ret;
|
||||
#endif
|
||||
|
||||
for (event= 0; event < (int)TRG_EVENT_MAX; event++)
|
||||
{
|
||||
|
@ -4506,9 +4504,7 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
ret:
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
|||
TABLE_LIST **save_query_tables_own_last= thd->lex->query_tables_own_last;
|
||||
thd->lex->query_tables_own_last= 0;
|
||||
|
||||
err_status= check_table_access(thd, TRIGGER_ACL, tables, 0);
|
||||
err_status= check_table_access(thd, TRIGGER_ACL, tables, 1, FALSE);
|
||||
|
||||
thd->lex->query_tables_own_last= save_query_tables_own_last;
|
||||
|
||||
|
|
|
@ -1123,8 +1123,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||
if (!table->prelocking_placeholder &&
|
||||
(old_lex->sql_command == SQLCOM_SELECT && old_lex->describe))
|
||||
{
|
||||
if (check_table_access(thd, SELECT_ACL, view_tables, 1) &&
|
||||
check_table_access(thd, SHOW_VIEW_ACL, table, 1))
|
||||
if (check_table_access(thd, SELECT_ACL, view_tables, UINT_MAX, TRUE) &&
|
||||
check_table_access(thd, SHOW_VIEW_ACL, table, UINT_MAX, TRUE))
|
||||
{
|
||||
my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
|
||||
goto err;
|
||||
|
@ -1134,7 +1134,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||
(old_lex->sql_command == SQLCOM_SHOW_CREATE) &&
|
||||
!table->belong_to_view)
|
||||
{
|
||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, UINT_MAX, FALSE))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,16 @@
|
|||
#include "stacktrace.h"
|
||||
#include <signal.h>
|
||||
#include <my_pthread.h>
|
||||
#include <m_string.h>
|
||||
|
||||
#ifdef HAVE_STACKTRACE
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
|
||||
#if HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
|
||||
|
||||
char *heap_start;
|
||||
|
@ -93,9 +98,68 @@ inline uint32* find_prev_pc(uint32* pc, uchar** fp)
|
|||
}
|
||||
#endif /* defined(__alpha__) && defined(__GNUC__) */
|
||||
|
||||
#if BACKTRACE_DEMANGLE
|
||||
static void my_demangle_symbols(char **addrs, int n)
|
||||
{
|
||||
int status, i;
|
||||
char *begin, *end, *demangled;
|
||||
|
||||
for (i= 0; i < n; i++)
|
||||
{
|
||||
demangled= NULL;
|
||||
begin= strchr(addrs[i], '(');
|
||||
end= begin ? strchr(begin, '+') : NULL;
|
||||
|
||||
if (begin && end)
|
||||
{
|
||||
*begin++= *end++= '\0';
|
||||
demangled= my_demangle(begin, &status);
|
||||
if (!demangled || status)
|
||||
{
|
||||
demangled= NULL;
|
||||
begin[-1]= '(';
|
||||
end[-1]= '+';
|
||||
}
|
||||
}
|
||||
|
||||
if (demangled)
|
||||
fprintf(stderr, "%s(%s+%s\n", addrs[i], demangled, end);
|
||||
else
|
||||
fprintf(stderr, "%s\n", addrs[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_BACKTRACE
|
||||
static void backtrace_current_thread(void)
|
||||
{
|
||||
void *addrs[128];
|
||||
char **strings= NULL;
|
||||
int n = backtrace(addrs, array_elements(addrs));
|
||||
#if BACKTRACE_DEMANGLE
|
||||
if ((strings= backtrace_symbols(addrs, n)))
|
||||
{
|
||||
my_demangle_symbols(strings, n);
|
||||
free(strings);
|
||||
}
|
||||
#endif
|
||||
#if HAVE_BACKTRACE_SYMBOLS_FD
|
||||
if (!strings)
|
||||
{
|
||||
backtrace_symbols_fd(addrs, n, fileno(stderr));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void print_stacktrace(uchar* stack_bottom, ulong thread_stack)
|
||||
{
|
||||
#if HAVE_BACKTRACE
|
||||
backtrace_current_thread();
|
||||
return;
|
||||
#endif
|
||||
uchar** fp;
|
||||
uint frame_count = 0, sigreturn_frame_count;
|
||||
#if defined(__alpha__) && defined(__GNUC__)
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE
|
||||
#define BACKTRACE_DEMANGLE 1
|
||||
#endif
|
||||
|
||||
#if BACKTRACE_DEMANGLE
|
||||
char *my_demangle(const char *mangled_name, int *status);
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_OS_LINUX
|
||||
#if defined(HAVE_STACKTRACE) || (defined (__x86_64__) || defined (__i386__) || (defined(__alpha__) && defined(__GNUC__)))
|
||||
#undef HAVE_STACKTRACE
|
||||
|
|
Loading…
Reference in a new issue