lib/DBIx/ActiveRecord/Arel/Query/Count.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 88.2% 30 / 34 CC 4 SCAR 9.5
CC
4
Cov
89%
_to_sql
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.6
« lib/DBIx/ActiveRecord/Arel/Order.pm ↑ Summary lib/DBIx/ActiveRecord/Arel/Query.pm »
1 package DBIx::ActiveRecord::Arel::Query::Count;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base 'DBIx::ActiveRecord::Arel::Query';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
7 1 my ($self, $main) = @_;
8 1 my $o = $self->SUPER::new($main);
9 1 $o->merge($main->query);
10 1 $o;
11 }
12  
13 1 ▶sub _to_sql {
Subroutine _to_sql: called CC=4 SCAR=14.2
14 1 my ($self) = @_;
15  
16 1 ▶ my $table = $self->has_join ? $self->main_table_with_alias : $self->main->table;
Branch: 1 branch
BranchTrueFalseTotal
$self->has_join ? : 0 1 1
17 1 my $sql = 'SELECT COUNT(*) FROM '.$table;
18 1 my $join = $self->build_join;
19 1 ▶ $sql .= ' '.$join if $join;
Branch: 1 branch
BranchTrueFalseTotal
if $join 0 1 1
20 1 my $where = $self->build_where;
21 1 ▶ $sql .= " WHERE $where" if $where;
Branch: 1 branch
BranchTrueFalseTotal
if $where 1 0 1
22 1 $sql;
23 }
24  
25 2 1;
« lib/DBIx/ActiveRecord/Arel/Order.pm ↑ Summary lib/DBIx/ActiveRecord/Arel/Query.pm »