Branch Coverage

blib/lib/ActiveRecord/Simple/Find.pm
Criterion Covered Total %
branch 98 162 60.4


line true false branch
24 83 0 $self->{'class'}->can('_get_table_name') ? :
25 81 2 $self->{'class'}->can('_get_primary_key') ? :
33 15 68 if (not ref $param[0] and scalar @param == 1) { }
32 36 elsif (not ref $param[0] and scalar @param == 0) { }
26 10 elsif (ref $param[0] and ref $param[0] eq 'HASH') { }
3 7 elsif (ref $param[0] and ref $param[0] eq 'ARRAY') { }
79 83 0 if $fields
80 83 0 if $from
81 51 32 if $where
88 7 0 ref $inv ? :
90 5 2 unless $self->{'prep_group_by'}
2 5 if (@{[] unless $self->{'prep_group_by'};}) { }
110 26 0 $self->{'class'}->can('_get_table_name') ? :
113 0 28 if (ref $param_hash->{$param_name} eq 'ARRAY' and not ref $param_hash->{$param_name}[0]) { }
2 26 elsif (ref $param_hash->{$param_name}) { }
119 0 2 unless $class->can('_get_relations')
120 0 2 unless my $relation = $class->_get_relations->{$param_name}
122 0 2 if $relation->{'type'} ne 'one'
126 0 2 if (ref $param_hash->{$param_name} eq 'ActiveRecord::Simple::Find') { }
136 0 0 if ref $object->{'BIND'} eq 'ARRAY'
141 0 2 if (ref $object eq 'ARRAY') { }
152 26 0 if (defined $param_hash->{$param_name}) { }
170 0 6 unless $self->{'class'}->can('_get_primary_key')
179 0 3 unless $self->{'class'}->can('_get_primary_key')
189 0 8 unless scalar @fields > 0
190 0 8 unless ref $self
192 8 0 if ($self->{'class'}->can('_get_primary_key'))
194 1 7 unless grep {$_ eq $pk;} @fields
198 7 1 $self->{'class'}->can('_get_mixins') ? :
203 1 10 if ($mixins and grep {$_ eq $fld;} keys %$mixins) { }
205 1 0 unless $mixin =~ /as\s+\w+$/i
244 0 13 unless ref $self->{'prep_order_by'} eq 'ARRAY' and scalar @{$self->{'prep_order_by'};} > 0
247 0 13 if defined $self->{'prep_asc_desc'}
250 0 13 unless $direction =~ /^(ASC|DESC)$/i
271 0 14 if exists $self->{'prep_limit'}
282 0 5 if exists $self->{'prep_offset'}
292 2 5 if not ref $opts and ref $opts ne 'HASH'
295 4 5 if ($method eq 'order_by') { }
297 4 0 defined $param->{'direction'} ? :
298 4 0 if $order_direction
301 1 4 ref $param ? :
316 4 2 if defined $first_param
320 4 1 if (ref $param eq 'HASH') { }
339 0 82 unless ref $self->{'prep_select_fields'}
340 0 82 unless ref $self->{'prep_select_from'}
343 79 3 unless $self->{'prep_group_by'}
349 7 75 if (defined $self->{'prep_left_joins'})
354 0 82 unless $self->{'prep_select_where'}
52 30 if (@{[] unless $self->{'prep_select_where'};})
359 79 3 unless $self->{'prep_group_by'}
3 79 if (@{[] unless $self->{'prep_group_by'};})
364 58 24 unless $self->{'prep_order_by'}
24 58 if (@{[] unless $self->{'prep_order_by'};})
378 14 116 if ($self->{'has_joined_table'})
381 0 0 unless my $relation = $self->{'class'}->_get_relations->{$rel_name}
383 0 0 unless %pairs
397 0 130 if defined $read_only
398 1 129 if $obj->can('_smart_saving_used') and $obj->_smart_saving_used
408 0 76 if (ref $param eq 'HASH') { }
416 0 76 if $self->{'_objects'}
422 0 76 unless my $sth = $self->dbh->prepare($self->{'SQL'})
424 0 76 unless $sth->execute(@{$$self{'BIND'};})
425 29 47 if (wantarray) { }
434 0 83 if $limit and $i == $limit
441 0 47 unless my $object_data = $sth->fetchrow_hashref
465 2 5 unless defined $self->{'prep_offset'}
470 4 3 wantarray ? :
476 0 0 if exists $self->{'prep_left_joins'}
477 0 0 unless @rels
479 0 0 unless $self->{'class'}->can('_get_relations')
489 0 0 unless my $relation = $self->{'class'}->_get_relations->{$rel_name}
492 0 0 unless grep {$_ eq $relation->{'type'};} 'one', 'only'
498 0 0 if ref $_
502 0 0 if ($relation->{'type'} eq 'one')
522 0 0 wantarray ? :
544 0 7 unless $self_class->dbh and $class and $param
553 7 7 if ($opts->{'class'} eq $param->{'root_class'}) { }
7 0 elsif ($opts->{'class'} eq $class) { }
581 0 0 unless $self->{'_objects'} and ref $self->{'_objects'} eq 'ARRAY' and scalar @{$self->{'_objects'};} > 0
583 0 0 if (wantarray) { }
595 0 82 unless $self->{'SQL'} and $self->dbh