MySQL Forums
Forum List  »  InnoDB

Re: transaction not work for trigger table
Posted by: kilin wang
Date: July 01, 2008 04:30AM

Hi William,

thanks for your reply.

But, my triggered table is of Heap(memory) table.
if i change your sql into:

CREATE TABLE `t1` (
`id` int(11) default NULL,
`fecha` datetime default NULL
) ENGINE=InnoDB;

CREATE TABLE `t2` (
`id` int(11) default NULL,
`fecha` datetime default NULL
) ENGINE=Heap;

DELIMITER $$

CREATE TRIGGER `trgaitestt1` AFTER INSERT ON `t1`
FOR EACH ROW
BEGIN
INSERT INTO t2 VALUES (NEW.id, NEW.fecha);
END$$

DELIMITER ;

START TRANSACTION;
INSERT INTO t1 VALUES (1, NOW()), (2, NOW()), (3, NOW()), (4, NOW());
ROLLBACK;

SELECT * FROM t1;
SELECT * FROM t2;


you will see that t2 has 4 rows, but t1 has none.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: transaction not work for trigger table
2665
July 01, 2008 04:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.