line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package DBIx::DataModel::Schema::ResultAs::Count; |
3
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
4
|
1
|
|
|
1
|
|
752
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use parent 'DBIx::DataModel::Schema::ResultAs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub get_result { |
10
|
1
|
|
|
1
|
1
|
3
|
my ($self, $statement) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
5
|
$statement->refine(-columns => 'COUNT(*)|N_ROWS'); |
13
|
1
|
|
|
|
|
5
|
$statement->execute(); |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
4
|
my $count_row = $statement->_next_and_finish; |
16
|
1
|
|
|
|
|
16
|
return $count_row->{N_ROWS}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
DBIx::DataModel::Schema::ResultAs::Count - count rows |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Refines the statement with C<< -columns => 'COUNT(*) >> and returns the count |
29
|
|
|
|
|
|
|
of rows. |
30
|
|
|
|
|
|
|
|