backport the DBIx::Class::Storage::DBI::DESTROY fix for peopel sharing $dbh to other...
Brandon L. Black [Wed, 9 Aug 2006 17:05:33 +0000 (17:05 +0000)]
lib/DBIx/Class/Storage/DBI.pm

index 4158781..59f0357 100644 (file)
@@ -1092,7 +1092,17 @@ sub build_datetime_parser {
   return $type;
 }
 
-sub DESTROY { shift->disconnect }
+sub DESTROY {
+  # NOTE: if there's a merge conflict here when -current is pushed
+  #  back to trunk, take -current's version and ignore this trunk one :)
+  my $self = shift;
+
+  if($self->_dbh && $self->_conn_pid != $$) {
+    $self->_dbh->{InactiveDestroy} = 1;
+  }
+
+  $self->_dbh(undef);
+}
 
 1;