MySql可以在多个表上回滚SQL事务吗? [英] Can MySql rollback a sql transaction over multiple tables?

查看:545
本文介绍了MySql可以在多个表上回滚SQL事务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了MySql文档,却一无所获.我已经尝试过了...回滚似乎并不能取消在table1和table2中进行的插入

I have searched the MySql documentation and found nothing. I have tried this ... the Rollback doesn't seem to cancel the inserts made in table1 and table2

Start Transaction;

INSERT INTO Table1(field1,field2) VALUES (value1, value2);

INSERT INTO Table2(field3,field4) VALUES (value3, value4);

INSERT INTO Table3(field5,field6) VALUES (value5, value6);

Rollback;

更新:感谢您提供所有答案,但我忘了告诉我们第三条语句引发了异常(违反约束).

UPDATE: Thanks for all answers, but I forgot to tell that the 3rd statement throws an exception (Constraint Violation).

推荐答案

从MySql v5.1的当前版本开始...它不支持对多个表进行回滚...这可能会改变(我希望)在不久的将来未来!

As of current version of MySql v5.1 ... it does not support rollback over multiple tables ... That might change (I hope) in the near future!

这篇关于MySql可以在多个表上回滚SQL事务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