Skip to content

Commit

Permalink
rollback on disconnect, and disconnect on DESTROY
Browse files Browse the repository at this point in the history
  • Loading branch information
blblack committed Feb 7, 2006
1 parent d54a54f commit 9292561
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/DBIx/Class/Storage/DBI.pm
Expand Up @@ -222,7 +222,11 @@ sub debugcb {
sub disconnect {
my ($self) = @_;

$self->_dbh->disconnect if $self->_dbh;
if( $self->connected ) {
$self->_dbh->rollback unless $self->_dbh->{AutoCommit};
$self->_dbh->disconnect;
$self->_dbh(undef);
}
}

sub connected {
Expand Down Expand Up @@ -420,6 +424,8 @@ sub columns_info_for {
return \%result;
}

sub DESTROY { shift->disconnect }

1;

=head1 ENVIRONMENT VARIABLES
Expand Down

0 comments on commit 9292561

Please sign in to comment.