From: Rafael Kitover Date: Mon, 22 Feb 2010 19:16:07 +0000 (+0000) Subject: with_deferred_fk_checks for Oracle X-Git-Tag: v0.08120~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6c0bb6a74539d2ba3cce7ef4068e7c14c84a9669;p=dbsrgits%2FDBIx-Class.git with_deferred_fk_checks for Oracle --- diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index a2b2f90..5973319 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -326,6 +326,25 @@ sub relname_to_table_alias { return $new_alias; } +=head2 with_deferred_fk_checks + +Runs a coderef between: + + alter session set constraints = deferred + ... + alter session set constraints = immediate + +to defer FK checks. + +=cut + +sub with_deferred_fk_checks { + my ($self, $sub) = @_; + $self->_do_query('alter session set constraints = deferred'); + $sub->(); + $self->_do_query('alter session set constraints = immediate'); +} + =head1 AUTHOR See L.