mysql一个超级简单的事务

来源:互联网 发布:网络安全法手抄报内容 编辑:程序博客网 时间:2024/06/06 08:47

mysql的事务,只针对特定类型的表。

比如你写:create table `t`(id int auto_increment not null, primary key(id)) ;

执行回滚,是不操作的。

比如你再写:create table `t`(id int auto_increment not null, primary key(id)) type=INNODB;

某些版本这个表是建立不起来的,我的就建立不起来。

我的写法是:create table `t`(id int auto_increment not null, primary key(id)) engine=INNODB;

然后,先执行begin;

再执行insert into t values ();

再执行rollback;

什么都没有哦。

再执行insert into t values();

id从2开始了。


0 0
原创粉丝点击