Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into  bodhi.local:/opt/local/work/mysql-5.1-runtime
This commit is contained in:
kostja@bodhi.local 2007-04-03 14:34:37 +04:00
commit 93d0316f45
49 changed files with 637 additions and 509 deletions

View File

@ -638,7 +638,7 @@ extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from);
# 415 "mysql_com.h"
extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
# 30 "typelib.h"
extern int find_type(char * x, TYPELIB * typelib, unsigned int);
extern int find_type(char * x, const TYPELIB * typelib, unsigned int);
# 429 "mysql_com.h"
extern void get_salt_from_password(unsigned char * res, char const * password);
# 422 "mysql_com.h"

View File

@ -26,7 +26,8 @@ typedef struct st_typelib { /* Different types saved here */
unsigned int *type_lengths;
} TYPELIB;
extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name);
extern int find_type(char *x, const TYPELIB *typelib,
unsigned int full_name);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);
extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);

View File

@ -73,7 +73,7 @@ DROP EVENT event_starts_test;
create table test_nested(a int);
create event e_43 on schedule every 1 second do set @a = 5;
alter event e_43 do alter event e_43 do set @a = 4;
ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
alter event e_43 do
begin
alter event e_43 on schedule every 5 minute;
@ -229,10 +229,10 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
ALTER TABLE mysql.event ADD dummy INT FIRST;
SHOW EVENTS;
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. Table probably corrupted
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. The table is probably corrupted
ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
SHOW EVENTS;
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. Table probably corrupted
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. The table is probably corrupted
ALTER TABLE mysql.event DROP dummy2;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
@ -241,7 +241,7 @@ CREATE TABLE event_like LIKE mysql.event;
INSERT INTO event_like SELECT * FROM mysql.event;
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted. Please see the error log for details
ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
SHOW CREATE TABLE mysql.event;
Table Create Table
@ -267,7 +267,7 @@ event CREATE TABLE `event` (
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted. Please see the error log for details
ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
"This should work"
SHOW EVENTS;
@ -275,13 +275,13 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted. Please see the error log for details
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted. Please see the error log for details
ALTER TABLE mysql.event DROP comment, DROP starts;
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 16. Table probably corrupted
ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 16. The table is probably corrupted
DROP TABLE mysql.event;
CREATE TABLE mysql.event like event_like;
INSERT INTO mysql.event SELECT * FROM event_like;
@ -368,7 +368,7 @@ root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
drop event закачка21;
create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
drop table t_16;
create event white_space
on schedule every 10 hour

View File

@ -17,7 +17,7 @@ DROP EVENT ДОЛЕН_регистър_утф8;
SET NAMES latin1;
set @a=3;
CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
create event e_55 on schedule at 99990101000000 do drop table t;
ERROR HY000: Incorrect AT value: '99990101000000'
create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;

View File

@ -1,22 +0,0 @@
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'

View File

@ -1408,4 +1408,32 @@ select user,db from information_schema.processlist;
user db
user3148 test
drop user user3148@localhost;
DROP TABLE IF EXISTS thread_status;
CREATE TABLE thread_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
CREATE TABLE server_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
DROP EVENT IF EXISTS log_status;
CREATE EVENT log_status
ON SCHEDULE EVERY 1 SECOND
DO
BEGIN
INSERT INTO thread_status SELECT variable_name, variable_value FROM
information_schema.session_status;
INSERT INTO server_status SELECT variable_name, variable_value FROM
information_schema.global_status;
END$$
SET GLOBAL event_scheduler=1;
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
variable_name variable_value
SSL_ACCEPTS 0.0000000
SSL_CALLBACK_CACHE_HITS 0.0000000
SELECT variable_name FROM server_status LIMIT 1,2;
variable_name
ABORTED_CONNECTS
BINLOG_CACHE_DISK_USE
DROP EVENT log_status;
DROP TABLE thread_status;
DROP TABLE server_status;
SET GLOBAL event_scheduler=0;
End of 5.1 tests.

View File

@ -2285,7 +2285,7 @@ drop user pstest_xyz@localhost;
deallocate prepare abc;
drop event if exists xyz;
create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
ERROR HY000: Recursivity of EVENT DDL statements is forbidden when body is present
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
select func_1(), func_1(), func_1() from dual;
ERROR 42000: FUNCTION test.func_1 does not exist
drop function func_1;

View File

@ -6061,4 +6061,89 @@ SUM(f2) bug25373(f1)
21.300000071526 NULL
DROP FUNCTION bug25373|
DROP TABLE t3|
drop function if exists bug20777|
drop table if exists examplebug20777|
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
9223372036854775803 2**63-5
9223372036854775803
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
9223372036854775804 2**63-4
9223372036854775804
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
9223372036854775805 2**63-3
9223372036854775805
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
9223372036854775806 2**63-2
9223372036854775806
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
9223372036854775807 2**63-1
9223372036854775807
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
9223372036854775808 2**63+0
9223372036854775808
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
9223372036854775809 2**63+1
9223372036854775809
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
9223372036854775810 2**63+2
9223372036854775810
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
lower bounds signed bigint
0
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
upper bounds signed bigint
9223372036854775807
select bug20777(0) as 'lower bounds unsigned bigint';
lower bounds unsigned bigint
0
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
upper bounds unsigned bigint
18446744073709551615
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
upper bounds unsigned bigint + 1
18446744073709551615
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
lower bounds unsigned bigint - 1
0
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
Table Create Table
examplebug20777 CREATE TABLE `examplebug20777` (
`i` int(1) NOT NULL DEFAULT '0',
`2**63-2` bigint(20) unsigned DEFAULT NULL,
`2**63-1` bigint(20) unsigned DEFAULT NULL,
`2**63` bigint(20) unsigned DEFAULT NULL,
`2**63+1` bigint(20) unsigned DEFAULT NULL,
`2**64-2` bigint(20) unsigned DEFAULT NULL,
`2**64-1` bigint(20) unsigned DEFAULT NULL,
`2**64` bigint(20) unsigned DEFAULT NULL,
`0` bigint(20) unsigned DEFAULT NULL,
`-1` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from examplebug20777 order by i;
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
bug20777(18446744073709551613)+1
18446744073709551614
drop function bug20777;
End of 5.0 tests.
drop table t1,t2;

View File

@ -74,7 +74,7 @@ DROP EVENT event_starts_test;
#
create table test_nested(a int);
create event e_43 on schedule every 1 second do set @a = 5;
--error ER_EVENT_RECURSIVITY_FORBIDDEN
--error ER_EVENT_RECURSION_FORBIDDEN
alter event e_43 do alter event e_43 do set @a = 4;
delimiter |;
alter event e_43 do
@ -351,7 +351,7 @@ drop event закачка21;
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
#
create table t_16 (s1 int);
--error ER_EVENT_RECURSIVITY_FORBIDDEN
--error ER_EVENT_RECURSION_FORBIDDEN
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
drop table t_16;
#

View File

@ -30,7 +30,7 @@ SET NAMES latin1;
# START - BUG#16408: Events: crash for an event in a procedure
#
set @a=3;
--error ER_EVENT_RECURSIVITY_FORBIDDEN
--error ER_EVENT_RECURSION_FORBIDDEN
CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
#
# END - BUG#16408: Events: crash for an event in a procedure

View File

@ -1,22 +0,0 @@
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'

View File

@ -1,22 +0,0 @@
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'

View File

@ -1042,5 +1042,45 @@ select user,db from information_schema.processlist;
connection default;
drop user user3148@localhost;
#
# Bug #26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in Event
#
--disable_warnings
DROP TABLE IF EXISTS thread_status;
CREATE TABLE thread_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
CREATE TABLE server_status (variable_name VARCHAR(64),
variable_value DECIMAL(22,7));
DROP EVENT IF EXISTS log_status;
--enable_warnings
DELIMITER $$;
CREATE EVENT log_status
ON SCHEDULE EVERY 1 SECOND
DO
BEGIN
INSERT INTO thread_status SELECT variable_name, variable_value FROM
information_schema.session_status;
INSERT INTO server_status SELECT variable_name, variable_value FROM
information_schema.global_status;
END$$
DELIMITER ;$$
SET GLOBAL event_scheduler=1;
sleep 1;
SELECT * FROM thread_status WHERE variable_name LIKE 'SSL%' LIMIT 1,2;
SELECT variable_name FROM server_status LIMIT 1,2;
DROP EVENT log_status;
DROP TABLE thread_status;
DROP TABLE server_status;
SET GLOBAL event_scheduler=0;
--echo End of 5.1 tests.

View File

@ -2324,7 +2324,7 @@ drop event if exists xyz;
#drop event xyz;
#drop procedure proc_1;
delimiter |;
--error ER_EVENT_RECURSIVITY_FORBIDDEN
--error ER_EVENT_RECURSION_FORBIDDEN
create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST

View File

@ -7018,9 +7018,54 @@ SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
DROP FUNCTION bug25373|
DROP TABLE t3|
#
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
# at the end of the file!
#
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
--disable_warnings
drop function if exists bug20777|
drop table if exists examplebug20777|
--enabled_warnings
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
delimiter ;|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
select bug20777(0) as 'lower bounds unsigned bigint';
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
select * from examplebug20777 order by i;
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
drop function bug20777;
delimiter |;
###
--echo End of 5.0 tests.
#
# BUG#NNNN: New bug synopsis
@ -7029,8 +7074,13 @@ DROP TABLE t3|
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
#
# Add bugs above this line. Use existing tables t1 and t2 when
# practical, or create table t3, t4 etc temporarily (and drop them).
# practical, or create table t3,t4 etc temporarily (and drop them).
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
# at the end of the file!
#
delimiter ;|
drop table t1,t2;

View File

@ -42,7 +42,7 @@
>0 Offset+1 in typelib for matched string
*/
int find_type(my_string x, TYPELIB *typelib, uint full_name)
int find_type(char *x, const TYPELIB *typelib, uint full_name)
{
int find,pos,findpos;
reg1 my_string i;

View File

@ -81,7 +81,7 @@ Event_queue_element_for_exec::~Event_queue_element_for_exec()
RETURN VALUE
Address or NULL in case of error
NOTE
Created on THD's mem_root
*/
@ -169,13 +169,13 @@ Event_parse_data::init_body(THD *thd)
(long) body_begin, (long) thd->lex->ptr));
body.length= thd->lex->ptr - body_begin;
const uchar *body_end= body_begin + body.length - 1;
const char *body_end= body_begin + body.length - 1;
/* Trim nuls or close-comments ('*'+'/') or spaces at the end */
while (body_begin < body_end)
{
if ((*body_end == '\0') ||
if ((*body_end == '\0') ||
(my_isspace(thd->variables.character_set_client, *body_end)))
{ /* consume NULs and meaningless whitespace */
--body.length;
@ -187,7 +187,7 @@ Event_parse_data::init_body(THD *thd)
consume closing comments
This is arguably wrong, but it's the best we have until the parser is
changed to be smarter. FIXME PARSER
changed to be smarter. FIXME PARSER
See also the sp_head code, where something like this is done also.
@ -297,7 +297,7 @@ Event_parse_data::init_execute_at(THD *thd)
if (item_execute_at->fix_fields(thd, &item_execute_at))
goto wrong_value;
/* no starts and/or ends in case of execute_at */
DBUG_PRINT("info", ("starts_null && ends_null should be 1 is %d",
(starts_null && ends_null)));
@ -728,7 +728,7 @@ Event_basic::load_string_fields(Field **fields, ...)
ret= TRUE;
break;
}
field_value->length= strlen(field_value->str);
field_value->length= strlen(field_value->str);
field_name= (enum enum_events_table_field) va_arg(args, int);
}
@ -804,7 +804,7 @@ Event_timed::Event_timed():
*/
Event_timed::~Event_timed()
{
{
}
@ -1423,7 +1423,6 @@ Event_queue_element::compute_next_execution_time()
DBUG_PRINT("info", ("Dropped: %d", dropped));
status= Event_queue_element::DISABLED;
status_changed= TRUE;
dropped= TRUE;
goto ret;
}
@ -1615,7 +1614,7 @@ Event_queue_element::mark_last_executed(THD *thd)
last_executed= (my_time_t) thd->query_start();
last_executed_changed= TRUE;
execution_count++;
}
@ -1812,7 +1811,7 @@ Event_timed::get_create_event(THD *thd, String *buf)
*/
int
Event_job_data::get_fake_create_event(THD *thd, String *buf)
Event_job_data::get_fake_create_event(String *buf)
{
DBUG_ENTER("Event_job_data::get_create_event");
/* FIXME: "EVERY 3337 HOUR" is asking for trouble. */
@ -1903,7 +1902,7 @@ done:
RETURN VALUE
0 success
EVEX_COMPILE_ERROR error during compilation
EVEX_MICROSECOND_UNSUP mysql.event was tampered
EVEX_MICROSECOND_UNSUP mysql.event was tampered
*/
int
@ -1928,7 +1927,7 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)
show_create.length(0);
switch (get_fake_create_event(thd, &show_create)) {
switch (get_fake_create_event(&show_create)) {
case EVEX_MICROSECOND_UNSUP:
DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
case 0:
@ -1970,16 +1969,17 @@ Event_job_data::compile(THD *thd, MEM_ROOT *mem_root)
event_change_security_context(thd, definer_user, definer_host, dbname,
&save_ctx);
thd->lex= &lex;
mysql_init_query(thd, (uchar*) thd->query, thd->query_length);
mysql_init_query(thd, thd->query, thd->query_length);
if (MYSQLparse((void *)thd) || thd->is_fatal_error)
{
DBUG_PRINT("error", ("error during compile or thd->is_fatal_error: %d",
thd->is_fatal_error));
lex.unit.cleanup();
sql_print_error("SCHEDULER: Error during compilation of %s.%s or "
"thd->is_fatal_error: %d",
dbname.str, name.str, thd->is_fatal_error);
sql_print_error("Event Scheduler: "
"%serror during compilation of %s.%s",
thd->is_fatal_error ? "fatal " : "",
dbname.str, name.str);
ret= EVEX_COMPILE_ERROR;
goto done;
@ -2093,7 +2093,7 @@ event_change_security_context(THD *thd, LEX_STRING user, LEX_STRING host,
thd->security_ctx= &thd->main_security_ctx;
#endif
DBUG_RETURN(FALSE);
}
}
/*

View File

@ -132,24 +132,6 @@ public:
bool
update_timing_fields(THD *thd);
static void *operator new(size_t size)
{
void *p;
DBUG_ENTER("Event_queue_element::new(size)");
p= my_malloc(size, MYF(0));
DBUG_PRINT("info", ("alloc_ptr: 0x%lx", (long) p));
DBUG_RETURN(p);
}
static void operator delete(void *ptr, size_t size)
{
DBUG_ENTER("Event_queue_element::delete(ptr,size)");
DBUG_PRINT("enter", ("free_ptr: 0x%lx", (long) ptr));
TRASH(ptr, size);
my_free((gptr) ptr, MYF(0));
DBUG_VOID_RETURN;
}
};
@ -211,7 +193,7 @@ public:
compile(THD *thd, MEM_ROOT *mem_root);
private:
int
get_fake_create_event(THD *thd, String *buf);
get_fake_create_event(String *buf);
Event_job_data(const Event_job_data &); /* Prevent use of these */
void operator=(Event_job_data &);
@ -231,7 +213,7 @@ public:
*/
bool do_not_create;
const uchar *body_begin;
const char *body_begin;
LEX_STRING dbname;
LEX_STRING name;

View File

@ -147,7 +147,7 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] =
EVEX_GENERAL_ERROR Bad data
EVEX_GET_FIELD_FAILED Field count does not match. table corrupted?
DESCRIPTION
DESCRIPTION
Used both when an event is created and when it is altered.
*/
@ -186,7 +186,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
/*
Change the SQL_MODE only if body was present in an ALTER EVENT and of course
always during CREATE EVENT.
*/
*/
if (et->body.str)
{
fields[ET_FIELD_SQL_MODE]->store((longlong)thd->variables.sql_mode, TRUE);
@ -245,7 +245,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
fields[ET_FIELD_TRANSIENT_INTERVAL]->set_null();
fields[ET_FIELD_STARTS]->set_null();
fields[ET_FIELD_ENDS]->set_null();
TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, et->execute_at);
@ -261,7 +261,7 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et,
this is an error if the action is create. something is borked
*/
}
((Field_timestamp *)fields[ET_FIELD_MODIFIED])->set_time();
if (et->comment.str)
@ -331,12 +331,12 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
ret= copy_event_to_schema_table(thd, schema_table, event_table);
if (ret == 0)
ret= event_table->file->index_next_same(event_table->record[0],
key_buf, key_len);
key_buf, key_len);
} while (ret == 0);
}
DBUG_PRINT("info", ("Scan finished. ret=%d", ret));
}
event_table->file->ha_index_end();
event_table->file->ha_index_end();
/* ret is guaranteed to be != 0 */
if (ret == HA_ERR_END_OF_FILE || ret == HA_ERR_KEY_NOT_FOUND)
DBUG_RETURN(FALSE);
@ -497,7 +497,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
check_parse_params()
thd Thread context
parse_data Event's data
RETURN VALUE
FALSE OK
TRUE Error (reported)
@ -543,7 +543,7 @@ check_parse_params(THD *thd, Event_parse_data *parse_data)
0 OK
EVEX_GENERAL_ERROR Failure
DESCRIPTION
DESCRIPTION
Creates an event. Relies on mysql_event_fill_row which is shared with
::update_event. The name of the event is inside "et".
*/
@ -637,7 +637,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
handle it here
*/
if ((ret= mysql_event_fill_row(thd, table, parse_data, FALSE)))
goto err;
goto err;
table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
@ -656,7 +656,7 @@ ok:
(void) mysql_change_db(thd, old_db.str, 1);
/*
This statement may cause a spooky valgrind warning at startup
inside init_key_cache on my system (ahristov, 2006/08/10)
inside init_key_cache on my system (ahristov, 2006/08/10)
*/
close_thread_tables(thd);
DBUG_RETURN(FALSE);
@ -923,14 +923,14 @@ Event_db_repository::drop_schema_events(THD *thd, LEX_STRING schema)
*/
void
Event_db_repository::drop_events_by_field(THD *thd,
Event_db_repository::drop_events_by_field(THD *thd,
enum enum_events_table_field field,
LEX_STRING field_value)
{
int ret= 0;
TABLE *table= NULL;
READ_RECORD read_record_info;
DBUG_ENTER("Event_db_repository::drop_events_by_field");
DBUG_ENTER("Event_db_repository::drop_events_by_field");
DBUG_PRINT("enter", ("field=%d field_value=%s", field, field_value.str));
if (open_event_table(thd, TL_WRITE, &table))

View File

@ -63,7 +63,7 @@ public:
update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,
LEX_STRING *new_name);
bool
bool
drop_event(THD *thd, LEX_STRING db, LEX_STRING name, bool drop_if_exists);
void
@ -99,5 +99,5 @@ private:
Event_db_repository(const Event_db_repository &);
void operator=(Event_db_repository &);
};
#endif /* _EVENT_DB_REPOSITORY_H_ */

