我正在尝试以简化形式从事务中调用存储过程:
my $dbh= DBI->connect(............ );
my $sth = $dbh->prepare("call sp_get_workitems (1,1)");
$dbh->begin_work or die $dbh->errstr;
$sth->execute();
my ($result)= $sth->fetchrow_array();
$dbh->commit;
这给出了以下错误:
DBD driver has not implemented the AutoCommit attribute
如果我将 begin_work 语句替换为 $dbh->{'AutoCommit'} = 0;
(在准备之前或之后),我会收到以下错误:
DBD::mysql::db commit failed: Commands out of sync; you can't run this command now
如果我用一个简单的 select 语句替换存储过程调用,它一切正常。
存储过程包括许多更新,并以一个 select 语句结束。当然,如果我可以在过程中处理事务会更容易,如果发生回滚,我需要执行一些 perl 代码。
我在 Windows 7 上使用 ActivePerl 和一个运行 Centos 并安装了 DBI 1.616 的亚马逊云实例,这两种情况都会发生。
这应该工作还是有办法解决它?
谢谢