I am trying to make a call to a stored procedure from with in a transaction in its simplified form:
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;
this gives the following error :
DBD driver has not implemented the AutoCommit attribute
If I replace the begin_work statement with $dbh->{'AutoCommit'} = 0;
(before or after the prepare), I get this error:
DBD::mysql::db commit failed: Commands out of sync; you can't run this command now
If I replace the stored procedure call with a simple select statement it all works fine.
The stored procedure includes a number of updates and finishes with a select statement. Of course it would be easier if I could handle the transaction within the procedure put I need to action some perl code if rollback occurs.
I'm using ActivePerl on windows 7 and an amazon cloud instance running Centos with DBI 1.616 installed, this occurs on both.
Should this work or is there a way around it?
Thanks