View File

@ -32,16 +32,6 @@
#define LOCK_QUEUE_DATA() lock_data(SCHED_FUNC, __LINE__)
#define UNLOCK_QUEUE_DATA() unlock_data(SCHED_FUNC, __LINE__)
struct event_queue_param
{
THD *thd;
Event_queue *queue;
pthread_mutex_t LOCK_loaded;
pthread_cond_t COND_loaded;
bool loading_finished;
};
/*
Compares the execute_at members of two Event_queue_element instances.
Used as callback for the prioritized queue when shifting
@ -62,7 +52,7 @@ struct event_queue_param
execute_at.second_part is not considered during comparison
*/
static int
static int
event_queue_element_compare_q(void *vptr, byte* a, byte *b)
{
my_time_t lhs = ((Event_queue_element *)a)->execute_at;
@ -148,7 +138,7 @@ Event_queue::init_queue(THD *thd)
0 /*max_on_top*/, event_queue_element_compare_q,
NULL, EVENT_QUEUE_EXTENT))
{
sql_print_error("SCHEDULER: Can't initialize the execution queue");
sql_print_error("Event Scheduler: Can't initialize the execution queue");
goto err;
}
@ -183,7 +173,7 @@ Event_queue::deinit_queue()
}
/*
/**
Adds an event to the queue.
SYNOPSIS
@ -210,7 +200,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element)
LOCK_QUEUE_DATA();
queue_insert_safe(&queue, (byte *) new_element);
dbug_dump_queue(thd->query_start());
pthread_cond_broadcast(&COND_queue_state);
pthread_cond_broadcast(&COND_queue_state);
UNLOCK_QUEUE_DATA();
}
DBUG_VOID_RETURN;
@ -258,7 +248,7 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name,
{
DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
queue_insert_safe(&queue, (byte *) new_element);
pthread_cond_broadcast(&COND_queue_state);
pthread_cond_broadcast(&COND_queue_state);
}
dbug_dump_queue(thd->query_start());
@ -289,7 +279,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
find_n_remove_event(dbname, name);
dbug_dump_queue(thd->query_start());
UNLOCK_QUEUE_DATA();
/*
We don't signal here because the scheduler will catch the change
next time it wakes up.
@ -311,7 +301,7 @@ Event_queue::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
RETURN VALUE
>=0 Number of dropped events
NOTE
Expected is the caller to acquire lock on LOCK_event_queue
*/
@ -343,7 +333,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
i++;
}
/*
We don't call pthread_cond_broadcast(&COND_queue_state);
We don't call pthread_cond_broadcast(&COND_queue_state);
If we remove the top event:
1. The queue is empty. The scheduler will wake up at some time and
realize that the queue is empty. If create_event() comes inbetween
@ -465,7 +455,8 @@ Event_queue::empty_queue()
uint i;
DBUG_ENTER("Event_queue::empty_queue");
DBUG_PRINT("enter", ("Purging the queue. %u element(s)", queue.elements));
sql_print_information("SCHEDULER: Purging queue. %u events", queue.elements);
sql_print_information("Event Scheduler: Purging the queue. %u events",
queue.elements);
/* empty the queue */
for (i= 0; i < queue.elements; ++i)
{
@ -598,7 +589,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
if (top->status == Event_queue_element::DISABLED)
{
DBUG_PRINT("info", ("removing from the queue"));
sql_print_information("SCHEDULER: Last execution of %s.%s. %s",
sql_print_information("Event Scheduler: Last execution of %s.%s. %s",
top->dbname.str, top->name.str,
top->dropped? "Dropping.":"");
delete top;

View File

@ -34,7 +34,7 @@ public:
bool
init_queue(THD *thd);
void
deinit_queue();

View File

@ -78,7 +78,7 @@ Event_worker_thread::print_warnings(THD *thd, Event_job_data *et)
char prefix_buf[5 * STRING_BUFFER_USUAL_SIZE];
String prefix(prefix_buf, sizeof(prefix_buf), system_charset_info);
prefix.length(0);
prefix.append("SCHEDULER: [");
prefix.append("Event Scheduler: [");
append_identifier(thd, &prefix, et->definer.str, et->definer.length);
prefix.append("][", 2);
@ -240,7 +240,7 @@ event_scheduler_thread(void *arg)
/*
Function that executes an event in a child thread. Setups the
Function that executes an event in a child thread. Setups the
environment for the event execution and cleans after that.
SYNOPSIS
@ -254,7 +254,7 @@ event_scheduler_thread(void *arg)
pthread_handler_t
event_worker_thread(void *arg)
{
THD *thd;
THD *thd;
Event_queue_element_for_exec *event= (Event_queue_element_for_exec *)arg;
thd= event->thd;
@ -267,7 +267,7 @@ event_worker_thread(void *arg)
/*
Function that executes an event in a child thread. Setups the
Function that executes an event in a child thread. Setups the
environment for the event execution and cleans after that.
SYNOPSIS
@ -304,7 +304,8 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
goto end;
}
sql_print_information("SCHEDULER: [%s.%s of %s] executing in thread %lu. ",
sql_print_information("Event Scheduler: "
"[%s.%s of %s] executing in thread %lu. ",
job_data->dbname.str, job_data->name.str,
job_data->definer.str, thd->thread_id);
@ -314,23 +315,25 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
print_warnings(thd, job_data);
sql_print_information("SCHEDULER: [%s.%s of %s] executed in thread %lu. "
sql_print_information("Event Scheduler: "
"[%s.%s of %s] executed in thread %lu. "
"RetCode=%d", job_data->dbname.str, job_data->name.str,
job_data->definer.str, thd->thread_id, ret);
if (ret == EVEX_COMPILE_ERROR)
sql_print_information("SCHEDULER: COMPILE ERROR for event %s.%s of %s",
sql_print_information("Event Scheduler: "
"COMPILE ERROR for event %s.%s of %s",
job_data->dbname.str, job_data->name.str,
job_data->definer.str);
else if (ret == EVEX_MICROSECOND_UNSUP)
sql_print_information("SCHEDULER: MICROSECOND is not supported");
sql_print_information("Event Scheduler: MICROSECOND is not supported");
end:
delete job_data;
if (event->dropped)
{
sql_print_information("SCHEDULER: Dropping %s.%s", event->dbname.str,
event->name.str);
sql_print_information("Event Scheduler: Dropping %s.%s",
event->dbname.str, event->name.str);
/*
Using db_repository can lead to a race condition because we access
the table without holding LOCK_metadata.
@ -442,7 +445,7 @@ Event_scheduler::start()
if (!(new_thd= new THD))
{
sql_print_error("SCHEDULER: Cannot init manager event thread");
sql_print_error("Event Scheduler: Cannot initialize the scheduler thread");
ret= TRUE;
goto end;
}
@ -458,7 +461,7 @@ Event_scheduler::start()
scheduler_thd= new_thd;
DBUG_PRINT("info", ("Setting state go RUNNING"));
state= RUNNING;
DBUG_PRINT("info", ("Forking new thread for scheduduler. THD: 0x%lx", (long) new_thd));
DBUG_PRINT("info", ("Forking new thread for scheduler. THD: 0x%lx", (long) new_thd));
if (pthread_create(&th, &connection_attrib, event_scheduler_thread,
(void*)scheduler_param_value))
{
@ -501,7 +504,7 @@ Event_scheduler::run(THD *thd)
int res= FALSE;
DBUG_ENTER("Event_scheduler::run");
sql_print_information("SCHEDULER: Manager thread started with id %lu",
sql_print_information("Event Scheduler: scheduler thread started with id %lu",
thd->thread_id);
/*
Recalculate the values in the queue because there could have been stops
@ -516,7 +519,8 @@ Event_scheduler::run(THD *thd)
/* Gets a minimized version */
if (queue->get_top_for_execution_if_time(thd, &event_name))
{
sql_print_information("SCHEDULER: Serious error during getting next "
sql_print_information("Event Scheduler: "
"Serious error during getting next "
"event to execute. Stopping");
break;
}
@ -525,7 +529,7 @@ Event_scheduler::run(THD *thd)
"event_name=0x%lx", (long) event_name));
if (event_name)
{
if ((res= execute_top(thd, event_name)))
if ((res= execute_top(event_name)))
break;
}
else
@ -540,7 +544,7 @@ Event_scheduler::run(THD *thd)
state= INITIALIZED;
pthread_cond_signal(&COND_state);
UNLOCK_DATA();
sql_print_information("SCHEDULER: Stopped");
sql_print_information("Event Scheduler: Stopped");
DBUG_RETURN(res);
}
@ -559,7 +563,7 @@ Event_scheduler::run(THD *thd)
*/
bool
Event_scheduler::execute_top(THD *thd, Event_queue_element_for_exec *event_name)
Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
{
THD *new_thd;
pthread_t th;
@ -631,7 +635,7 @@ Event_scheduler::is_running()
}
/*
/**
Stops the scheduler (again). Waits for acknowledgement from the
scheduler that it has stopped - synchronous stopping.
@ -657,8 +661,8 @@ Event_scheduler::stop()
/* Guarantee we don't catch spurious signals */
do {
DBUG_PRINT("info", ("Waiting for COND_started_or_stopped from the manager "
"thread. Current value of state is %s . "
DBUG_PRINT("info", ("Waiting for COND_started_or_stopped from "
"the scheduler thread. Current value of state is %s . "
"workers count=%d", scheduler_states_names[state].str,
workers_count()));
/*
@ -672,20 +676,23 @@ Event_scheduler::stop()
*/
state= STOPPING;
DBUG_PRINT("info", ("Manager thread has id %lu", scheduler_thd->thread_id));
DBUG_PRINT("info", ("Scheduler thread has id %lu",
scheduler_thd->thread_id));
/* Lock from delete */
pthread_mutex_lock(&scheduler_thd->LOCK_delete);
/* This will wake up the thread if it waits on Queue's conditional */
sql_print_information("SCHEDULER: Killing manager thread %lu",
sql_print_information("Event Scheduler: Killing the scheduler thread, "
"thread id %lu",
scheduler_thd->thread_id);
scheduler_thd->awake(THD::KILL_CONNECTION);
pthread_mutex_unlock(&scheduler_thd->LOCK_delete);
/* thd could be 0x0, when shutting down */
sql_print_information("SCHEDULER: Waiting the manager thread to reply");
sql_print_information("Event Scheduler: "
"Waiting for the scheduler thread to reply");
COND_STATE_WAIT(thd, NULL, "Waiting scheduler to stop");
} while (state == STOPPING);
DBUG_PRINT("info", ("Manager thread has cleaned up. Set state to INIT"));
DBUG_PRINT("info", ("Scheduler thread has cleaned up. Set state to INIT"));
/*
The rationale behind setting it to NULL here but not destructing it
beforehand is because the THD will be deinited in event_scheduler_thread().
@ -715,7 +722,7 @@ Event_scheduler::workers_count()
{
THD *tmp;
uint count= 0;
DBUG_ENTER("Event_scheduler::workers_count");
pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
I_List_iterator<THD> it(threads);

View File

@ -15,6 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
This file is internal to Events module. Please do not include it directly.
All public declarations of Events module are in events.h and
event_data_objects.h.
*/
class Event_queue;
class Event_job_data;
@ -31,7 +37,7 @@ void
deinit_event_thread(THD *thd);
class Event_worker_thread
class Event_worker_thread
{
public:
static void
@ -74,7 +80,7 @@ public:
bool
run(THD *thd);
void
void
init_scheduler(Event_queue *queue);
void
@ -99,7 +105,7 @@ private:
/* helper functions */
bool
execute_top(THD *thd, Event_queue_element_for_exec *event_name);
execute_top(Event_queue_element_for_exec *event_name);
/* helper functions for working with mutexes & conditionals */
void

View File

@ -49,7 +49,7 @@
counterpart.
1. CREATE EVENT the_name ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1;
2. DROP EVENT the_name
In other words, the first one will create a row in mysql.event . In the
second step because there will be a line, disk based drop will pass and
the scheduler will remove the memory counterpart. The reason is that
@ -309,7 +309,7 @@ Events::Events()
TRUE Error (Reported)
NOTES
In case there is an event with the same name (db) and
In case there is an event with the same name (db) and
IF NOT EXISTS is specified, an warning is put into the stack.
*/
@ -362,7 +362,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
pthread_mutex_unlock(&LOCK_event_metadata);
DBUG_RETURN(ret);
}
@ -380,7 +379,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists)
TRUE Error
NOTES
et contains data about dbname and event name.
et contains data about dbname and event name.
new_name is the new name of the event, if not null this means
that RENAME TO was specified in the query
*/
@ -420,7 +419,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to)
new_element)))
{
DBUG_ASSERT(ret == OP_LOAD_ERROR);
delete new_element;
delete new_element;
}
else /* Binlog the alter event. */
{
@ -492,7 +491,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
}
/*
/**
Drops all events from a schema
SYNOPSIS
@ -505,8 +504,8 @@ void
Events::drop_schema_events(THD *thd, char *db)
{
LEX_STRING const db_lex= { db, strlen(db) };
DBUG_ENTER("Events::drop_schema_events");
DBUG_ENTER("Events::drop_schema_events");
DBUG_PRINT("enter", ("dropping events from %s", db));
if (unlikely(check_system_tables_error))
{
@ -690,7 +689,7 @@ Events::init()
if (check_system_tables(thd))
{
check_system_tables_error= TRUE;
sql_print_error("SCHEDULER: The system tables are damaged. "
sql_print_error("Event Scheduler: The system tables are damaged. "
"The scheduler subsystem will be unusable during this run.");
goto end;
}
@ -698,7 +697,7 @@ Events::init()
if (event_queue->init_queue(thd) || load_events_from_db(thd))
{
sql_print_error("SCHEDULER: Error while loading from disk.");
sql_print_error("Event Scheduler: Error while loading from disk.");
goto end;
}
@ -745,7 +744,7 @@ Events::deinit()
}
/*
/**
Inits Events mutexes
SYNOPSIS
@ -803,7 +802,7 @@ Events::dump_internal_status()
}
/*
/**
Starts execution of events by the scheduler
SYNOPSIS
@ -911,7 +910,7 @@ Events::check_system_tables(THD *thd)
if ((ret= simple_open_n_lock_tables(thd, &tables)))
{
sql_print_error("SCHEDULER: Cannot open mysql.db");
sql_print_error("Event Scheduler: Cannot open mysql.db");
ret= TRUE;
}
ret= table_check_intact(tables.table, MYSQL_DB_FIELD_COUNT,
@ -926,7 +925,7 @@ Events::check_system_tables(THD *thd)
if (simple_open_n_lock_tables(thd, &tables))
{
sql_print_error("SCHEDULER: Cannot open mysql.user");
sql_print_error("Event Scheduler: Cannot open mysql.user");
ret= TRUE;
}
else
@ -960,7 +959,7 @@ Events::check_system_tables(THD *thd)
RETURN VALUE
0 OK
!0 Error (EVEX_OPEN_TABLE_FAILED, EVEX_MICROSECOND_UNSUP,
!0 Error (EVEX_OPEN_TABLE_FAILED, EVEX_MICROSECOND_UNSUP,
EVEX_COMPILE_ERROR) - in all these cases mysql.event was
tampered.
@ -982,7 +981,7 @@ Events::load_events_from_db(THD *thd)
if ((ret= db_repository->open_event_table(thd, TL_READ, &table)))
{
sql_print_error("SCHEDULER: Table mysql.event is damaged. Can not open");
sql_print_error("Event Scheduler: Table mysql.event is damaged. Can not open");
DBUG_RETURN(EVEX_OPEN_TABLE_FAILED);
}
@ -999,8 +998,9 @@ Events::load_events_from_db(THD *thd)
if ((ret= et->load_from_row(thd, table)))
{
sql_print_error("SCHEDULER: Error while loading from mysql.event. "
"Table probably corrupted");
sql_print_error("Event Scheduler: "
"Error while reading from mysql.event. "
"The table is probably corrupted");
break;
}
if (et->status != Event_queue_element::ENABLED)
@ -1013,7 +1013,7 @@ Events::load_events_from_db(THD *thd)
/* let's find when to be executed */
if (et->compute_next_execution_time())
{
sql_print_error("SCHEDULER: Error while computing execution time of %s.%s."
sql_print_error("Event Scheduler: Error while computing execution time of %s.%s."
" Skipping", et->dbname.str, et->name.str);
continue;
}
@ -1030,11 +1030,11 @@ Events::load_events_from_db(THD *thd)
*/
switch (ret= temp_job_data.compile(thd, thd->mem_root)) {
case EVEX_MICROSECOND_UNSUP:
sql_print_error("SCHEDULER: mysql.event is tampered. MICROSECOND is not "
sql_print_error("Event Scheduler: mysql.event is tampered. MICROSECOND is not "
"supported but found in mysql.event");
break;
case EVEX_COMPILE_ERROR:
sql_print_error("SCHEDULER: Error while compiling %s.%s. Aborting load",
sql_print_error("Event Scheduler: Error while compiling %s.%s. Aborting load",
et->dbname.str, et->name.str);
break;
default:
@ -1066,8 +1066,8 @@ end:
else
{
ret= 0;
sql_print_information("SCHEDULER: Loaded %d event%s", count,
(count == 1)?"":"s");
sql_print_information("Event Scheduler: Loaded %d event%s",
count, (count == 1)?"":"s");
}
close_thread_tables(thd);

View File

@ -19,7 +19,6 @@ class sp_name;
class Event_parse_data;
class Event_db_repository;
class Event_queue;
class Event_queue_element;
class Event_scheduler;
/* Return codes */
@ -38,6 +37,10 @@ enum enum_events_error_code
int
sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
/**
@class Events -- a facade to the functionality of the Event Scheduler.
*/
class Events
{

View File

@ -6367,7 +6367,7 @@ int ndb_create_table_from_engine(THD *thd, const char *db,
LEX *old_lex= thd->lex, newlex;
thd->lex= &newlex;
newlex.current_select= NULL;
lex_start(thd, (const uchar*) "", 0);
lex_start(thd, "", 0);
int res= ha_create_table_from_engine(thd, db, table_name);
thd->lex= old_lex;
return res;

View File

@ -4988,10 +4988,10 @@ longlong Item_func_row_count::val_int()
}
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
sp_name *name_arg)
:Item_func(), context(context_arg), m_name(name_arg), m_sp(NULL),
result_field(NULL)
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
:Item_func(), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
{
maybe_null= 1;
m_name->init_qname(current_thd);
@ -5001,9 +5001,8 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
sp_name *name_arg, List<Item> &list)
:Item_func(list), context(context_arg), m_name(name_arg), m_sp(NULL),
result_field(NULL)
sp_name *name, List<Item> &list)
:Item_func(list), context(context_arg), m_name(name), m_sp(NULL),sp_result_field(NULL)
{
maybe_null= 1;
m_name->init_qname(current_thd);
@ -5015,10 +5014,10 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
void
Item_func_sp::cleanup()
{
if (result_field)
if (sp_result_field)
{
delete result_field;
result_field= NULL;
delete sp_result_field;
sp_result_field= NULL;
}
m_sp= NULL;
dummy_table->alias= NULL;
@ -5047,81 +5046,118 @@ Item_func_sp::func_name() const
}
Field *
Item_func_sp::sp_result_field(void) const
/**
@brief Initialize the result field by creating a temporary dummy table
and assign it to a newly created field object. Meta data used to
create the field is fetched from the sp_head belonging to the stored
proceedure found in the stored procedure functon cache.
@note This function should be called from fix_fields to init the result
field. It is some what related to Item_field.
@see Item_field
@param thd A pointer to the session and thread context.
@return Function return error status.
@retval TRUE is returned on an error
@retval FALSE is returned on success.
*/
bool
Item_func_sp::init_result_field(THD *thd)
{
Field *field;
DBUG_ENTER("Item_func_sp::sp_result_field");
DBUG_PRINT("info", ("sp: %s, flags: %x, level: %lu",
(m_sp ? "YES" : "NO"),
(m_sp ? m_sp->m_flags : (uint)0),
(m_sp ? m_sp->m_recursion_level : (ulong)0)));
DBUG_ENTER("Item_func_sp::init_result_field");
if (!m_sp)
{
THD *thd= current_thd;
if (!(m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
&thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
DBUG_RETURN(0);
}
}
if (!dummy_table->alias)
{
char *empty_name= (char *) "";
dummy_table->alias= empty_name;
dummy_table->maybe_null= maybe_null;
dummy_table->in_use= current_thd;
dummy_table->copy_blobs= TRUE;
dummy_table->s->table_cache_key.str = empty_name;
dummy_table->s->table_name.str= empty_name;
dummy_table->s->db.str= empty_name;
}
if (!(field= m_sp->create_result_field(max_length, name, dummy_table)))
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
LEX_STRING empty_name= { C_STRING_WITH_LEN("") };
TABLE_SHARE *share;
DBUG_RETURN(field);
DBUG_ASSERT(m_sp == NULL);
DBUG_ASSERT(sp_result_field == NULL);
if (!(m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
&thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
context->process_error(thd);
DBUG_RETURN(TRUE);
}
/*
A Field need to be attached to a Table.
Below we "create" a dummy table by initializing
the needed pointers.
*/
share= dummy_table->s;
dummy_table->alias = "";
dummy_table->maybe_null = maybe_null;
dummy_table->in_use= thd;
dummy_table->copy_blobs= TRUE;
share->table_cache_key = empty_name;
share->table_name = empty_name;
if (!(sp_result_field= m_sp->create_result_field(max_length, name, dummy_table)))
{
DBUG_RETURN(TRUE);
}
if (sp_result_field->pack_length() > sizeof(result_buf))
{
sp_result_field->move_field(sql_alloc(sp_result_field->pack_length()));
} else {
sp_result_field->move_field(result_buf);
}
sp_result_field->null_ptr= (uchar *) &null_value;
sp_result_field->null_bit= 1;
DBUG_RETURN(FALSE);
}
/**
@brief Initialize local members with values from the Field interface.
/*
Execute function & store value in field
@note called from Item::fix_fields.
*/
void Item_func_sp::fix_length_and_dec()
{
DBUG_ENTER("Item_func_sp::fix_length_and_dec");
RETURN
0 value <> NULL
1 value = NULL or error
DBUG_ASSERT(sp_result_field);
decimals= sp_result_field->decimals();
max_length= sp_result_field->field_length;
collation.set(sp_result_field->charset());
maybe_null= 1;
unsigned_flag= test(sp_result_field->flags & UNSIGNED_FLAG);
DBUG_VOID_RETURN;
}
/**
@brief Execute function & store value in field.
@return Function returns error status.
@retval FALSE on success.
@retval TRUE if an error occurred.
*/
bool
Item_func_sp::execute(Field **flp)
Item_func_sp::execute()
{
THD *thd= current_thd;
Field *f;
/*
Get field in virtual tmp table to store result. Create the field if
invoked first time.
*/
if (!(f= *flp))
{
if (!(*flp= f= sp_result_field()))
{
/* Error set by sp_result_field() */
null_value= 1;
return TRUE;
}
f->move_field((f->pack_length() > sizeof(result_buf)) ?
sql_alloc(f->pack_length()) : result_buf);
f->null_ptr= (uchar *)&null_value;
f->null_bit= 1;
}
/* Execute function and store the return value in the field. */
if (execute_impl(thd, f))
if (execute_impl(thd))
{
null_value= 1;
context->process_error(thd);
@ -5130,14 +5166,24 @@ Item_func_sp::execute(Field **flp)
/* Check that the field (the value) is not NULL. */
null_value= f->is_null();
null_value= sp_result_field->is_null();
return null_value;
}
/**
@brief Execute function and store the return value in the field.
@note This function was intended to be the concrete implementation of
the interface function execute. This was never realized.
@return The error state.
@retval FALSE on success
@retval TRUE if an error occurred.
*/
bool
Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
Item_func_sp::execute_impl(THD *thd)
{
bool err_status= TRUE;
Sub_statement_state statement_state;
@ -5154,7 +5200,7 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
thd->security_ctx= context->security_ctx;
}
#endif
if (find_and_check_access(thd))
if (sp_check_access(thd))
goto error;
/*
@ -5175,7 +5221,7 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
function call into binlog.
*/
thd->reset_sub_statement_state(&statement_state, SUB_STMT_FUNCTION);
err_status= m_sp->execute_function(thd, args, arg_count, return_value_fld);
err_status= m_sp->execute_function(thd, args, arg_count, sp_result_field);
thd->restore_sub_statement_state(&statement_state);
error:
@ -5190,15 +5236,9 @@ error:
void
Item_func_sp::make_field(Send_field *tmp_field)
{
Field *field;
DBUG_ENTER("Item_func_sp::make_field");
if ((field= sp_result_field()))
{
field->make_field(tmp_field);
delete field;
DBUG_VOID_RETURN;
}
init_make_field(tmp_field, MYSQL_TYPE_VARCHAR);
DBUG_ASSERT(sp_result_field);
sp_result_field->make_field(tmp_field);
DBUG_VOID_RETURN;
}
@ -5206,67 +5246,20 @@ Item_func_sp::make_field(Send_field *tmp_field)
enum enum_field_types
Item_func_sp::field_type() const
{
Field *field;
DBUG_ENTER("Item_func_sp::field_type");
if (result_field)
DBUG_RETURN(result_field->type());
if ((field= sp_result_field()))
{
enum_field_types result= field->type();
delete field;
DBUG_RETURN(result);
}
DBUG_RETURN(MYSQL_TYPE_VARCHAR);
DBUG_ASSERT(sp_result_field);
DBUG_RETURN(sp_result_field->type());
}
Item_result
Item_func_sp::result_type() const
{
Field *field;
DBUG_ENTER("Item_func_sp::result_type");
DBUG_PRINT("info", ("m_sp: 0x%lx", (long) m_sp));
if (result_field)
DBUG_RETURN(result_field->result_type());
if ((field= sp_result_field()))
{
Item_result result= field->result_type();
delete field;
DBUG_RETURN(result);
}
DBUG_RETURN(STRING_RESULT);
DBUG_PRINT("info", ("m_sp = %p", m_sp));
DBUG_ASSERT(sp_result_field);
DBUG_RETURN(sp_result_field->result_type());
}
void
Item_func_sp::fix_length_and_dec()
{
Field *field;
DBUG_ENTER("Item_func_sp::fix_length_and_dec");
if (result_field)
{
decimals= result_field->decimals();
max_length= result_field->field_length;
collation.set(result_field->charset());
DBUG_VOID_RETURN;
}
if (!(field= sp_result_field()))
{
context->process_error(current_thd);
DBUG_VOID_RETURN;
}
decimals= field->decimals();
max_length= field->field_length;
collation.set(field->charset());
maybe_null= 1;
delete field;
DBUG_VOID_RETURN;
}
longlong Item_func_found_rows::val_int()
{
DBUG_ASSERT(fixed == 1);
@ -5277,57 +5270,39 @@ longlong Item_func_found_rows::val_int()
Field *
Item_func_sp::tmp_table_field(TABLE *t_arg)
{
Field *field= 0;
DBUG_ENTER("Item_func_sp::tmp_table_field");
if (m_sp)
field= m_sp->create_result_field(max_length, (const char*) name, t_arg);
if (!field)
field= Item_func::tmp_table_field(t_arg);
if (!field)
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
DBUG_RETURN(field);
DBUG_ASSERT(sp_result_field);
DBUG_RETURN(sp_result_field);
}
/*
Find the function and check access rights to the function
SYNOPSIS
find_and_check_access()
thd thread handler
RETURN
FALSE Access granted
TRUE Requested access can't be granted or function doesn't exists
NOTES
Checks if requested access to function can be granted to user.
/**
@brief Checks if requested access to function can be granted to user.
If function isn't found yet, it searches function first.
If function can't be found or user don't have requested access
error is raised.
@param thd thread handler
@return Indication if the access was granted or not.
@retval FALSE Access is granted.
@retval TRUE Requested access can't be granted or function doesn't exists.
*/
bool
Item_func_sp::find_and_check_access(THD *thd)
Item_func_sp::sp_check_access(THD *thd)
{
if (! m_sp && ! (m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
&thd->sp_func_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
return TRUE;
}
DBUG_ENTER("Item_func_sp::sp_check_access");
DBUG_ASSERT(m_sp);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_routine_access(thd, EXECUTE_ACL,
m_sp->m_db.str, m_sp->m_name.str, 0, FALSE))
return TRUE;
DBUG_RETURN(TRUE);
#endif
return FALSE;
DBUG_RETURN(FALSE);
}
@ -5335,9 +5310,25 @@ bool
Item_func_sp::fix_fields(THD *thd, Item **ref)
{
bool res;
DBUG_ENTER("Item_func_sp::fix_fields");
DBUG_ASSERT(fixed == 0);
/*
We must call init_result_field before Item_func::fix_fields()
to make m_sp and result_field members available to fix_length_and_dec(),
which is called from Item_func::fix_fields().
*/
res= init_result_field(thd);
if (res)
DBUG_RETURN(res);
res= Item_func::fix_fields(thd, ref);
if (!res && thd->lex->view_prepare_mode)
if (res)
DBUG_RETURN(res);
if (thd->lex->view_prepare_mode)
{
/*
Here we check privileges of the stored routine only during view
@ -5349,15 +5340,17 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
good idea especially if the view has SQL SECURITY DEFINER and
the used stored procedure has SQL SECURITY DEFINER.
*/
res= find_and_check_access(thd);
res= sp_check_access(thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Try to set and restore the security context to see whether it's valid
*/
Security_context *save_secutiry_ctx;
if (!res && !(res= set_routine_security_ctx(thd, m_sp, false,
&save_secutiry_ctx)))
{
res= set_routine_security_ctx(thd, m_sp, false, &save_secutiry_ctx);
if (!res)
sp_restore_security_context(thd, save_secutiry_ctx);
}
#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
}
return res;
DBUG_RETURN(res);
}

View File

@ -1434,12 +1434,15 @@ private:
sp_name *m_name;
mutable sp_head *m_sp;
TABLE *dummy_table;
Field *result_field;
char result_buf[64];
/*
The result field of the concrete stored function.
*/
Field *sp_result_field;
bool execute(Field **flp);
bool execute_impl(THD *thd, Field *return_value_fld);
Field *sp_result_field(void) const;
bool execute();
bool execute_impl(THD *thd);
bool init_result_field(THD *thd);
public:
@ -1465,23 +1468,23 @@ public:
longlong val_int()
{
if (execute(&result_field))
if (execute())
return (longlong) 0;
return result_field->val_int();
return sp_result_field->val_int();
}
double val_real()
{
if (execute(&result_field))
if (execute())
return 0.0;
return result_field->val_real();
return sp_result_field->val_real();
}
my_decimal *val_decimal(my_decimal *dec_buf)
{
if (execute(&result_field))
if (execute())
return NULL;
return result_field->val_decimal(dec_buf);
return sp_result_field->val_decimal(dec_buf);
}
String *val_str(String *str)
@ -1490,7 +1493,7 @@ public:
char buff[20];
buf.set(buff, 20, str->charset());
buf.length(0);
if (execute(&result_field))
if (execute())
return NULL;
/*
result_field will set buf pointing to internal buffer
@ -1498,7 +1501,7 @@ public:
when SP is executed. In order to prevent occasional
corruption of returned value, we make here a copy.
*/
result_field->val_str(&buf);
sp_result_field->val_str(&buf);
str->copy(buf);
return str;
}
@ -1506,11 +1509,11 @@ public:
virtual bool change_context_processor(byte *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; }
void fix_length_and_dec();
bool find_and_check_access(THD * thd);
bool sp_check_access(THD * thd);
virtual enum Functype functype() const { return FUNC_SP; }
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec(void);
bool is_expensive() { return 1; }
};

View File

@ -842,7 +842,7 @@ bool is_update_query(enum enum_sql_command command);
bool alloc_query(THD *thd, const char *packet, uint packet_length);
void mysql_init_select(LEX *lex);
void mysql_reset_thd_for_next_command(THD *thd);
void mysql_init_query(THD *thd, uchar *buf, uint length);
void mysql_init_query(THD *thd, const char *buf, uint length);
bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void mysql_init_multi_delete(LEX *lex);
@ -1565,8 +1565,10 @@ extern bool check_reserved_words(LEX_STRING *name);
/* strfunc.cc */
ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning);
uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match);
uint find_type2(TYPELIB *lib, const char *find, uint length, CHARSET_INFO *cs);
uint find_type(const TYPELIB *lib, const char *find, uint length,
bool part_match);
uint find_type2(const TYPELIB *lib, const char *find, uint length,
CHARSET_INFO *cs);
void unhex_type2(TYPELIB *lib);
uint check_word(TYPELIB *lib, const char *val, const char *end,
const char **end_of_word);

View File

@ -6732,12 +6732,20 @@ static int show_ssl_ctx_get_session_cache_mode(THD *thd, SHOW_VAR *var, char *bu
return 0;
}
/* Functions relying on SSL */
/*
Functions relying on SSL
Note: In the show_ssl_* functions, we need to check if we have a
valid vio-object since this isn't always true, specifically
when session_status or global_status is requested from
inside an Event.
*/
static int show_ssl_get_version(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_CHAR;
var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
SSL_get_version((SSL*) thd->net.vio->ssl_arg) : "");
if( thd->vio_ok() && thd->net.vio->ssl_arg )
var->value= const_cast<char*>(SSL_get_version((SSL*) thd->net.vio->ssl_arg));
else
var->value= (char *)"";
return 0;
}
@ -6745,9 +6753,10 @@ static int show_ssl_session_reused(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
SSL_session_reused((SSL*) thd->net.vio->ssl_arg) :
0;
if( thd->vio_ok() && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_session_reused((SSL*) thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
return 0;
}
@ -6755,9 +6764,10 @@ static int show_ssl_get_default_timeout(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg) :
0;
if( thd->vio_ok() && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_get_default_timeout((SSL*)thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
return 0;
}
@ -6765,9 +6775,10 @@ static int show_ssl_get_verify_mode(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg) :
0;
if( thd->net.vio && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_get_verify_mode((SSL*)thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
return 0;
}
@ -6775,17 +6786,20 @@ static int show_ssl_get_verify_depth(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_LONG;
var->value= buff;
*((long *)buff)= (long)thd->net.vio->ssl_arg ?
SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg) :
0;
if( thd->vio_ok() && thd->net.vio->ssl_arg )
*((long *)buff)= (long)SSL_get_verify_depth((SSL*)thd->net.vio->ssl_arg);
else
*((long *)buff)= 0;
return 0;
}
static int show_ssl_get_cipher(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_CHAR;
var->value= const_cast<char*>(thd->net.vio->ssl_arg ?
SSL_get_cipher((SSL*) thd->net.vio->ssl_arg) : "");
if( thd->vio_ok() && thd->net.vio->ssl_arg )
var->value= const_cast<char*>(SSL_get_cipher((SSL*) thd->net.vio->ssl_arg));
else
var->value= (char *)"";
return 0;
}
@ -6793,7 +6807,7 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_CHAR;
var->value= buff;
if (thd->net.vio->ssl_arg)
if (thd->vio_ok() && thd->net.vio->ssl_arg)
{
int i;
const char *p;

View File

@ -156,7 +156,7 @@ public:
char *part_func_string;
char *subpart_func_string;
uchar *part_state;
const char *part_state;
partition_element *curr_part_elem;
partition_element *current_partition;

View File

@ -5881,10 +5881,10 @@ ER_EVENT_NEITHER_M_EXPR_NOR_M_AT
eng "No datetime expression provided"
ger "Kein DATETIME-Ausdruck angegeben"
ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
eng "Column count of mysql.%s is wrong. Expected %d, found %d. Table probably corrupted"
eng "Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted"
ger "Spaltenanzahl von mysql.%s falsch. %d erwartet, aber %d gefunden. Tabelle ist wahrscheinlich beschädigt"
ER_CANNOT_LOAD_FROM_TABLE
eng "Cannot load from mysql.%s. Table probably corrupted. See error log."
eng "Cannot load from mysql.%s. The table is probably corrupted. Please see the error log for details"
ger "Kann mysql.%s nicht einlesen. Tabelle ist wahrscheinlich beschädigt, siehe Fehlerlog"
ER_EVENT_CANNOT_DELETE
eng "Failed to delete the event from mysql.event"
@ -5978,11 +5978,11 @@ ER_BASE64_DECODE_ERROR
ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
eng "Triggers can not be created on system tables"
ger "Trigger können nicht auf Systemtabellen erzeugt werden"
ER_EVENT_RECURSIVITY_FORBIDDEN
eng "Recursivity of EVENT DDL statements is forbidden when body is present"
ER_EVENT_RECURSION_FORBIDDEN
eng "Recursion of EVENT DDL statements is forbidden when body is present"
ger "Rekursivität von EVENT-DDL-Anweisungen ist unzulässig wenn ein Hauptteil (Body) existiert"
ER_EVENTS_DB_ERROR
eng "Cannot proceed because the tables used by events were found damaged at server start"
eng "Cannot proceed because system tables used by Event Scheduler were found damaged at server start"
ger "Kann nicht weitermachen, weil die Tabellen, die von Events verwendet werden, beim Serverstart als beschädigt markiert wurden"
ER_ONLY_INTEGERS_ALLOWED
eng "Only integers allowed as number here"

View File

@ -384,7 +384,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
if ((ret= sp_use_new_db(thd, name->m_db, &old_db, 1, &dbchanged)))
goto end;
lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length());
lex_start(thd, defstr.c_ptr(), defstr.length());
thd->spcont= 0;
if (MYSQLparse(thd) || thd->is_fatal_error || newlex.sphead == NULL)

View File

@ -541,15 +541,14 @@ void
sp_head::init_strings(THD *thd, LEX *lex)
{
DBUG_ENTER("sp_head::init_strings");
const uchar *endp; /* Used to trim the end */
const char *endp; /* Used to trim the end */
/* During parsing, we must use thd->mem_root */
MEM_ROOT *root= thd->mem_root;
if (m_param_begin && m_param_end)
{
m_params.length= m_param_end - m_param_begin;
m_params.str= strmake_root(root,
(char *)m_param_begin, m_params.length);
m_params.str= strmake_root(root, m_param_begin, m_params.length);
}
/* If ptr has overrun end_of_query then end_of_query is the end */
@ -561,9 +560,9 @@ sp_head::init_strings(THD *thd, LEX *lex)
endp= skip_rear_comments(m_body_begin, endp);
m_body.length= endp - m_body_begin;
m_body.str= strmake_root(root, (char *)m_body_begin, m_body.length);
m_body.str= strmake_root(root, m_body_begin, m_body.length);
m_defstr.length= endp - lex->buf;
m_defstr.str= strmake_root(root, (char *)lex->buf, m_defstr.length);
m_defstr.str= strmake_root(root, lex->buf, m_defstr.length);
DBUG_VOID_RETURN;
}

View File

@ -126,7 +126,7 @@ public:
create_field m_return_field_def; /* This is used for FUNCTIONs only. */
const uchar *m_tmp_query; // Temporary pointer to sub query string
const char *m_tmp_query; // Temporary pointer to sub query string
st_sp_chistics *m_chistics;
ulong m_sql_mode; // For SHOW CREATE and execution
LEX_STRING m_qname; // db.name
@ -174,7 +174,7 @@ public:
*/
HASH m_sroutines;
// Pointers set during parsing
const uchar *m_param_begin, *m_param_end, *m_body_begin;
const char *m_param_begin, *m_param_end, *m_body_begin;
/*
Security context for stored routine which should be run under

View File

@ -33,10 +33,10 @@ sys_var *trg_new_row_fake_var= (sys_var*) 0x01;
/* Macros to look like lex */
#define yyGet() *(lex->ptr++)
#define yyGetLast() lex->ptr[-1]
#define yyPeek() lex->ptr[0]
#define yyPeek2() lex->ptr[1]
#define yyGet() ((uchar) *(lex->ptr++))
#define yyGetLast() ((uchar) lex->ptr[-1])
#define yyPeek() ((uchar) lex->ptr[0])
#define yyPeek2() ((uchar) lex->ptr[1])
#define yyUnget() lex->ptr--
#define yySkip() lex->ptr++
#define yyLength() ((uint) (lex->ptr - lex->tok_start)-1)
@ -127,7 +127,7 @@ st_parsing_options::reset()
(We already do too much here)
*/
void lex_start(THD *thd, const uchar *buf, uint length)
void lex_start(THD *thd, const char *buf, uint length)
{
LEX *lex= thd->lex;
DBUG_ENTER("lex_start");
@ -238,9 +238,9 @@ void lex_end(LEX *lex)
static int find_keyword(LEX *lex, uint len, bool function)
{
const uchar *tok=lex->tok_start;
const char *tok= lex->tok_start;
SYMBOL *symbol= get_hash_symbol((const char *)tok,len,function);
SYMBOL *symbol= get_hash_symbol(tok, len, function);
if (symbol)
{
lex->yylval->symbol.symbol=symbol;
@ -305,16 +305,16 @@ static LEX_STRING get_token(LEX *lex,uint length)
static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
{
LEX_STRING tmp;
const uchar *from, *end;
uchar *to;
const char *from, *end;
char *to;
yyUnget(); // ptr points now after last token char
tmp.length=lex->yytoklen=length;
tmp.str=(char*) lex->thd->alloc(tmp.length+1);
for (from= lex->tok_start, to= (uchar*) tmp.str, end= to+length ;
for (from= lex->tok_start, to= tmp.str, end= to+length ;
to != end ;
)
{
if ((*to++= *from++) == (uchar) quote)
if ((*to++= *from++) == quote)
from++; // Skip double quotes
}
*to= 0; // End null for safety
@ -341,9 +341,7 @@ static char *get_text(LEX *lex)
{
int l;
if (use_mb(cs) &&
(l = my_ismbchar(cs,
(const char *)lex->ptr-1,
(const char *)lex->end_of_query))) {
(l = my_ismbchar(cs, lex->ptr-1, lex->end_of_query))) {
lex->ptr += l-1;
continue;
}
@ -368,12 +366,12 @@ static char *get_text(LEX *lex)
yyUnget();
/* Found end. Unescape and return string */
const uchar *str, *end;
uchar *start;
const char *str, *end;
char *start;
str=lex->tok_start+1;
end=lex->ptr-1;
if (!(start=(uchar*) lex->thd->alloc((uint) (end-str)+1)))
if (!(start= (char*) lex->thd->alloc((uint) (end-str)+1)))
return (char*) ""; // Sql_alloc has set error flag
if (!found_escape)
{
@ -383,15 +381,14 @@ static char *get_text(LEX *lex)
}
else
{
uchar *to;
char *to;
for (to=start ; str != end ; str++)
{
#ifdef USE_MB
int l;
if (use_mb(cs) &&
(l = my_ismbchar(cs,
(const char *)str, (const char *)end))) {
(l = my_ismbchar(cs, str, end))) {
while (l--)
*to++ = *str++;
str--;
@ -437,7 +434,7 @@ static char *get_text(LEX *lex)
*to=0;
lex->yytoklen=(uint) (to-start);
}
return (char*) start;
return start;
}
}
return 0; // unexpected end of query
@ -556,7 +553,6 @@ int MYSQLlex(void *arg, void *yythd)
lex->yylval=yylval; // The global state
lex->tok_end_prev= lex->tok_end;
lex->tok_start_prev= lex->tok_start;
lex->tok_start=lex->tok_end=lex->ptr;
@ -640,16 +636,14 @@ int MYSQLlex(void *arg, void *yythd)
break;
}
case MY_LEX_IDENT:
const uchar *start;
const char *start;
#if defined(USE_MB) && defined(USE_MB_IDENT)
if (use_mb(cs))
{
result_state= IDENT_QUOTED;
if (my_mbcharlen(cs, yyGetLast()) > 1)
{
int l = my_ismbchar(cs,
(const char *)lex->ptr-1,
(const char *)lex->end_of_query);
int l = my_ismbchar(cs, lex->ptr-1, lex->end_of_query);
if (l == 0) {
state = MY_LEX_CHAR;
continue;
@ -661,9 +655,7 @@ int MYSQLlex(void *arg, void *yythd)
if (my_mbcharlen(cs, c) > 1)
{
int l;
if ((l = my_ismbchar(cs,
(const char *)lex->ptr-1,
(const char *)lex->end_of_query)) == 0)
if ((l = my_ismbchar(cs, lex->ptr-1, lex->end_of_query)) == 0)
break;
lex->ptr += l-1;
}
@ -786,9 +778,7 @@ int MYSQLlex(void *arg, void *yythd)
if (my_mbcharlen(cs, c) > 1)
{
int l;
if ((l = my_ismbchar(cs,
(const char *)lex->ptr-1,
(const char *)lex->end_of_query)) == 0)
if ((l = my_ismbchar(cs, lex->ptr-1, lex->end_of_query)) == 0)
break;
lex->ptr += l-1;
}
@ -1122,7 +1112,7 @@ int MYSQLlex(void *arg, void *yythd)
Pointer to the last non-comment symbol of the statement.
*/
const uchar *skip_rear_comments(const uchar *begin, const uchar *end)
const char *skip_rear_comments(const char *begin, const char *end)
{
while (begin < end && (end[-1] <= ' ' || end[-1] == '*' ||
end[-1] == '/' || end[-1] == ';'))

View File

@ -542,7 +542,7 @@ public:
void set_limit(st_select_lex *values);
void set_thd(THD *thd_arg) { thd= thd_arg; }
friend void lex_start(THD *thd, const uchar *buf, uint length);
friend void lex_start(THD *thd, const char *buf, uint length);
friend int subselect_union_engine::exec();
List<Item> *get_unit_column_types();
@ -743,7 +743,7 @@ public:
void cut_subtree() { slave= 0; }
bool test_limit();
friend void lex_start(THD *thd, const uchar *buf, uint length);
friend void lex_start(THD *thd, const char *buf, uint length);
st_select_lex() : n_sum_items(0), n_child_sum_items(0) {}
void make_empty_select()
{
@ -996,11 +996,11 @@ typedef struct st_lex : public Query_tables_list
SELECT_LEX *current_select;
/* list of all SELECT_LEX */
SELECT_LEX *all_selects_list;
const uchar *buf; /* The beginning of string, used by SPs */
const uchar *ptr,*tok_start,*tok_end,*end_of_query;
const char *buf; /* The beginning of string, used by SPs */
const char *ptr,*tok_start,*tok_end,*end_of_query;
/* The values of tok_start/tok_end as they were one call of MYSQLlex before */
const uchar *tok_start_prev, *tok_end_prev;
/* The value of tok_start as they were one call of MYSQLlex before */
const char *tok_start_prev;
char *length,*dec,*change;
LEX_STRING name;
@ -1202,7 +1202,7 @@ typedef struct st_lex : public Query_tables_list
Pointers to part of LOAD DATA statement that should be rewritten
during replication ("LOCAL 'filename' REPLACE INTO" part).
*/
const uchar *fname_start, *fname_end;
const char *fname_start, *fname_end;
/*
Reference to a struct that contains information in various commands
@ -1319,10 +1319,10 @@ struct st_lex_local: public st_lex
extern void lex_init(void);
extern void lex_free(void);
extern void lex_start(THD *thd, const uchar *buf, uint length);
extern void lex_start(THD *thd, const char *buf, uint length);
extern void lex_end(LEX *lex);
extern int MYSQLlex(void *arg, void *yythd);
extern const uchar *skip_rear_comments(const uchar *ubegin, const uchar *uend);
extern const char *skip_rear_comments(const char *ubegin, const char *uend);
extern bool is_lex_native_function(const LEX_STRING *name);

View File

@ -983,7 +983,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
/* init structures for VIEW processing */
table_list.select_lex= &(thd->lex->select_lex);
mysql_init_query(thd, (uchar*)"", 0);
mysql_init_query(thd, "", 0);
thd->lex->
select_lex.table_list.link_in_list((byte*) &table_list,
(byte**) &table_list.next_local);
@ -5011,7 +5011,7 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
****************************************************************************/
void
mysql_init_query(THD *thd, uchar *buf, uint length)
mysql_init_query(THD *thd, const char *buf, uint length)
{
DBUG_ENTER("mysql_init_query");
lex_start(thd, buf, length);
@ -5235,7 +5235,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
mysql_init_query(thd, (uchar*) inBuf, length);
mysql_init_query(thd, inBuf, length);
if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
{
@ -5315,7 +5315,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
bool error= 0;
DBUG_ENTER("mysql_test_parse_for_slave");
mysql_init_query(thd, (uchar*) inBuf, length);
mysql_init_query(thd, inBuf, length);
if (!MYSQLparse((void*) thd) && ! thd->is_fatal_error &&
all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
error= 1; /* Ignore question */

View File

@ -3700,9 +3700,9 @@ void get_partition_set(const TABLE *table, byte *buf, const uint index,
possible to retrace this given an item tree.
*/
bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
uint part_info_len,
uchar *part_state, uint part_state_len,
bool mysql_unpack_partition(THD *thd,
const char *part_buf, uint part_info_len,
const char *part_state, uint part_state_len,
TABLE* table, bool is_create_table_ind,
handlerton *default_db_type)
{

View File

@ -77,9 +77,9 @@ void get_full_part_id_from_key(const TABLE *table, byte *buf,
KEY *key_info,
const key_range *key_spec,
part_id_range *part_spec);
bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
bool mysql_unpack_partition(THD *thd, const char *part_buf,
uint part_info_len,
uchar *part_state, uint part_state_len,
const char *part_state, uint part_state_len,
TABLE *table, bool is_create_table_ind,
handlerton *default_db_type);
void make_used_partitions_str(partition_info *part_info, String *parts_str);

View File

@ -2850,7 +2850,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
old_stmt_arena= thd->stmt_arena;
thd->stmt_arena= this;
lex_start(thd, (uchar*) thd->query, thd->query_length);
lex_start(thd, thd->query, thd->query_length);
lex->stmt_prepare_mode= TRUE;
error= MYSQLparse((void *)thd) || thd->is_fatal_error ||

View File

@ -237,7 +237,7 @@ bool servers_reload(THD *thd)
if (simple_open_n_lock_tables(thd, tables))
{
sql_print_error("Fatal error: Can't open and lock privilege tables: %s",
sql_print_error("Can't open and lock privilege tables: %s",
thd->net.last_error);
goto end;
}

View File

@ -976,7 +976,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
LEX_STRING *trg_definer= it_definer++;
thd->variables.sql_mode= (ulong)*trg_sql_mode;
lex_start(thd, (uchar*)trg_create_str->str, trg_create_str->length);
lex_start(thd, trg_create_str->str, trg_create_str->length);
thd->spcont= 0;
if (MYSQLparse((void *)thd) || thd->is_fatal_error)

View File

@ -679,7 +679,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
char md5[MD5_BUFF_LENGTH];
bool can_be_merged;
char dir_buff[FN_REFLEN], path_buff[FN_REFLEN];
const uchar *endp;
const char *endp;
LEX_STRING dir, file, path;
DBUG_ENTER("mysql_register_view");
@ -763,9 +763,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->query.str= (char*)str.ptr();
view->query.length= str.length()-1; // we do not need last \0
view->source.str= thd->query + thd->lex->create_view_select_start;
endp= (uchar*) view->source.str;
endp= skip_rear_comments(endp, (uchar*) (thd->query + thd->query_length));
view->source.length= endp - (uchar*) view->source.str;
endp= view->source.str;
endp= skip_rear_comments(endp, thd->query + thd->query_length);
view->source.length= endp - view->source.str;
view->file_version= 1;
view->calc_md5(md5);
view->md5.str= md5;
@ -974,7 +974,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
now Lex placed in statement memory
*/
table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local;
lex_start(thd, (uchar*)table->query.str, table->query.length);
lex_start(thd, table->query.str, table->query.length);
view_select= &lex->select_lex;
view_select->select_number= ++thd->select_number;
{

View File

@ -1853,7 +1853,7 @@ ev_sql_stmt:
*/
if (lex->sphead)
{
my_error(ER_EVENT_RECURSIVITY_FORBIDDEN, MYF(0));
my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
MYSQL_YYABORT;
}
@ -2701,7 +2701,7 @@ sp_proc_stmt_statement:
else
i->m_query.length= lex->tok_end - sp->m_tmp_query;
i->m_query.str= strmake_root(YYTHD->mem_root,
(char *)sp->m_tmp_query,
sp->m_tmp_query,
i->m_query.length);
sp->add_instr(i);
}
@ -9305,7 +9305,7 @@ param_marker:
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
MYSQL_YYABORT;
}
item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query));
item= new Item_param((uint) (lex->tok_start - thd->query));
if (!($$= item) || lex->param_list.push_back(item))
{
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
@ -10142,7 +10142,7 @@ option_type_value:
if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5)))
MYSQL_YYABORT;
strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query,
strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query,
qbuff.length);
qbuff.length+= 4;
i->m_query= qbuff;
@ -11361,18 +11361,16 @@ view_select_aux:
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
char *stmt_beg= (lex->sphead ?
(char *)lex->sphead->m_tmp_query :
thd->query);
const char *stmt_beg= (lex->sphead ?
lex->sphead->m_tmp_query : thd->query);
lex->create_view_select_start= $2 - stmt_beg;
}
| '(' remember_name select_paren ')' union_opt
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
char *stmt_beg= (lex->sphead ?
(char *)lex->sphead->m_tmp_query :
thd->query);
const char *stmt_beg= (lex->sphead ?
lex->sphead->m_tmp_query : thd->query);
lex->create_view_select_start= $2 - stmt_beg;
}
;

View File

@ -104,7 +104,8 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs,
> 0 position in TYPELIB->type_names +1
*/
uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match)
uint find_type(const TYPELIB *lib, const char *find, uint length,
bool part_match)
{
uint found_count=0, found_pos=0;
const char *end= find+length;
@ -144,7 +145,8 @@ uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match)
>0 Offset+1 in typelib for matched string
*/
uint find_type2(TYPELIB *typelib, const char *x, uint length, CHARSET_INFO *cs)
uint find_type2(const TYPELIB *typelib, const char *x, uint length,
CHARSET_INFO *cs)
{
int pos;
const char *j;

View File

@ -682,8 +682,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if ((share->partition_info_len= partition_info_len))
{
if (!(share->partition_info=
(uchar*) memdup_root(&share->mem_root, next_chunk + 4,
partition_info_len + 1)))
memdup_root(&share->mem_root, next_chunk + 4,
partition_info_len + 1)))
{
my_free(buff, MYF(0));
goto err;
@ -1528,7 +1528,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
tmp= mysql_unpack_partition(thd, share->partition_info,
share->partition_info_len,
(uchar*)share->part_state,
share->part_state,
share->part_state_len,
outparam, is_create_table,
share->default_part_db_type);

View File

@ -236,9 +236,9 @@ typedef struct st_table_share
bool log_table;
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool auto_partitioned;
const uchar *partition_info;
const char *partition_info;
uint partition_info_len;
const uchar *part_state;
const char *part_state;
uint part_state_len;
handlerton *default_part_db_type;
#endif