我的存储程序总体上是这样的:
BEGIN
DECLARE exit handler for sqlexception
BEGIN
SHOW ERRORS; # this shows a result set with the errors that occured
ROLLBACK; # this rollbacks all the magic i tried to to, making this whole stuff atomic, YAY!
insert into LogTest select 1,2; # this is just a test to make sure it would work
END;
START TRANSACTION;
# do some magic
COMMIT
END
现在,我需要做的是将Handler更改为类似的东西,显然是 半伪代码 :
DECLARE exit handler for sqlexception
BEGIN
ROLLBACK; # this rollbacks all the magic i tried to to, making this whole stuff atomic, YAY!
insert into LogTest # and this tells me what timey whimey hit the maelstorm
select now(),*,'some id', ... <some more stuff maybe?>
from (Show errors) as Errors
END;
任何一个经验/想法/知识?