Commit 8fd74f31 authored by unknown's avatar unknown

merging before test + push


mysql-test/r/events.result:
  Auto merged
mysql-test/t/events.test:
  Auto merged
sql/event.h:
  Auto merged
sql/event_timed.cc:
  manual merge
parents c6e5c2bc 5a888df6
...@@ -21,7 +21,7 @@ pkglib_LIBRARIES = libdbug.a ...@@ -21,7 +21,7 @@ pkglib_LIBRARIES = libdbug.a
noinst_HEADERS = dbug_long.h noinst_HEADERS = dbug_long.h
libdbug_a_SOURCES = dbug.c sanity.c libdbug_a_SOURCES = dbug.c sanity.c
EXTRA_DIST = example1.c example2.c example3.c \ EXTRA_DIST = example1.c example2.c example3.c \
user.r monty.doc readme.prof dbug_add_tags.pl \ user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c my_main.c main.c factorial.c dbug_analyze.c
NROFF_INC = example1.r example2.r example3.r main.r \ NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \ factorial.r output1.r output2.r output3.r \
......
...@@ -384,4 +384,8 @@ show processlist; ...@@ -384,4 +384,8 @@ show processlist;
Id User Host db Command Time State Info Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist # root localhost events_test Query # NULL show processlist
drop event закачка21; 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: Explicit or implicit commit is not allowed in stored function or trigger.
drop table t_16;
drop database events_test; drop database events_test;
...@@ -356,6 +356,17 @@ select release_lock("test_lock2_1"); ...@@ -356,6 +356,17 @@ select release_lock("test_lock2_1");
show processlist; show processlist;
drop event закаÑка21; drop event закаÑка21;
####
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
#
create table t_16 (s1 int);
--error 1422
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;
#
# end of test case
####
##set global event_scheduler=1; ##set global event_scheduler=1;
##select get_lock("test_lock3", 20); ##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
......
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
extern ulong opt_event_executor; extern ulong opt_event_executor;
enum enum_event_on_completion enum enum_event_on_completion
{ {
MYSQL_EVENT_ON_COMPLETION_DROP = 1, MYSQL_EVENT_ON_COMPLETION_DROP = 1,
MYSQL_EVENT_ON_COMPLETION_PRESERVE MYSQL_EVENT_ON_COMPLETION_PRESERVE
}; };
enum enum_event_status enum enum_event_status
{ {
MYSQL_EVENT_ENABLED = 1, MYSQL_EVENT_ENABLED = 1,
MYSQL_EVENT_DISABLED MYSQL_EVENT_DISABLED
}; };
...@@ -60,9 +60,9 @@ enum evex_table_field ...@@ -60,9 +60,9 @@ enum evex_table_field
EVEX_FIELD_NAME, EVEX_FIELD_NAME,
EVEX_FIELD_BODY, EVEX_FIELD_BODY,
EVEX_FIELD_DEFINER, EVEX_FIELD_DEFINER,
EVEX_FIELD_EXECUTE_AT, EVEX_FIELD_EXECUTE_AT,
EVEX_FIELD_INTERVAL_EXPR, EVEX_FIELD_INTERVAL_EXPR,
EVEX_FIELD_TRANSIENT_INTERVAL, EVEX_FIELD_TRANSIENT_INTERVAL,
EVEX_FIELD_CREATED, EVEX_FIELD_CREATED,
EVEX_FIELD_MODIFIED, EVEX_FIELD_MODIFIED,
EVEX_FIELD_LAST_EXECUTED, EVEX_FIELD_LAST_EXECUTED,
...@@ -112,7 +112,7 @@ class event_timed ...@@ -112,7 +112,7 @@ class event_timed
ulong sql_mode; ulong sql_mode;
const uchar *body_begin; const uchar *body_begin;
bool dropped; bool dropped;
bool free_sphead_on_delete; bool free_sphead_on_delete;
uint flags;//all kind of purposes uint flags;//all kind of purposes
...@@ -123,26 +123,26 @@ class event_timed ...@@ -123,26 +123,26 @@ class event_timed
status(MYSQL_EVENT_ENABLED), sphead(0), sql_mode(0), status(MYSQL_EVENT_ENABLED), sphead(0), sql_mode(0),
body_begin(0), dropped(false), free_sphead_on_delete(true), body_begin(0), dropped(false), free_sphead_on_delete(true),
flags(0) flags(0)
{ {
pthread_mutex_init(&this->LOCK_running, MY_MUTEX_INIT_FAST); pthread_mutex_init(&this->LOCK_running, MY_MUTEX_INIT_FAST);
init(); init();
} }
~event_timed() ~event_timed()
{ {
pthread_mutex_destroy(&this->LOCK_running); pthread_mutex_destroy(&this->LOCK_running);
if (free_sphead_on_delete) if (free_sphead_on_delete)
free_sp(); free_sp();
} }
void void
init(); init();
int int
init_definer(THD *thd); init_definer(THD *thd);
int int
init_execute_at(THD *thd, Item *expr); init_execute_at(THD *thd, Item *expr);
...@@ -157,7 +157,7 @@ class event_timed ...@@ -157,7 +157,7 @@ class event_timed
int int
init_ends(THD *thd, Item *ends); init_ends(THD *thd, Item *ends);
void void
init_body(THD *thd); init_body(THD *thd);
...@@ -168,38 +168,38 @@ class event_timed ...@@ -168,38 +168,38 @@ class event_timed
load_from_row(MEM_ROOT *mem_root, TABLE *table); load_from_row(MEM_ROOT *mem_root, TABLE *table);
bool bool
compute_next_execution_time(); compute_next_execution_time();
void void
mark_last_executed(THD *thd); mark_last_executed(THD *thd);
int int
drop(THD *thd); drop(THD *thd);
bool bool
update_fields(THD *thd); update_fields(THD *thd);
int int
get_create_event(THD *thd, String *buf); get_create_event(THD *thd, String *buf);
int int
execute(THD *thd, MEM_ROOT *mem_root= NULL); execute(THD *thd, MEM_ROOT *mem_root= NULL);
int int
compile(THD *thd, MEM_ROOT *mem_root= NULL); compile(THD *thd, MEM_ROOT *mem_root= NULL);
my_bool my_bool
is_running() is_running()
{ {
my_bool ret; my_bool ret;
VOID(pthread_mutex_lock(&this->LOCK_running)); VOID(pthread_mutex_lock(&this->LOCK_running));
ret= running; ret= running;
VOID(pthread_mutex_unlock(&this->LOCK_running)); VOID(pthread_mutex_unlock(&this->LOCK_running));
return ret; return ret;
} }
void free_sp() void free_sp()
{ {
delete sphead; delete sphead;
...@@ -247,7 +247,7 @@ shutdown_events(); ...@@ -247,7 +247,7 @@ shutdown_events();
// auxiliary // auxiliary
int int
event_timed_compare(event_timed **a, event_timed **b); event_timed_compare(event_timed **a, event_timed **b);
......
...@@ -36,8 +36,8 @@ evex_db_find_event_aux(THD *thd, const LEX_STRING dbname, ...@@ -36,8 +36,8 @@ evex_db_find_event_aux(THD *thd, const LEX_STRING dbname,
const LEX_STRING rname, const LEX_STRING rname,
const LEX_STRING definer, const LEX_STRING definer,
TABLE *table); TABLE *table);
int int
event_timed_compare_q(void *vptr, byte* a, byte *b); event_timed_compare_q(void *vptr, byte* a, byte *b);
int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists, int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
......
This diff is collapsed.
...@@ -375,8 +375,8 @@ void Item::print_item_w_name(String *str) ...@@ -375,8 +375,8 @@ void Item::print_item_w_name(String *str)
void Item::cleanup() void Item::cleanup()
{ {
DBUG_ENTER("Item::cleanup"); DBUG_ENTER("Item::cleanup");
DBUG_PRINT("info", ("Item: 0x%lx, Type: %d, name %s, original name %s", DBUG_PRINT("info", ("Item: 0x%lx, name %s, original name %s",
this, (int)type(), name ? name : "(null)", this, name ? name : "(null)",
orig_name ? orig_name : "null")); orig_name ? orig_name : "null"));
fixed=0; fixed=0;
marker= 0; marker= 0;
......
...@@ -255,6 +255,9 @@ sp_get_flags_for_command(LEX *lex) ...@@ -255,6 +255,9 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_ALTER_FUNCTION: case SQLCOM_ALTER_FUNCTION:
case SQLCOM_DROP_PROCEDURE: case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION: case SQLCOM_DROP_FUNCTION:
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
case SQLCOM_DROP_EVENT:
flags= sp_head::HAS_COMMIT_OR_ROLLBACK; flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
break; break;
default: default:
......
...@@ -3773,6 +3773,12 @@ mysql_execute_command(THD *thd) ...@@ -3773,6 +3773,12 @@ mysql_execute_command(THD *thd)
is_schema_db(lex->et->dbname.str))) is_schema_db(lex->et->dbname.str)))
break; break;
if (end_active_trans(thd))
{
res= -1;
break;
}
switch (lex->sql_command) { switch (lex->sql_command) {
case SQLCOM_CREATE_EVENT: case SQLCOM_CREATE_EVENT:
res= evex_create_event(thd, lex->et, (uint) lex->create_info.options, res= evex_create_event(thd, lex->et, (uint) lex->create_info.options,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment