1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

WL#3337 (Event scheduler new architecture)

Third cut to simplify parsing phase. Now DROP EVENT works.

Overloaded few functions to be able to use either sp_name or pass two LEX_STRINGs
instead of a Event_timed pointer. This is transitional and eventually the old
functions will be removed. For now DROP EVENT also works, does not need anymore
a parsing object (Event_timed) and definer initialization because everyone who
has EVENT_ACL can drop events, and this is checked on execution time in sql_parse.cc
from the security context, as it should be.


sql/event_data_objects.cc:
  overload few functions
sql/event_scheduler.cc:
  Event_scheduler::drop_event() actually does not need Event_timed object
  but just an identifier, hence pass only sp_name.
  
  Overloaded Event_scheduler::find_event() to work with sp_name object. Eventually
  the old version will be removed. This is being done as transitional step to
  be able to test frequently code.
sql/event_scheduler.h:
  Event_scheduler::drop_event() actually does not need Event_timed object
  but just an identifier, hence pass only sp_name.
  
  Overloaded Event_scheduler::find_event() to work with sp_name object. Eventually
  the old version will be removed. This is being done as transitional step to
  be able to test frequently code.
sql/events.cc:
  Change db_drop_event() not to use Event_timed, either coming from parsing
  or from Event_timed::drop, but use LEX_STRINGs. sp_name is not convinient
  because in Event_timed::drop a temporary object has to be created. Hence, 
  dereference the sp_name in Events::drop_event() and pass the LEX_STRINGs.
sql/events.h:
  Change db_drop_event() not to use Event_timed, either coming from parsing
  or from Event_timed::drop, but use LEX_STRINGs. sp_name is not convinient
  because in Event_timed::drop a temporary object has to be created. Hence, 
  dereference the sp_name in Events::drop_event() and pass the LEX_STRINGs.
sql/events_priv.h:
  Change db_drop_event() not to use Event_timed, either coming from parsing
  or from Event_timed::drop, but use LEX_STRINGs. sp_name is not convinient
  because in Event_timed::drop a temporary object has to be created. Hence, 
  dereference the sp_name in Events::drop_event() and pass the LEX_STRINGs.
sql/sql_parse.cc:
  SQLCOM_DROP_EVENT does not need lex->event_parse_data object and 
  is more like SQLCOM_SHOW_CREATE_EVENT. Therefore, move it to the block that
  handles the latter.
sql/sql_yacc.yy:
  DROP EVENT does not need a parsing object, just a name.
  Store it as lex->spname. Pretty similar handling to the one of
  SHOW CREATE EVENT.
This commit is contained in:
unknown
2006-06-27 11:51:11 +02:00
parent d2db48c69b
commit ef9a97e685
8 changed files with 158 additions and 58 deletions

View File

@@ -3819,7 +3819,6 @@ end_with_restore_list:
}
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
case SQLCOM_DROP_EVENT:
{
uint rows_affected= 1;
DBUG_ASSERT(lex->et);
@@ -3856,9 +3855,6 @@ end_with_restore_list:
res= Events::update_event(thd, lex->et, lex->event_parse_data,
lex->spname, &rows_affected);
break;
case SQLCOM_DROP_EVENT:
res= Events::drop_event(thd, lex->et, lex->event_parse_data,
lex->drop_if_exists, &rows_affected);
default:;
}
DBUG_PRINT("info", ("CREATE/ALTER/DROP returned error code=%d af_rows=%d",
@@ -3877,6 +3873,7 @@ end_with_restore_list:
break;
}
case SQLCOM_DROP_EVENT:
case SQLCOM_SHOW_CREATE_EVENT:
{
DBUG_ASSERT(lex->spname);
@@ -3893,9 +3890,24 @@ end_with_restore_list:
if (lex->spname->m_name.length > NAME_LEN)
{
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
/* this jumps to the end of the function and skips own messaging */
goto error;
}
res= Events::show_create_event(thd, lex->spname);
if (lex->sql_command == SQLCOM_SHOW_CREATE_EVENT)
res= Events::show_create_event(thd, lex->spname);
else
{
uint rows_affected= 1;
if (end_active_trans(thd))
{
res= -1;
break;
}
if (!(res= Events::drop_event(thd, lex->spname, lex->drop_if_exists,
&rows_affected)))
send_ok(thd, rows_affected);
}
break;
}
#ifndef DBUG_OFF