mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
BUG#16425: Events: no DEFINER clause
There was already support for CREATE DEFINER=... EVENT syntax in the parser, but DEFINER information was ignored. This patch adds processing of DEFINER, and a new ALTER DEFINER=... EVENT syntax. mysql-test/r/events_bugs.result: Add result for bug#16425: Events: no DEFINER clause. mysql-test/t/events_bugs.test: Add test case for bug#16425: Events: no DEFINER clause. sql/event_data_objects.cc: Event_parse_data::init_definer() looks for DEFINER in thd->lex->definer, which is always set now. sql/sql_parse.cc: Move DEFINER processing into the sp_process_definer(). Call this function for CREATE EVENT/ALTER EVENT, as well as for CREATE PROCEDURE/FUNCTION. sql/sql_yacc.yy: Add 'alter DEFINER=... event', update rule references accordingly.
This commit is contained in:
@@ -611,16 +611,18 @@ Event_parse_data::check_parse_data(THD *thd)
|
||||
void
|
||||
Event_parse_data::init_definer(THD *thd)
|
||||
{
|
||||
int definer_user_len;
|
||||
int definer_host_len;
|
||||
DBUG_ENTER("Event_parse_data::init_definer");
|
||||
|
||||
DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx "
|
||||
"thd->sec_ctx->priv_user: 0x%lx", (long) thd->mem_root,
|
||||
(long) thd->security_ctx->priv_user));
|
||||
DBUG_ASSERT(thd->lex->definer);
|
||||
|
||||
definer_user_len= strlen(thd->security_ctx->priv_user);
|
||||
definer_host_len= strlen(thd->security_ctx->priv_host);
|
||||
const char *definer_user= thd->lex->definer->user.str;
|
||||
const char *definer_host= thd->lex->definer->host.str;
|
||||
int definer_user_len= thd->lex->definer->user.length;
|
||||
int definer_host_len= thd->lex->definer->host.length;
|
||||
|
||||
DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx "
|
||||
"definer_user: 0x%lx", (long) thd->mem_root,
|
||||
(long) definer_user));
|
||||
|
||||
/* + 1 for @ */
|
||||
DBUG_PRINT("info",("init definer as whole"));
|
||||
@@ -628,12 +630,11 @@ Event_parse_data::init_definer(THD *thd)
|
||||
definer.str= thd->alloc(definer.length + 1);
|
||||
|
||||
DBUG_PRINT("info",("copy the user"));
|
||||
memcpy(definer.str, thd->security_ctx->priv_user, definer_user_len);
|
||||
memcpy(definer.str, definer_user, definer_user_len);
|
||||
definer.str[definer_user_len]= '@';
|
||||
|
||||
DBUG_PRINT("info",("copy the host"));
|
||||
memcpy(definer.str + definer_user_len + 1, thd->security_ctx->priv_host,
|
||||
definer_host_len);
|
||||
memcpy(definer.str + definer_user_len + 1, definer_host, definer_host_len);
|
||||
definer.str[definer.length]= '\0';
|
||||
DBUG_PRINT("info",("definer [%s] initted", definer.str));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user