From: Peter Rabbitson <ribasushi@cpan.org>
Date: Tue, 14 Sep 2010 22:15:46 +0000 (+0200)
Subject: No longer explicitly disconnect  on ::Storage DESTROY
X-Git-Tag: v0.08124~76
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a458e9e3a522099867e27e4c84cd94ca37e1355b;p=dbsrgits%2FDBIx-Class.git

No longer explicitly disconnect  on ::Storage DESTROY
---

diff --git a/Changes b/Changes
index 2195bab..aa53c2e 100644
--- a/Changes
+++ b/Changes
@@ -41,6 +41,8 @@ Revision history for DBIx::Class
           perl versions
         - Non-blessed reference exceptions are now correctly preserved
           when thrown from udner DBIC (e.g. from txn_do)
+        - No longer disconnecting database handles supplied to connect
+          via a coderef
 
     * Misc
         - Refactored capability handling in Storage::DBI, allows for
diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index 3848387..2cc0219 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -187,17 +187,8 @@ sub new {
 sub DESTROY {
   my $self = shift;
 
-  # destroy just the object if not native to this process/thread
-  $self->_preserve_foreign_dbh;
-
-  # some databases need this to stop spewing warnings
-  if (my $dbh = $self->_dbh) {
-    try {
-      %{ $dbh->{CachedKids} } = ();
-      $dbh->disconnect;
-    };
-  }
-
+  # some databases spew warnings on implicit disconnect
+  local $SIG{__WARN__} = sub {};
   $self->_dbh(undef);
 }
 
diff --git a/t/storage/error.t b/t/storage/error.t
index 66b901a..68bbb5a 100644
--- a/t/storage/error.t
+++ b/t/storage/error.t
@@ -36,12 +36,7 @@ throws_ok (
 # destruction of everything except the $dbh should use the proper
 # exception fallback:
 
-# FIXME
-# These explicit disconnections on loss of $storage don't seem
-# right... disable it here for the test anyway
 {
-  local $dbh->{Callbacks}{disconnect} = sub { 1 };
-
   undef ($schema);
   throws_ok (
     sub {