Branch Coverage

blib/lib/ActiveRecord/Simple/Find.pm
Criterion Covered Total %
branch 82 150 54.6


line true false branch
24 86 0 $self->{'class'}->can('_get_table_name') ? :
25 86 0 $self->{'class'}->can('_get_primary_key') ? :
27 0 86 unless $table_name
36 22 64 if (not ref $param[0] and scalar @param == 1) { }
33 31 elsif (not ref $param[0] and scalar @param == 0) { }
23 8 elsif (ref $param[0] and ref $param[0] eq 'HASH') { }
2 6 elsif (ref $param[0] and ref $param[0] eq 'ARRAY') { }
82 86 0 if $fields
83 86 0 if $from
84 53 33 if $where
91 8 0 ref $inv ? :
93 6 2 unless $self->{'prep_group_by'}
2 6 if (@{[] unless $self->{'prep_group_by'};}) { }
115 0 6 unless $self->{'class'}->can('_get_primary_key')
124 0 3 unless $self->{'class'}->can('_get_primary_key')
134 0 7 unless scalar @fields > 0
135 0 7 unless ref $self
137 7 0 if ($self->{'class'}->can('_get_primary_key'))
139 1 6 unless grep {$_ eq $pk;} @fields
143 6 1 $self->{'class'}->can('_get_mixins') ? :
148 1 9 if ($mixins and grep {$_ eq $fld;} keys %$mixins) { }
150 1 0 unless $mixin =~ /as\s+\w+$/i
197 0 12 if exists $self->{'prep_limit'}
208 0 3 if exists $self->{'prep_offset'}
219 0 78 if (ref $param eq 'HASH') { }
227 0 78 if $self->{'_objects'}
233 0 78 unless my $sth = $self->dbh->prepare($self->{'SQL'})
235 0 78 unless $sth->execute(@{$$self{'BIND'};})
236 29 49 if (wantarray) { }
245 0 80 if $limit and $i == $limit
252 0 49 unless my $object_data = $sth->fetchrow_hashref
276 2 5 unless defined $self->{'prep_offset'}
281 4 3 wantarray ? :
287 0 0 if exists $self->{'prep_left_joins'}
288 0 0 unless @rels
290 0 0 unless $self->{'class'}->can('_get_relations')
300 0 0 unless my $relation = $self->{'class'}->_get_relations->{$rel_name}
303 0 0 unless grep {$_ eq $relation->{'type'};} 'one', 'only'
309 0 0 if ref $_
313 0 0 if ($relation->{'type'} eq 'one')
333 0 0 wantarray ? :
355 0 14 unless $self_class->dbh and $class and $param
361 0 14 if ($param->{'m_class'}) { }
371 0 0 if ($opts->{'class'} eq $param->{'root_class'}) { }
0 0 elsif ($opts->{'class'} eq $class) { }
420 0 0 unless $self->{'_objects'} and ref $self->{'_objects'} eq 'ARRAY' and scalar @{$self->{'_objects'};} > 0
422 0 0 if (wantarray) { }
434 0 85 unless $self->{'SQL'} and $self->dbh
453 27 102 if ($self->{'has_joined_table'})
456 0 0 unless my $relation = $self->{'class'}->_get_relations->{$rel_name}
458 0 0 unless %pairs
472 0 129 if defined $read_only
481 0 85 unless ref $self->{'prep_select_fields'}
482 0 85 unless ref $self->{'prep_select_from'}
485 82 3 unless $self->{'prep_group_by'}
491 14 71 if (defined $self->{'prep_left_joins'})
496 0 85 unless $self->{'prep_select_where'}
58 27 if (@{[] unless $self->{'prep_select_where'};})
501 82 3 unless $self->{'prep_group_by'}
3 82 if (@{[] unless $self->{'prep_group_by'};})
506 64 21 unless $self->{'prep_order_by'}
21 64 if (@{[] unless $self->{'prep_order_by'};})
520 23 0 $self->{'class'}->can('_get_table_name') ? :
523 0 23 if (ref $param_hash->{$param_name} eq 'ARRAY' and not ref $param_hash->{$param_name}[0]) { }
2 21 elsif (ref $param_hash->{$param_name}) { }
529 0 2 unless $class->can('_get_relations')
530 0 2 unless my $relation = $class->_get_relations->{$param_name}
532 0 2 if $relation->{'type'} ne 'one'
536 0 2 if (ref $param_hash->{$param_name} eq 'ActiveRecord::Simple::Find') { }
546 0 0 if ref $object->{'BIND'} eq 'ARRAY'
551 0 2 if (ref $object eq 'ARRAY') { }
562 21 0 if (defined $param_hash->{$param_name}) { }
579 0 9 unless ref $self->{'prep_order_by'} eq 'ARRAY' and scalar @{$self->{'prep_order_by'};} > 0
582 0 9 if defined $self->{'prep_asc_desc'}
585 0 9 unless $direction =~ /^(ASC|DESC)$/i