From: Peter Rabbitson Date: Sun, 15 Feb 2015 10:29:46 +0000 (+0100) Subject: Revert 2131aa2, cf52a9a and 2aa3f4c X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab7c6418e3ea4fde7d58df897b5609fa41829161;p=dbsrgits%2FDBIx-Class-Historic.git Revert 2131aa2, cf52a9a and 2aa3f4c The warning will be fixed by roper integration with the blockrunner in further commits --- diff --git a/Changes b/Changes index 6015192..23d56c6 100644 --- 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) diff --git a/lib/DBIx/Class/Storage/DBI/Informix.pm b/lib/DBIx/Class/Storage/DBI/Informix.pm index cab66da..e8c123d 100644 --- a/lib/DBIx/Class/Storage/DBI/Informix.pm +++ b/lib/DBIx/Class/Storage/DBI/Informix.pm @@ -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 diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index dacfdb6..7c20330 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -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 diff --git a/t/72pg.t b/t/72pg.t index e93b67d..1e7ed0a 100644 --- 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';