diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-08-07 11:55:51 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-08-07 11:55:51 +0400 |
commit | 4cbadaeaea5b47a128b2ddf8ca487dbfd978227d (patch) | |
tree | 6fe881e9abd2d24a5c32ec347a93e84bab46bd1d /sql/event_data_objects.cc | |
parent | cb1945dd0dd244b0fb901c1b950b4ef856c1b725 (diff) | |
download | mariadb-git-4cbadaeaea5b47a128b2ddf8ca487dbfd978227d.tar.gz |
MDEV-16891 EVENTs created with SQL_MODE=ORACLE fail to execute
Diffstat (limited to 'sql/event_data_objects.cc')
-rw-r--r-- | sql/event_data_objects.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 28820f05aa3..86a710f87c6 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1284,7 +1284,11 @@ Event_job_data::construct_sp_sql(THD *thd, String *sp_sql) */ sp_sql->append(STRING_WITH_LEN("() SQL SECURITY INVOKER ")); + if (thd->variables.sql_mode & MODE_ORACLE) + sp_sql->append(STRING_WITH_LEN(" AS BEGIN ")); sp_sql->append(&body); + if (thd->variables.sql_mode & MODE_ORACLE) + sp_sql->append(STRING_WITH_LEN("; END")); DBUG_RETURN(thd->is_fatal_error); } @@ -1387,9 +1391,6 @@ Event_job_data::execute(THD *thd, bool drop) goto end; } - if (construct_sp_sql(thd, &sp_sql)) - goto end; - /* Set up global thread attributes to reflect the properties of this Event. We can simply reset these instead of usual @@ -1401,6 +1402,9 @@ Event_job_data::execute(THD *thd, bool drop) thd->variables.sql_mode= sql_mode; thd->variables.time_zone= time_zone; + if (construct_sp_sql(thd, &sp_sql)) + goto end; + thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length()); { |