| 1354 | */ |
| 1355 | |
| 1356 | bool |
| 1357 | Event_job_data::execute(THD *thd, bool drop) |
| 1358 | { |
| 1359 | String sp_sql; |
| 1360 | #ifndef NO_EMBEDDED_ACCESS_CHECKS |
| 1361 | Security_context event_sctx, *save_sctx= NULL; |
| 1362 | #endif |
| 1363 | List<Item> empty_item_list; |
| 1364 | bool ret= TRUE; |
| 1365 | |
| 1366 | DBUG_ENTER("Event_job_data::execute"); |
| 1367 | |
| 1368 | thd->reset_for_next_command(); |
| 1369 | |
| 1370 | #ifdef WITH_WSREP |
| 1371 | wsrep_open(thd); |
| 1372 | wsrep_before_command(thd); |
| 1373 | #endif /* WITH_WSREP */ |
| 1374 | |
| 1375 | lex_start(thd); |
| 1376 | |
| 1377 | #ifndef NO_EMBEDDED_ACCESS_CHECKS |
| 1378 | if (event_sctx.change_security_context(thd, &definer_user, &definer_host, |
| 1379 | &dbname, &save_sctx) || |
| 1380 | mysql_change_db(thd, dbname, FALSE)) |
| 1381 | { |
| 1382 | sql_print_error("Event Scheduler: [%s].[%s.%s] execution failed, " |
| 1383 | "failed to authenticate the user.", |
| 1384 | definer.str, dbname.str, name.str); |
| 1385 | goto end; |
| 1386 | } |
| 1387 | #endif |
| 1388 | |
| 1389 | if (check_access(thd, EVENT_ACL, dbname.str, NULL, NULL, 0, 0)) |
| 1390 | { |
| 1391 | /* |
| 1392 | This aspect of behavior is defined in the worklog, |
| 1393 | and this is how triggers work too: if TRIGGER |
| 1394 | privilege is revoked from trigger definer, |
| 1395 | triggers are not executed. |
| 1396 | */ |
| 1397 | sql_print_error("Event Scheduler: [%s].[%s.%s] execution failed, " |
| 1398 | "user no longer has EVENT privilege.", |
| 1399 | definer.str, dbname.str, name.str); |
| 1400 | goto end; |
| 1401 | } |
| 1402 | |
| 1403 | /* |
| 1404 | Set up global thread attributes to reflect the properties of |
| 1405 | this Event. We can simply reset these instead of usual |
| 1406 | backup/restore employed in stored programs since we know that |
| 1407 | this is a top level statement and the worker thread is |
| 1408 | allocated exclusively to execute this event. |
| 1409 | */ |
| 1410 | |
| 1411 | thd->variables.sql_mode= sql_mode; |
| 1412 | thd->variables.time_zone= time_zone; |
| 1413 |
nothing calls this directly
no test coverage detected