Branch Coverage

blib/lib/ActiveRecord/Simple.pm
Criterion Covered Total %
branch 125 234 53.4


line true false branch
23 2 139 scalar @_ > 1 ? :
26 60 81 if $class->can('_get_relations')
38 0 10 unless $table_info_sth->fetchrow_hashref
50 10 0 $primary_key_data ? :
52 10 0 if $table_name
53 10 0 if $primary_key
54 10 0 if @columns
65 0 0 unless $error_message
68 6 0 unless exists $options->{'HandleError'}
70 6 0 if ($@) { }
128 10 7 if $params->{'via'}
177 0 22 if scalar @columns_list == 1 and ref $columns_list[0] eq 'ARRAY'
181 21 1 unless $class->can('_make_columns_accessors') and $class->_make_columns_accessors == 0
226 2 358 if ($dbh)
227 0 2 if ($connector) { }
248 0 11 unless $self->dbh
251 0 11 if exists $self->{'read_only'} and $self->{'read_only'} == 1
256 11 0 $self->can('_get_primary_key') ? :
260 3 36 if defined $pkey and $field eq $pkey and not $self->{$pkey}
261 0 36 if ref $field and ref $field eq 'HASH'
267 42 2 unless ref $self->{$field}
268 0 2 unless $self->can('_get_relations')
269 1 1 unless grep {$_ eq $field;} keys %{$self->_get_relations;}
271 0 1 unless my $relation = $self->_get_relations->{$field}
272 0 1 unless $relation->{'type'} and $relation->{'type'} eq 'one'
281 5 6 if ($self->{'isin_database'}) { }
287 11 0 if $result
288 11 0 if $result
290 11 0 defined $result ? :
299 0 0 unless exists $params->{$field}
300 0 0 unless $params->{$field}
313 0 1 unless $self->dbh
319 0 1 unless $self->{$pkey}
324 0 0 if $param and $param->{'cascade'}
329 1 0 if ($self->dbh->do($sql, undef, $self->{$pkey}))
352 2 1 if $self->can('_get_mixins')
356 0 15 if ref $field
357 7 8 if ($param and $param->{'only_defined_fields'}) { }
358 3 4 if defined $self->{$field}
373 0 0 unless exists $self->{$field}
385 0 0 unless exists $self->{$field}
422 0 0 if (ref $first_arg) { }
427 0 0 if ($class eq 'ActiveRecord::Simple::Find') { }
438 0 0 defined $class->find(@search_criteria)->fetch ? :
452 0 0 unless &blessed($self)
477 7 15 if $class ne _get_related_class($rel_opts)
481 0 15 unless $rel_type
491 16 0 unless ref $relation->{'class'}
494 0 0 if (ref $relation->{'class'} eq 'HASH') { }
0 0 elsif (ref $relation->{'class'} eq 'ARRAY') { }
507 52 0 unless ref $relation->{'class'}
510 0 0 if (ref $relation->{'class'} eq 'HASH') { }
0 0 elsif (ref $relation->{'class'} eq 'ARRAY') { }
523 0 6 unless $self->dbh and $param
528 0 0 $self->can('_get_secondary_key') ? :
6 0 $self->can('_get_primary_key') ? :
535 0 15 if (ref $param->{$_} eq 'SCALAR') { }
550 0 6 if ($self->dbh->{'Driver'}{'Name'} eq 'Pg') { }
551 0 0 if ($primary_key) { }
552 0 0 if $primary_key
571 3 3 if ($primary_key and defined $self->{$primary_key}) { }
578 0 3 exists $sth->{'mysql_insertid'} ? :
582 6 0 if (defined $primary_key and $self->can($primary_key) and $pkey_val)
594 0 5 unless $self->dbh and $param
599 0 0 $self->can('_get_secondary_key') ? :
5 0 $self->can('_get_primary_key') ? :
604 0 21 if (ref $param->{$_} eq 'SCALAR') { }
630 0 21 unless $fields
631 0 21 if $class->can('_make_columns_accessors') and $class->_make_columns_accessors == 0
640 0 4 unless $fields
641 0 4 if $class->can('_make_columns_accessors') and $class->_make_columns_accessors == 0
653 0 84 if $class->can($method_name)
655 78 6 if ($type eq 'rw') { }
6 0 elsif ($type eq 'ro') { }
664 25 0 if $code_string
1 2 if (@_ > 1)
1 17 if (@_ > 1)
2 18 if (@_ > 1)
1 11 if (@_ > 1)
1 8 if @_ > 1
0 3 if (@_ > 1)
0 2 if (@_ > 1)
666 0 25 if $@
673 22 22 if $what_key eq 'primary_key'
683 22 0 if $what_key eq 'foreign_key'
685 22 0 $what_key eq 'foreign_key' ? :
691 0 0 if $_ =~ /$rx/
697 6 16 if ($class->can('_get_relations')) { }
712 6 84 if $class->can($method_name)
726 66 15 if $class->can($pkg_method_name)
738 4 11 if (grep {$full_relation_type eq $_;} 'one_to_many', 'one_to_one', 'one_to_only') { }
0 11 elsif ($full_relation_type eq 'only_to_one') { }
4 7 elsif ($full_relation_type eq 'many_to_one') { }
7 0 elsif ($full_relation_type eq 'many_to_many') { }
0 0 elsif ($full_relation_type eq 'generic_to_generic') { }
741 1 7 if (@args)
743 0 1 unless &blessed($object)
746 0 1 if not exists $object->{'isin_database'} and !$object->{'isin_database'} == 1
755 4 3 unless ($self->{$instance_name})
766 0 0 unless ($self->{$instance_name})
777 1 4 if (@args)
778 0 1 unless (all_blessed(\@args))
784 0 1 unless &blessed($object)
795 0 4 unless $self->can('_get_primary_key')
797 4 0 unless ($self->{$instance_name})
808 8 8 if (@args)
812 6 2 unless (all_blessed(\@args))
823 0 2 if (defined $related_subclass) { }
831 0 0 unless _get_related_subclass($related_class_relation) and $related_subclass eq _get_related_subclass($related_class_relation)
840 0 0 unless defined $pk1
844 0 0 unless &blessed($object)
865 0 2 unless &blessed($object)
879 8 0 unless ($self->{$instance_name})
895 0 0 unless ($self->{$instance_name})
912 12 22 ref $_[0] ? :
914 0 34 if $class =~ /^ActiveRecord::Simple/
916 33 1 $class->can('_get_table_name') ? :