表用 innodb/bdb 就能支持事务了,大概是从3.23开始的!for example:begin;
insert into a ...;
insert into b ...;
commit;
程序语言一般是
set conn.autoCommit=0;
// 执行你的sql
conn.commit();
set aconn.utoCommit=1;
insert into a ...;
insert into b ...;
commit;
程序语言一般是
set conn.autoCommit=0;
// 执行你的sql
conn.commit();
set aconn.utoCommit=1;
例:
CREATE TABLE usergroup (
id bigint NOT NULL auto_increment,
UserName varchar(64) NOT NULL default '',
GroupName varchar(64) NOT NULL default '',
PRIMARY KEY (id),
KEY UserName (UserName(32))
) TYPE=InnoDB; //支持事务然后按loveflea(coolwind)说的...