| 1 | package DBIx::Skinny::Pager::Logic::Count; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use base qw/DBIx::Skinny::Pager/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Data::Page; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use DBIx::Skinny::SQL; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub get_total_entries { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_total_entries: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | my ($self, $iter) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my %hash = %{ $self }; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | for my $col ( qw( limit offset page select order ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | delete $hash{$col}; | |||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my $rs = DBIx::Skinny::SQL->new(\%hash); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | $rs->add_select("COUNT(*)" => 'cnt'); | |||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my $new_iter = $rs->retrieve; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if ( $rs->group && ( ref $rs->group eq 'ARRAY' && @{ $rs->group } ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rs->group and (ref $rs->group eq "ARRAY" and @{$rs->group;})
ref $rs->group eq "ARRAY" and @{$rs->group;}
MC/DC0%0/3
$rs->group and (ref $rs->group eq "ARRAY" and @{$rs->group;})
$rs->group
ref $rs->group eq "ARRAY"
@{$rs->group;}
Truth table0%0/4
A and B and C
A= $rs->groupB= ref $rs->group eq "ARRAY"C= @{$rs->group;}
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | # are there better way? | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | return $new_iter->count; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | return $new_iter->first->cnt; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 26 | __END__ | ||||||||||||||||||||||||||||||||||||||||||