Branch Coverage

blib/lib/Elive/DAO.pm
Criterion Covered Total %
branch 34 306 11.1


line true false branch
48 0 0 if @args
51 0 0 if (Elive::Util::_reftype($raw) eq 'HASH')
65 0 0 exists $$aliases{$_} ? :
70 0 0 if (my $type = $$types{$prop}) { }
71 0 0 if (ref $value)
77 0 0 unless Elive::Util::inspect_type($type)->is_ref
102 0 218 if not defined $data and ref $class
105 0 218 unless $data and Elive::Util::_reftype($data)
108 0 218 unless my(@primary_key) = $class->primary_key
130 37 0 if (my $entity_name = shift())
139 0 37 if exists $$entities{$entity_name}
174 0 59 unless $entity_class and $from and not ref $from and $to and not ref $to
184 0 59 if $$aliases{$from}
187 0 59 if $entity_class->meta->get_attribute($from)
190 0 59 unless $entity_class->meta->get_attribute($to)
204 21 39 unless ($aliases)
236 27 441 if @pkey
254 9 0 if keys %params
269 1 0 if keys %derivable
323 0 1221 unless $meta->get_attribute($_)
334 3 54 unless defined $v1 and defined $v2
341 36 18 if ($array_type or $type_info->is_struct) { }
0 18 elsif ($type =~ /^Ref|Any/xi) { }
358 14 4 if ($type =~ /^(Str|Enum|HiResDate)/xi) { }
0 4 elsif ($type =~ /^Bool/xi) { }
4 0 elsif ($type =~ /^Int/xi) { }
364 1 13 $opt{'case_insensitive'} ? :
370 0 0 $v1 eq 'true' ? :
0 0 $v2 eq 'true' ? :
381 0 54 if ($class->debug || 0) >= 5
489 0 1 if (my $connection = $class->connection)
523 0 0 unless my $path = $self->stringify
550 0 0 if $class->can('BUILDARGS')
552 0 0 unless Elive::Util::_reftype($data) eq 'HASH'
560 0 0 if @unknown
563 0 0 if 'Elive'->debug > 1
568 0 0 &Scalar::Util::blessed($data) ? :
572 0 0 unless my $connection = delete $opt{'connection'} || $class->connection
578 0 0 unless (defined $primary_key_data{$_})
583 0 0 if $opt{'copy'}
602 0 0 if ($type)
604 0 0 if (&Scalar::Util::blessed($struct) and $struct->can('_is_copy'))
609 0 0 if $opt{'copy'}
614 0 0 if ($type eq 'ARRAY') { }
0 0 elsif ($type eq 'HASH') { }
616 0 0 if ref $$struct[$_]
622 0 0 if ref $$struct{$_}
630 0 0 if (&Scalar::Util::blessed($struct))
631 0 0 if ($connection and $struct->can('connection'))
633 0 0 if (not $opt{'copy'} and $struct->can('url') and my $obj_url = $struct->url($connection))
640 0 0 if (my $cached = $Stored_Objects{$obj_url}) { }
645 0 0 if not $opt{'overwrite'} and $cached->is_changed
648 0 0 unless $cached->isa(ref $struct)
662 0 0 if ($struct->debug >= 5)
670 0 0 if ($struct->can('_db_data'))
674 0 0 if &Scalar::Util::blessed($data_copy) and $data_copy->can('_db_data')
695 0 0 if ref $class
708 0 0 unless ($property)
720 0 0 $is_array ? :
728 0 0 unless $opt{'canonical'}
755 0 0 if ($$aliases{$alias}{'freeze'})
756 0 0 unless my $to = $$aliases{$alias}{'to'}
761 0 0 if exists $$db_data{$to}
779 0 0 /^(.*)(Adapter|Response)$/ ? :
790 0 0 if (Elive::Util::_reftype($db_data) eq 'HASH')
796 0 0 if ($adapter)
802 0 0 if @unknown_entities
821 0 0 unless defined $entity_data
824 0 0 unless $ref_type eq 'HASH'
841 0 0 if @primary_key
845 0 0 unless my $to = $$aliases{$alias}{'to'}
868 0 0 unless $col and defined $data{$col}
874 0 0 if ($is_array)
878 0 0 unless ($val_type eq 'ARRAY')
884 0 0 if $class->debug
889 0 0 $is_array ? :
891 0 0 unless defined $_
893 0 0 $is_array ? :
895 0 0 if ($is_struct) { }
905 0 0 if ($is_array)
913 0 0 if (defined $val) { }
922 0 0 if ($class->debug)
957 0 0 if $class->debug >= 5
964 0 0 if $class->debug >= 5
968 0 0 if (exists $$updates{$_} and exists $$row{$_})
972 0 0 if ($write_val ne $read_val)
976 0 0 if $class->debug >= 2
1001 0 0 unless ($db_data)
1018 0 0 if Elive::Util::_tainted($new) or Elive::Util::_tainted($old)
1021 0 0 if (defined $new != defined $old or $self->_cmp_col($type, $new, $old))
1057 0 0 if $self->_deleted
1067 0 0 unless ($entity_column{$_})
1072 0 0 unless my $type = $self->property_types->{$_}
1075 0 0 if (exists $primary_key{$_})
1079 0 0 if (defined $old_val and not defined $data{$_}) { }
0 0 elsif ($self->_cmp_col($type, $old_val, $data{$_})) { }
1091 0 0 if (defined $value) { }
1093 0 0 if (ref $value)
1099 0 0 unless Elive::Util::inspect_type($type)->is_ref
1103 0 0 if Elive::Util::_tainted($value)
1110 0 0 if $attribute->is_required
1145 0 7 unless my $to = $$aliases{$alias}{'to'}
1174 0 0 unless my $connection = $opt{'connection'} || $class->connection
1178 0 0 unless delete $opt{'param'}
1195 0 0 wantarray ? :
1250 0 0 if $self->_deleted
1253 0 0 unless $opt{'param'}
1256 0 0 if ($_update_data)
1258 0 0 unless Elive::Util::_reftype($_update_data) eq 'HASH'
1269 0 0 unless exists $params{$_}
1272 0 0 if keys %update_data
1280 0 0 $opt{'changed'} ? :
1294 0 0 if (exists $primary_key{$_})
1297 0 0 if $self->_cmp_col($type, $db_val, $update_val)
1317 0 0 unless ($data and Elive::Util::_reftype($data) eq 'HASH')
1319 0 0 if $class->debug
1322 0 0 unless $data = $class->retrieve($self->stringify, 'raw', 1)
1333 0 0 unless ($obj->_refaddr eq $self->_refaddr)
1334 0 0 unless $self->_is_copy
1362 0 0 if (my $filter = delete $opt{'filter'})
1366 0 0 unless my $connection = $opt{'connection'} || $class->connection
1371 0 0 unless $collection_name
1394 0 0 unless Elive::Util::_reftype($db_query) eq 'HASH'
1397 0 0 unless my $connection = $opt{'connection'} || $class->connection
1402 0 0 if $class->debug
1414 0 0 if $opt{'raw'}
1419 0 0 unless @$rows
1441 0 0 if $vals and Elive::Util::_reftype($vals) ne 'ARRAY'
1448 0 0 unless defined $$vals[$n]
1452 0 0 unless my $connection = $opt{'connection'} || $class->connection
1455 0 0 if ($opt{'reuse'})
1467 0 0 if (my $cached = $class->live_entity($obj_url))
1468 0 0 unless $cached->isa($class)
1471 0 0 if $class->debug
1486 0 0 if scalar @$all > 1
1501 0 0 unless Elive::Util::_reftype($vals) eq 'ARRAY'
1513 0 0 if defined $val
1517 0 0 unless keys %fetch
1537 0 0 unless @primary_key > 0
1558 0 0 unless @$rows
1561 0 0 if @$rows > 1
1583 0 0 unless my $db_data = $self->_db_data
1586 0 0 unless @props
1591 0 0 if (exists $$db_data{$_}) { }
1613 0 0 if /^-?\d+$/
1626 112 106 unless ($subref)
1630 0 0 if ($aliases and $$aliases{$method} and my $alias_to = $$aliases{$method}{'to'})
1645 0 0 unless $class and $method
1648 0 0 if (my $subref = $class->can($method)) { }
1663 0 318 if ($self->debug || 0) >= 5
1666 0 318 if (my $db_data = $self->_db_data)
1667 0 0 if (not $REVERTING and my(@changed) = $self->is_changed and not $self->_deleted)
1674 0 0 if ($self->debug || 0) >= 6