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 {
return \%result;
}
+sub DESTROY { shift->disconnect }
+
1;
=head1 ENVIRONMENT VARIABLES