Branch Coverage

lib/DBIx/Oro.pm
Criterion Covered Total %
branch 316 510 61.9


line true false branch
102 0 0 unless (eval "require $module; 1;")
103 0 0 if croak(qq[Unable to load extension "$_"])
121 1 20 if (@_ == 1) { }
1 19 elsif (@_ == 2 and ref $_[1] and ref $_[1] eq 'CODE') { }
146 0 21 unless (eval 'require ' . $package . '; 1;')
158 0 21 unless $self
164 0 21 if $pwd
170 0 21 if ($on_connect)
171 0 0 ref $on_connect eq 'HASH' ? :
0 0 unless $self->on_connect(ref $on_connect eq 'HASH' ? %$on_connect : $on_connect)
178 0 21 unless $self->_connect
185 21 0 if $self->_init
199 3 23 if (ref $_[0]) { }
230 0 1264 if $_[0]
232 910 354 if ${$$self{'in_txn'};}
237 0 354 if (defined $$self{'tid'} and $$self{'tid'} != 'threads'->tid) { }
0 354 elsif ($$self{'pid'} != $$) { }
351 3 elsif ($$self{'dbh'}{'Active'}) { }
238 0 0 unless return $self->_connect
243 0 0 unless return $self->_connect
251 0 0 unless return $self->_connect
261 0 25 if ($last_sql =~ /(?:UNION|\?(?:, \?){3,}|(?:\(\?(?:, \?)*\), ){3,})/)
285 12 13 unless wantarray
288 1 12 unless $last_sql
316 0 0 unless my $table = _table_name($self, \@_)
319 0 0 unless $_[0]
322 0 0 if ref $_[0] eq 'HASH' and ref $_[1]
325 0 0 if (ref $_[0] eq 'HASH') { }
0 0 elsif (ref $_[0] eq 'ARRAY') { }
335 0 0 unless ref $key or $key =~ /$KEY_REGEX/
341 0 0 unless @keys
346 0 0 if ($prop and my $oc = $$prop{-'on_conflict'})
347 0 0 if ($oc eq 'replace') { }
0 0 elsif ($oc eq 'ignore') { }
365 0 0 unless $_[1]
378 0 0 unless ref $keys[$i]
413 0 22 unless my $table = _table_name($self, \@_)
416 0 22 unless $_[0]
422 0 22 unless @$pairs
426 1 22 unless $_ =~ /^$KEY_REGEX\s+(?:=|IS\s)/o
436 21 0 if ($_[0])
440 21 0 if (@$cond_pairs)
454 7 14 !$rv || $rv eq '0E0' ? :
472 28 82 if ($_[0] and ref $_[0] eq 'ARRAY')
475 0 28 if $$fields[0]
492 89 21 if ($_[0] and ref $_[0] eq 'HASH' or @$join_pairs)
496 89 0 if ($_[0] and ref $_[0] eq 'HASH')
502 79 10 if $$pairs[0]
506 79 10 if @pairs
509 54 35 if ($prep)
510 1 53 if delete $$prep{'distinct'}
521 0 110 if ($prep and $$prep{'cache'})
527 0 0 unless $key
534 1 109 if (scalar keys %$prep)
541 110 0 if (not $result) { }
547 1 109 unless $sth
557 2 107 if ($treatment)
565 0 0 if ($_[0] and ref $_[0] and ref $_[0] eq 'CODE')
572 0 0 $sth ? :
575 0 0 if $chi and $sth
581 0 0 if ($treatment)
594 0 0 if ($rv and $rv eq '-1')
601 0 0 if ($sth and $chi and $result)
606 0 0 if not $sth and $chi
614 109 0 unless ($result)
618 0 109 if ($chi and $result)
624 107 2 unless $treatment
632 2 0 if $$row{$_}
647 1 20 if ref $_[-1] and ref $_[-1] eq 'CODE'
650 21 0 if ref $_[-1] and ref $_[-1] eq 'HASH'
653 19 2 if $_[0]
663 0 21 if $$param{-'cache'}
670 21 0 if ($sort_by and $sort_by =~ s/^\s*($KEY_REGEX)\s*$/$1/)
673 12 9 index(lc $$param{'sortOrder'}, 'desc') == 0 ? :
676 12 9 $sort_order ? :
680 12 9 if $sort_order
688 2 19 if ($start_page > 1)
701 21 0 if ($filter_by)
705 21 0 if ($filter_op)
713 4 17 if ($filter_op eq 'present') { }
1 16 elsif ($filter_op eq 'absent') { }
730 16 0 if (my $fv = _check_param($param, 'filterValue')) { }
736 1 15 if ($filter_op eq 'equals') { }
1 14 elsif ($filter_op eq 'disparate') { }
754 1 13 if ($filter_op eq 'contains') { }
13 0 elsif ($filter_op eq 'startswith') { }
780 1 20 unless defined $total_results
784 5 15 if ($$param{'fields'})
787 1 4 if (ref $$param{'fields'}) { }
803 20 0 if ($total_results)
806 2 18 if (ref $$self{'table'} and @fields) { }
3 15 elsif (@fields) { }
817 36 0 if exists $$row{$_}
839 1 19 if ($cb and @$entry)
865 23 0 if ($param[-1] and ref $param[-1]) { }
868 18 5 if (ref $param[-1] eq 'HASH') { }
0 5 elsif (ref $param[-1] ne 'ARRAY') { }
888 0 23 unless $row
900 0 8 unless my $table = _table_name($self, \@_)
907 5 3 if ($_[0])
913 5 0 if @$pairs or $prep
916 0 5 if $prep
923 2 6 !$rv || $rv eq '0E0' ? :
932 0 7 unless my $table = _table_name($self, \@_)
935 7 0 $_[0] ? :
939 6 1 unless $$self{'table'}
949 3 4 if $rv
952 2 2 if ref $cond{$_}
958 4 0 unless $$self{'table'}
960 1 3 unless $rv = $self->insert(@param)
965 1 6 unless $self->txn(sub { $rv = $self->update(@param); return 1 if $rv; delete $cond{$_} foreach (grep {not blessed($cond{$_}) if ref $cond{$_};} keys %cond); @param = {%param, %cond}; unshift @param, $table unless $$self{'table'}; return -1 unless $rv = $self->insert(@param); $job = 'insert'; return; } )
968 6 0 if ($rv and $rv > 0)
969 6 0 wantarray ? :
992 1 38 if $_[0] and ref $_[0] eq 'ARRAY'
996 30 9 if ($_[0] and ref $_[0] eq 'HASH')
998 30 0 if $$pairs[0]
1002 30 9 if @pairs
1009 0 39 if ($prep and $$prep{'cache'})
1015 0 0 unless $key
1018 0 0 if ($result = $chi->get($key))
1032 3 36 unless $rv
1039 0 36 if $chi and $result
1055 0 1063 $cached ? :
1060 10 1053 if ($dbh->err)
1062 10 0 if (index($dbh->errstr, 'database') <= 0)
1070 0 0 $cached ? :
1074 0 0 if ($dbh->err)
1081 0 1053 unless $sth
1087 1 1052 if ($dbh->err)
1093 174 878 if wantarray
1113 0 113 if not $rv and $dbh->err
1129 0 61 unless $_[0] and ref $_[0] eq 'CODE'
1134 59 2 if ($$dbh{'AutoCommit'}) { }
1144 57 2 if (not $rv or $rv ne '-1')
1167 0 2 if $$self{'tid'}
1182 2 0 if ($last_sp eq $sp) { }
1192 1 1 if (not $rv or $rv ne '-1')
1210 0 3 unless ref $cb and ref $cb eq 'CODE'
1215 2 1 unless (exists $$self{'on_connect'}{$name})
1228 0 0 unless @_
1240 0 0 if ref $_[-1] and ref $_[-1] eq 'CODE'
1242 0 0 @_ > 1 ? :
1244 0 0 unless $files
1251 0 0 unless $file
1253 0 0 if (open SQL, '<:utf8', $file) { }
1266 0 0 if $cb and $sql
1268 0 0 unless $sql
1272 0 0 unless $self->do($_)
1287 0 0 if (ref $files)
1291 0 0 unless &$import($_)
1306 4 26 unless (exists $$self{'table'})
1309 0 4 unless $$self{'dbh'}
1315 4 0 if (blessed($$self{'dbh'}))
1318 0 4 if $kids
1342 0 24 unless $$self{'dsn'}
1357 0 24 unless $dbh
1366 0 24 if $INC{'threads.pm'}
1391 0 28 if index('DBIx::Oro', $this) != 0
1394 24 4 unless (defined $pwd_set)
1399 4 0 if (not $pwd_set) { }
1408 0 0 unless /::new$/o
1409 0 0 unless index($_, 'DBIx::Oro') == 0
1410 0 0 if $pwd{$id}
1424 875 18 if (not exists $$self{'table'}) { }
1425 875 0 unless ref $_[0][0]
1432 18 0 unless ref $$self{'table'}
1447 96 53 if (not exists $$self{'table'}) { }
1452 89 7 if (not ref $table) { }
1466 8 45 if (ref $$self{'table'}) { }
1495 2 18 if $table =~ s/^([^:]+?):([^:]+?)$/$1 $2/o
1501 2 18 $t_alias ? :
1503 20 0 if (my $ref = ref $join[0])
1509 16 4 if ($ref eq 'ARRAY') { }
1516 16 0 if (ref $join[0] and ref $join[0] eq 'HASH')
1520 1 15 if (exists $join[0]{-'prefix'})
1522 1 0 if $f_prefix eq '*'
1531 23 0 unless (ref $_)
1534 14 9 if (index($_, ':') == -1)
1539 22 1 if (index($_, '(') == -1) { }
1540 21 1 if index($_, '.') == -1
1566 15 1 if $fields
1575 20 0 if (ref $join[0] and ref $join[0] eq 'HASH')
1582 20 0 if (not $alias{$key}) { }
1583 20 0 if $key =~ /$KEY_REGEX_NOPREF/
1590 2 18 ref $value ? :
1605 1 10 $ind < 0 ? :
1622 127 49 @_ == 2 ? :
1627 0 276 unless ($key =~ /^-?$KEY_REGEX$/o)
1628 0 0 if carp("$key is not a valid Oro key")
1632 173 103 if (substr($key, 0, 1) ne '-') { }
1635 1 166 index($key, '.') >= 0 ? :
6 167 exists $$alias{$key} ? :
1638 89 84 if (not ref $value) { }
7 77 elsif (ref $value eq 'ARRAY') { }
73 4 elsif (ref $value eq 'HASH') { }
1 3 elsif (ref $value eq 'SCALAR') { }
3 0 elsif ($value = _stringify($value)) { }
1641 3 86 if (not defined $value) { }
1657 1 6 if (ref $$value[0] and ref $$value[0] eq 'SCALAR')
1672 75 0 if ($op =~ /$OP_REGEX/) { }
1682 24 51 if $_ =~ /^(?:[GL][TE]|NE|EQ)$/o
1687 3 72 if (ref $val and ref $val eq 'ARRAY') { }
1690 2 1 if (index($op, 'BETWEEN') >= 0) { }
1 0 elsif ($op =~ /^NOT( IN)?$/) { }
1710 0 72 if (blessed $val)
1711 0 0 unless $val = _stringify($val)
1716 64 8 if (defined $val) { }
1727 29 43 if ($op eq 'LIKE')
1739 0 0 if carp("Unknown Oro operator $key $op $val")
1758 0 0 $value ? :
0 0 if carp("Unknown Oro pair $key, " . ($value ? $value : '[undef]'))
1767 0 103 unless defined $value
1770 64 39 if ($key =~ /^-(?:limit|offset|distinct)$/) { }
35 4 elsif ($key =~ s/^-(order|group)(?:[-_]by)?$/$1/) { }
4 0 elsif ($key =~ /^-(or|and)$/) { }
0 0 elsif ($key eq '-cache') { }
1771 64 0 if $value =~ /^\d+$/o
1778 2 33 if ($key eq 'group' and ref $value)
1779 1 1 if (ref $$value[-1] and ref $$value[-1] eq 'HASH')
1782 0 1 unless (@$value)
1783 0 0 if carp('"Having" without "Group" is not allowed')
1791 3 32 ref $value ? :
1794 35 1 if ($_ =~ /$VALID_GROUPORDER_REGEX/) { }
1796 17 18 $1 && $1 eq '-' ? :
1805 34 1 if scalar @field_array
1817 4 4 unless (ref $array[0])
1830 2 6 if (@$or_pairs > 1) { }
1849 0 0 if ($chi) { }
1864 54 122 keys %prep ? :
1877 59 3 if (not ref $_) { }
3 0 elsif (ref $_ eq 'ARRAY') { }
1880 58 1 if ($_ =~ /$VALID_FIELD_REGEX/) { }
1894 0 3 if ref $sql
1896 2 1 if $inner_sub
1904 19 25 unless $fields =~ /[\.:=]/o
1912 33 6 if ($_ =~ /$FIELD_REST_RE/) { }
0 6 elsif (/^(?:.+?)\.(?:[^\.]+?)$/) { }
2 23 %treatment ? :
1945 3 51 if ($$prep{'group'})
1949 1 2 if ($$prep{'having'})
1957 1 0 if (@$cond_pairs)
1969 31 23 if (exists $$prep{'order'})
1974 41 13 if ($$prep{'limit'})
1979 21 20 if (defined $$prep{'offset'})
1991 20 3 unless my $ref = blessed($_[0])
1992 3 0 if (index($_ = "$_[0]", $ref) != 0)
2011 98 44 if ($_[0]{$_[1]} and not ref $_[0]{$_[1]})
2014 19 79 if ($_[2])
2015 19 0 $_[0]{$_[1]} =~ /$NUM_RE/ ? :
2036 1341 5 unless (ref $r)
2043 1 4 if (ref $r eq 'SCALAR') { }
1 3 elsif (ref $r eq 'ARRAY') { }
2052 0 1 unless (ref $$r[0])
2066 3 0 if $s .= '?,'
2082 11 0 if length $last_sql <= 500