blib/lib/DB/Introspector/Base/ForeignKey.pm

filter: Statementstmt 31.1% 19 / 61 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 31.5% 6 / 19 Podpod 38.4% 5 / 13 totaltotal 28.3% 30 / 106 CC 8 SCAR 16.1
CC
8
Cov
26%
local_column_index
12.0
foreign_column_index
12.0
local_for_foreign_column
6.0
CRAP 5.0
« blib/lib/DB/Introspector/Postgres/Introspector.pm ↑ Summary blib/lib/DB/Introspector/SQLGen/Oracle/TypeMapper.pm »
1 package DB::Introspector::Base::ForeignKey;
2  
3 1 ▶use base qw( DB::Introspector::Base::Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use constant DELETE_RULE_NO_ACTION => 'NO ACTION';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use constant DELETE_RULE_CASCADE => 'CASCADE';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use constant DELETE_RULE_SET_NULL => 'SET NULL';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use constant DELETE_RULE_SET_DEFAULT => 'SET DEFAULT';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub name { return ""; }
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
13  
14 0 ▶sub local_for_foreign_column {
Subroutine local_for_foreign_column: not called CC=2 SCAR=17.9
Pod undocumented
15 0 my $self = shift;
16 0 my $foreign_column_name = shift;
17  
18 0 my $index = $self->foreign_column_index($foreign_column_name);
19 0 ▶ return undef unless defined($index);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $index 0 0 0
20  
21 0 my @local_columns = $self->local_column_names;
22 0 return $local_columns[$index];
23 }
24  
25 0 ▶sub foreign_for_local_column {
Subroutine foreign_for_local_column: not called CC=2 SCAR=17.9
Pod undocumented
26 0 my $self = shift;
27 0 my $local_column_name = shift;
28  
29 0 my $index = $self->local_column_index($local_column_name);
30 0 ▶ return undef unless defined($index);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $index 0 0 0
31  
32 0 my @foreign_columns = $self->foreign_column_names;
33 0 return $foreign_columns[$index];
34 }
35  
36 0 ▶sub local_column_index {
Subroutine local_column_index: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my $self = shift;
38 0 my $local_column_name = shift;
39  
40 0 my @local_columns = $self->local_column_names;
41  
42 0 foreach my $index (0..$#local_columns) {
43 0 ▶ return $index if($local_columns[$index] eq $local_column_name);
Branch: 1 branch
BranchTrueFalseTotal
if $local_columns[$index] eq $local_column_name 0 0 0
44 }
45  
46 0 return undef;
47 }
48  
49 0 ▶sub foreign_column_index {
Subroutine foreign_column_index: not called CC=3 SCAR=24.8
Pod undocumented
50 0 my $self = shift;
51 0 my $foreign_column_name = shift;
52  
53 0 my @foreign_columns = $self->foreign_column_names;
54  
55 0 foreach my $index (0..$#foreign_columns) {
56 0 ▶ return $index if($foreign_columns[$index] eq $foreign_column_name);
Branch: 1 branch
BranchTrueFalseTotal
if $foreign_columns[$index] eq $foreign_column_name 0 0 0
57 }
58  
59 0 return undef;
60 }
61  
62 0 ▶sub foreign_table {
Subroutine foreign_table: not called CC=1 SCAR=6.9
Pod documented
63 0 my $self = shift;
64 0 die("foreign_table not defined for ".ref($self));
65 }
66  
67 0 ▶sub foreign_column_names {
Subroutine foreign_column_names: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 die("foreign_column_names not defined for ".ref($self));
70 }
71  
72 0 ▶sub local_column_names {
Subroutine local_column_names: not called CC=1 SCAR=6.9
Pod documented
73 0 my $self = shift;
74 0 die("local_column_names not defined for ".ref($self));
75 }
76  
77 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
78 0 my $class = shift;
79 0 my $local_table = shift;
80 0 my $dependency = shift;
81  
82 0 ▶ my $self = bless(
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
83 { _local_table => $local_table, _is_dependency => $dependency },
84 ref($class) || $class);
85  
86  
87 0 return $self;
88 }
89  
90 0 ▶sub is_dependency {
Subroutine is_dependency: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my $self = shift;
92 0 return $self->{_is_dependency};
93 }
94  
95 0 ▶sub enabled { 1; }
Subroutine enabled: not called CC=1 SCAR=6.9
Pod undocumented
96  
97 0 ▶sub delete_rule { return DELETE_RULE_NO_ACTION; };
Subroutine delete_rule: not called CC=1 SCAR=6.9
Pod undocumented
98  
99  
100  
101 0 ▶sub local_table {
Subroutine local_table: not called CC=1 SCAR=6.9
Pod documented
102 0 my $self = shift;
103 0 return $self->{_local_table};
104 }
105  
106  
107 1 1;
108 __END__
« blib/lib/DB/Introspector/Postgres/Introspector.pm ↑ Summary blib/lib/DB/Introspector/SQLGen/Oracle/TypeMapper.pm »