myisam是不支持事务的
--
blog: http://chenxiaoyu.org



2011/4/25 Anthony WU <[email protected]>

>  高手!�D成InnoDB後�t�]有���}
>
>
> -------- Original Message  --------
> Subject: Re: [PerlChina] DBD::mysql 的 TRANSACTION ���}
> From: silent <[email protected]> <[email protected]>
> To: [email protected]
> Date: 25/4/2011 21:44
>
> myisam ?
>
> 在 2011年4月25日 下午9:33,Anthony WU <[email protected]>写 道:
>
>> ����有�]有前��使用�^ DBD::mysql 的 TRANSACTION 模式?
>> 我在�����r�l�F DBD::mysql 中的 TRANSACTION �a生不了��有的 rollback 功能。
>> 而且�y���^ AutoCommit、begin_work 的�{用中�]有�l生 $@ �S出 又或 $dbh->errstr ��息
>> 在不修改原有代�a而只修改 DSN 的 driver name 成 Pg,在同�拥� table �O��中 PostgreSQL Server
>> 下�t�]有���}
>> 以下是我所用的最���蔚��y��代�a:
>>
>> #!/usr/bin/perl
>> #perl v5.12.3
>> use DBI;
>> use DBI::DBD;
>>
>> #my $dbh=DBI->connect ('dbi:Pg:database=TEST;host=localhost', 'root' , '',
>> {AutoCommit => 1});
>> #printf ("DBD::Pg::VERSION: %s\n",  $DBD::Pg::VERSION);
>> #DBD::Pg::VERSION: 2.17.1
>> #mysql server 5.1.55-1
>>
>> my $dbh=DBI->connect ('dbi:mysql:database=TEST;host=localhost', 'root' ,
>> '', {AutoCommit => 1});
>> printf ("DBD::mysql::VERSION: %s\n",  $DBD::mysql::VERSION);
>> #DBD::mysql::VERSION: 4.017
>> #postgresql server 8.4.7-1
>> printf ("DBI::DBD::VERSION: %s\n",  $DBI::DBD::VERSION);
>>  #DBI::DBD::VERSION: 12.014120
>> printf ("DBI::VERSION: %s\n",  $DBI::VERSION);
>>            #DBI::VERSION: 1.613
>>
>> $dbh->begin_work ();
>> $sth = $dbh->prepare ("INSERT INTO messages (title, messages) VALUES(?,
>> ?);");
>> $sth->execute ("TITLE", "MESSAGES");
>> $dbh->rollback ();
>> #$dbh->commit ();
>> $dbh->disconnect ();
>> exit;
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复