Oracle/Storage/FKDeferral.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 1 totaltotal 58.6% 17 / 29 CC 1 SCAR 3.6
CC
1
Cov
62%
with_deferred_fk_checks
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.4
« Oracle/Storage/Savepoints.pm ↑ Summary Oracle.pm »
1 package DBIO::Oracle::Storage::FKDeferral;
2 # ABSTRACT: FK constraint deferral for Oracle
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Scope::Guard ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Context::Preserve 'preserve_context';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11  
12 0 ▶sub with_deferred_fk_checks {
Subroutine with_deferred_fk_checks: not called CC=1 SCAR=6.9
Pod undocumented
13 0 my ($self, $sub) = @_;
14  
15 0 my $txn_scope_guard = $self->txn_scope_guard;
16  
17 0 $self->_do_query('alter session set constraints = deferred');
18  
19 0 ▶ my $sg = Scope::Guard->new(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 0 $self->_do_query('alter session set constraints = immediate');
21 0 });
22  
23 0 ▶ return preserve_context { $sub->() } after => sub { $txn_scope_guard->commit };
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 }
25  
26 1 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 DBIO::Oracle::Storage::FKDeferral - FK constraint deferral for Oracle
37  
38 =head1 VERSION
39  
40 version 0.900001
41  
42 =head1 DESCRIPTION
43  
44 Runs a coderef between C<ALTER SESSION SET CONSTRAINTS = DEFERRED> and
45 C<ALTER SESSION SET CONSTRAINTS = IMMEDIATE> to defer foreign key checks.
46 Constraints must be declared C<DEFERRABLE> for this to work.
47  
48 =head1 AUTHOR
49  
50 DBIO & DBIx::Class Authors
51  
52 =head1 COPYRIGHT AND LICENSE
53  
54 Copyright (C) 2026 DBIO Authors
55 Portions Copyright (C) 2005-2025 DBIx::Class Authors
56 Based on DBIx::Class, heavily modified.
57  
58 This is free software; you can redistribute it and/or modify it under
59 the same terms as the Perl 5 programming language system itself.
60  
61 =cut
« Oracle/Storage/Savepoints.pm ↑ Summary Oracle.pm »