Helper/ResultSet/AutoRemoveColumns.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 6 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 89.8% 44 / 49 CC 6 SCAR 9.0
CC
6
Cov
95%
_should_column_fetch
4.0
_resolved_attrs
2.0
fetchable_columns
2.0
CRAP 2.5
« Helper/Row/NumifyGet.pm ↑ Summary Helper/ResultSet/Shortcut/Search/Base.pm »
1 package DBIx::Class::Helper::ResultSet::AutoRemoveColumns;
2 56 $DBIx::Class::Helper::ResultSet::AutoRemoveColumns::VERSION = '2.037000';
3 # ABSTRACT: Automatically remove columns from a ResultSet
4  
5 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 56 ▶use parent 'DBIx::Class::Helper::ResultSet::RemoveColumns', 'DBIx::Class::ResultSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 56 __PACKAGE__->mk_group_accessors(inherited => '_fetchable_columns');
11  
12 56 my %dont_fetch = (
13 text => 1,
14 ntext => 1,
15 blob => 1,
16 clob => 1,
17 bytea => 1,
18 );
19  
20 228 ▶sub _should_column_fetch {
Subroutine _should_column_fetch: called CC=4 SCAR=13.9
21 228 my ( $self, $column ) = @_;
22  
23 228 my $info = $self->result_source->column_info($column);
24  
25 228 ▶ if (!defined $info->{remove_column}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $info->{"remove_column"}) 132 96 228
26 132 ▶ if (defined $info->{data_type} &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{'data_type'} and $dont_fetch{lc $info->{'data_type'}}) { } 88 44 132
Condition66%2/3
defined $info->{"data_type"} and $dont_fetch{lc $info->{"data_type"}}
!ll&&!rl&&r
04488
MC/DC50%1/2
defined $info->{"data_type"} and $dont_fetch{lc $info->{"data_type"}}
defined $info->{"data_type"} $dont_fetch{lc $info->{"data_type"}}
Truth table66%2/3
A and B
A= defined $info->{"data_type"}B= $dont_fetch{lc $info->{"data_type"}}
ABresult
0X0
100
111
27 $dont_fetch{lc $info->{data_type}}
28 ) {
29 88 $info->{remove_column} = 1;
30 } else {
31 44 $info->{remove_column} = 0;
32 }
33 }
34  
35 228 return $info->{remove_column};
36 }
37  
38 111 ▶sub fetchable_columns {
Subroutine fetchable_columns: called CC=2 SCAR=6.9
Pod documented
39 111 my $self = shift;
40 111 ▶ if (!$self->_fetchable_columns) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_fetchable_columns) 57 54 111
41 57 $self->_fetchable_columns([
42 grep $self->_should_column_fetch($_),
43 $self->result_source->columns
44 ]);
45 }
46 111 return $self->_fetchable_columns;
47 }
48  
49 115 ▶sub _resolved_attrs {
Subroutine _resolved_attrs: called CC=2 SCAR=7.1
50 local $_[0]->{attrs}{remove_columns} =
51 115 ▶ $_[0]->{attrs}{remove_columns} || $_[0]->fetchable_columns;
Condition66%2/3
$_[0]{'attrs'}{'remove_columns'} || $_[0]->fetchable_columns
l!l&&r!l&&!r
41110
MC/DC0%0/2
$_[0]{'attrs'}{'remove_columns'} || $_[0]->fetchable_columns
$_[0]{'attrs'}{'remove_columns'} $_[0]->fetchable_columns
Truth table66%2/3
A || B
A= $_[0]{'attrs'}{'remove_columns'}B= $_[0]->fetchable_columns
ABresult
1X1
011
000
52  
53 115 return $_[0]->next::method;
54 }
55  
56 56 1;
57  
58 __END__
« Helper/Row/NumifyGet.pm ↑ Summary Helper/ResultSet/Shortcut/Search/Base.pm »