Roger Perttu wrote:
Hi!I've been looking at the source but didn't find much.
When I destroy my objects I would like to know if there are uncommitted transactions. There shouldn't be any but I would like to know. Given only a DBI database handle, is it possible to find out if there are uncommitted transactions? If not, is there anything inside DBD-ODBC that I could use? I didn't find anything in the docs.
Thanks!
Roger P
From DBI.pm:
sub begin_work {
my $dbh = shift;
return $dbh->DBI::set_err(1, "Already in a transaction")
unless $dbh->FETCH('AutoCommit');
$dbh->STORE('AutoCommit', 0); # will croak if driver doesn't support it
$dbh->STORE('BegunWork', 1); # trigger post commit/rollback action
}
From the implementation of DBD-ODBC:
/* maybe bad way to add hint about invalid transaction
* state upon disconnect...
*/
if (what && !strcmp(sqlstate, "25000") && !strcmp(what, "db_disconnect/SQLDisconnect")) {
sv_catpv(errstr, " You need to commit before disconnecting! ");
}
I assume the functionality I'm looking for doesn't exist.
/Roger P