sql - How to tell if a mySql event succeeded or not? -
i have around 5 mysql events autorun 15 minutes after each done.
they update table sum() of votes, starting @ 00:00.
is there way tell if event failed? if failed other events need not run. failed mean internally (sql gone wild) or didn't execute @ all.
one way thought of doing this, have event called stored procedure or function on success, in turn call others. possible?
you may try use exit handler:
drop event if exists `mydb`.`myevent`; create event if not exists `mydb`.`myevent` on schedule every 15 minute comment 'some comment' begin declare exit handler sqlexception, sqlwarning begin -- 1. flag something, should tested in chained events -- if should skipped. i.e.: -- insert `mydb`.`eventtable` (`event`, `failed`, `when`) -- values ('myevent', true, now()); -- or -- update -- `mydb`.`eventtable` -- set -- `failed` = true, -- `when` = now() -- -- `event` = 'myevent'; -- 2. quit. end; -- something, may produce sqlexception or sqlwarning... end;
Comments
Post a Comment