1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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

@@ -1299,7 +1299,7 @@ Event_timed::drop(THD *thd)
uint tmp= 0;
DBUG_ENTER("Event_timed::drop");
DBUG_RETURN(db_drop_event(thd, this, false, &tmp));
DBUG_RETURN(db_drop_event(thd, dbname, name, false, &tmp));
}
@@ -1903,8 +1903,62 @@ bool
event_timed_identifier_equal(Event_timed *a, Event_timed *b)
{
return event_timed_name_equal(a, &b->name) &&
event_timed_db_equal(a, &b->dbname) &&
event_timed_definer_equal(a, &b->definer);
event_timed_db_equal(a, &b->dbname);
}
/*
Checks whether two events have the same name
SYNOPSIS
event_timed_name_equal()
RETURN VALUE
TRUE names are equal
FALSE names are not equal
*/
bool
event_timed_name_equal(sp_name *name, LEX_STRING *event_name)
{
return !sortcmp_lex_string(name->m_name, *event_name, system_charset_info);
}
/*
Checks whether two events are in the same schema
SYNOPSIS
event_timed_db_equal()
RETURN VALUE
TRUE schemas are equal
FALSE schemas are not equal
*/
bool
event_timed_db_equal(sp_name *name, LEX_STRING *db)
{
return !sortcmp_lex_string(name->m_db, *db, system_charset_info);
}
/*
Checks whether two events are equal by identifiers
SYNOPSIS
event_timed_identifier_equal()
RETURN VALUE
TRUE equal
FALSE not equal
*/
bool
event_timed_identifier_equal(sp_name *a, Event_timed *b)
{
return event_timed_name_equal(a, &b->name) &&
event_timed_db_equal(a, &b->dbname);
}