我的表都是innodb类型,而且已经set autocommit=0了,为什么还是没有变化;之后关闭客户端后再重新进入查询表内容却变成由于事务启动后改变的数据了,不是重启客户端就会还原的吗?

解决方案 »

  1.   

    trunks表:
    create table trunks (
        id smallint unsigned not null auto_increment,
        owner smallint unsigned not null references participants (id),
        name varchar(25) not null,
        price decimal(5 , 2 ) not null,
        description mediumtext not null,
        primary key (id)
    )  engine=innodb;participants表:
    create table trunks (
        id smallint unsigned not null auto_increment,
        name varchar(35) not null,
        email varchar(45) not null,
        cash decimal(5,2) not null,
        primary key (id)
    )  engine=innodb;事务过程:
    start transaction;update participants set cash=cash-12.99 where id=1;
    update participants set cash=cash+12.99 where id=2;
    update trunks set owner=1 where name='Abacus' and id=1;rollback;select * from participants;
    select * from trunks;
      

  2.   

    我明白了,原来我用mysql workbench这软件是有点不同的,还是用命令行才可以