blib/lib/ObjectDB/Quoter.pm

filter: Statementstmt 34.1% 14 / 41 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 3 totaltotal 30.0% 18 / 60 CC 6 SCAR 25.7
CC
6
Cov
29%
quote
30.0
with
6.0
new
2.0
CRAP 13.1
« blib/lib/ObjectDB/Meta/Relationship/OneToMany.pm ↑ Summary blib/lib/ObjectDB/DBHPool.pm »
1 package ObjectDB::Quoter;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 our $VERSION = '3.26';
7  
8 5 ▶use base 'SQL::Composer::Quoter';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub new {
13 0 ▶ my $self = shift->SUPER::new(@_);
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my (%params) = @_;
15  
16 0 $self->{meta} = $params{meta};
17 0 $self->{with} = [];
18  
19 0 return $self;
20 }
21  
22 sub quote {
23 0 ▶ my $self = shift;
Subroutine quote: not called CC=5 SCAR=34.0
Pod undocumented
24 0 my ($column, $prefix) = @_;
25  
26 0 my @parts = split /[.]/xsm, $column;
27 0 $column = pop @parts;
28  
29 0 my $meta = $self->{meta};
30 0 my $rel_table;
31 my $name;
32 0 foreach my $part (@parts) {
33 0 my $relationship = $meta->get_relationship($part);
34  
35 0 ▶ $name = $name ? $name . '_' . $relationship->name : $relationship->name;
Branch: 1 branch
BranchTrueFalseTotal
$name ? : 0 0 0
36 0 $rel_table = $relationship->class->meta->table;
37 0 $meta = $relationship->class->meta;
38 }
39  
40 0 ▶ if ($rel_table) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rel_table) 0 0 0
41 0 $column = $name . q{.} . $column;
42  
43 0 my $with = join q{.}, @parts;
44 0 push @{ $self->{with} }, $with
45 0 ▶ unless first { $_ eq $with } @{ $self->{with} };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless &first(sub { $_ eq $with; } , @{$$self{"with"};}) 0 0 0
46 }
47  
48 0 return $self->SUPER::quote($column, $prefix);
49 }
50  
51 sub with {
52 0 ▶ my $self = shift;
Subroutine with: not called CC=2 SCAR=17.9
Pod undocumented
53  
54 0 ▶ return @{ $self->{with} || [] };
Branch: 1 branch
BranchTrueFalseTotal
$self->{"with"} or [] 0 0 0
55 }
56  
57 5 1;
« blib/lib/ObjectDB/Meta/Relationship/OneToMany.pm ↑ Summary blib/lib/ObjectDB/DBHPool.pm »