X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FOracle%2FGeneric.pm;h=66bfc81556f10463bc2cf8da8b7ea86efa0d8650;hb=9334469ca4b326877bb2b6ea20cf087703e2094d;hp=695d4325748f915b8d0b7dcf5dacecfe63f1c961;hpb=2aa3f4c0bc1ce479776c96a1bc7bb44f7cfd1233;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 695d432..66bfc81 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -2,11 +2,9 @@ package DBIx::Class::Storage::DBI::Oracle::Generic; use strict; use warnings; -use base qw/DBIx::Class::Storage::DBI/; +use base qw/DBIx::Class::Storage::DBI::SetConstraintsDeferred/; use mro 'c3'; use DBIx::Class::Carp; -use Scope::Guard (); -use Context::Preserve 'preserve_context'; use Try::Tiny; use List::Util 'first'; use namespace::clean; @@ -650,35 +648,6 @@ sub relname_to_table_alias { return $self->sql_maker->_shorten_identifier($alias); } -=head2 with_deferred_fk_checks - -Runs a coderef between: - - alter session set constraints = deferred - ... - alter session set constraints = immediate - -to defer foreign key checks. - -Constraints must be declared C for this to work. - -=cut - -sub with_deferred_fk_checks { - my ($self, $sub) = @_; - - my $txn_scope_guard = $self->txn_scope_guard; - - $self->_do_query('alter session set constraints = deferred'); - - my $sg = Scope::Guard->new(sub { - $self->_do_query('alter session set constraints = immediate'); - }); - - return - preserve_context { $sub->() } after => sub { $txn_scope_guard->commit }; -} - =head1 ATTRIBUTES Following additional attributes can be used in resultsets.