Revert 2131aa2, cf52a9a and 2aa3f4c
Peter Rabbitson [Sun, 15 Feb 2015 10:29:46 +0000 (11:29 +0100)]
The warning will be fixed by roper integration with the blockrunner in further
commits

Changes
lib/DBIx/Class/Storage/DBI/Informix.pm
lib/DBIx/Class/Storage/DBI/Pg.pm
t/72pg.t

diff --git a/Changes b/Changes
index 6015192..23d56c6 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,6 @@
 Revision history for DBIx::Class
 
     * Fixes
-        - Silence with_deferred_fk_checks() warning on PostgreSQL 9.4
         - Fix updating multiple CLOB/BLOB columns on Oracle
 
 0.082801 2014-10-05 23:55 (UTC)
index cab66da..e8c123d 100644 (file)
@@ -66,13 +66,11 @@ sub with_deferred_fk_checks {
 
   $self->_do_query('SET CONSTRAINTS ALL DEFERRED');
 
-  return preserve_context {
-    my $inner_self = $self; # avoid nested closure leak on 5.8
-    my $sg = Scope::Guard->new(sub {
-      $inner_self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
-    });
-    $sub->()
-  } after => sub { $txn_scope_guard->commit };
+  my $sg = Scope::Guard->new(sub {
+    $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
+  });
+
+  return preserve_context { $sub->() } after => sub { $txn_scope_guard->commit };
 }
 
 =head2 connect_call_datetime_setup
index dacfdb6..7c20330 100644 (file)
@@ -30,13 +30,11 @@ sub with_deferred_fk_checks {
 
   $self->_do_query('SET CONSTRAINTS ALL DEFERRED');
 
-  return preserve_context {
-    my $inner_self = $self; # avoid nested closure leak on 5.8
-    my $sg = Scope::Guard->new(sub {
-      $inner_self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
-    });
-    $sub->()
-  } after => sub { $txn_scope_guard->commit };
+  my $sg = Scope::Guard->new(sub {
+    $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
+  });
+
+  return preserve_context { $sub->() } after => sub { $txn_scope_guard->commit };
 }
 
 # only used when INSERT ... RETURNING is disabled
index e93b67d..1e7ed0a 100644 (file)
--- a/t/72pg.t
+++ b/t/72pg.t
@@ -2,7 +2,6 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Warn;
 use Test::Exception;
 use Sub::Name;
 use Config;
@@ -437,7 +436,7 @@ lives_ok { $cds->update({ year => '2010' }) } 'Update on prefetched rs';
 
   $schema->source('CD')->name('dbic_t_schema.cd');
   $schema->source('Track')->name('dbic_t_schema.track');
-  lives_and { warning_is {
+  lives_ok {
     $schema->storage->with_deferred_fk_checks(sub {
       $schema->resultset('Track')->create({
         trackid => 999, cd => 999, position => 1, title => 'deferred FK track'
@@ -446,7 +445,7 @@ lives_ok { $cds->update({ year => '2010' }) } 'Update on prefetched rs';
         artist => 1, cdid => 999, year => '2003', title => 'deferred FK cd'
       });
     });
-  } undef } 'with_deferred_fk_checks code survived';
+  } 'with_deferred_fk_checks code survived';
 
   is eval { $schema->resultset('Track')->find(999)->title }, 'deferred FK track',
      'code in with_deferred_fk_checks worked';