File Coverage

lib/DBIx/Skinny/Pager/Logic/MySQLFoundRows.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package DBIx::Skinny::Pager::Logic::MySQLFoundRows;
2 5     5   95233 use strict;
  5         11  
  5         167  
3 5     5   23 use warnings;
  5         10  
  5         167  
4 5     5   45 use base qw/DBIx::Skinny::Pager/;
  5         9  
  5         1401  
5 5     5   30 use Data::Page;
  5         9  
  5         110  
6              
7             sub as_sql {
8 5     5 0 1952 my $self = shift;
9 5         31 my $result = $self->SUPER::as_sql;
10             # TODO: 正規表現もいいかげんなのでもうちょいちゃんとやりたい
11             # as_sqlの中身をいじるのは本家への追従を考えると難しそう
12 5         946 $result =~ s/SELECT /SELECT SQL_CALC_FOUND_ROWS /; # mysql support only
13 5         22 $result;
14             }
15              
16             sub get_total_entries {
17 3     3 0 7 my $self = shift;
18 3         10 $self->skinny->search_by_sql(q{SELECT FOUND_ROWS() AS row})->first->row;
19             }
20              
21             1;
22             __END__