File Coverage

blib/lib/DBIx/DataModel/Schema/ResultAs/Count.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1             #----------------------------------------------------------------------
2             package DBIx::DataModel::Schema::ResultAs::Count;
3             #----------------------------------------------------------------------
4 1     1   928 use warnings;
  1         2  
  1         116  
5 1     1   8 use strict;
  1         2  
  1         37  
6              
7 1     1   7 use parent 'DBIx::DataModel::Schema::ResultAs';
  1         2  
  1         8  
8              
9             sub get_result {
10 1     1 1 4 my ($self, $statement) = @_;
11              
12 1         5 $statement->refine(-columns => 'COUNT(*)|N_ROWS');
13 1         5 $statement->execute();
14              
15 1         5 my $count_row = $statement->_next_and_finish;
16 1         27 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