line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Skinny::Pager::Logic::Count; |
2
|
3
|
|
|
3
|
|
1966
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
113
|
|
3
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
90
|
|
4
|
3
|
|
|
3
|
|
17
|
use base qw/DBIx::Skinny::Pager/; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
1782
|
|
5
|
3
|
|
|
3
|
|
17
|
use Data::Page; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
33
|
|
6
|
3
|
|
|
3
|
|
78
|
use DBIx::Skinny::SQL; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
198
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub get_total_entries { |
9
|
0
|
|
|
0
|
0
|
|
my ($self, $iter) = @_; |
10
|
0
|
|
|
|
|
|
my %hash = %{ $self }; |
|
0
|
|
|
|
|
|
|
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
|
0
|
0
|
|
|
|
if ( $rs->group && ( ref $rs->group eq 'ARRAY' && @{ $rs->group } ) ) { |
|
0
|
|
0
|
|
|
|
|
18
|
|
|
|
|
|
|
# are there better way? |
19
|
0
|
|
|
|
|
|
return $new_iter->count; |
20
|
|
|
|
|
|
|
} else { |
21
|
0
|
|
|
|
|
|
return $new_iter->first->cnt; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |