Branch Coverage

blib/lib/DBIx/Class/Storage/DBIHacks.pm
Criterion Covered Total %
branch 299 340 87.9


line true false branch
38 57 892 unless ref $attrs->{'from'} eq 'ARRAY' and @{$attrs->{'from'};} > 1 and ref $attrs->{'from'}[0] eq 'HASH' and ref $attrs->{'from'}[1] eq 'ARRAY' and $self->_use_join_optimizer
54 222 670 if $attrs->{'_force_prune_multiplying_joins'} or $attrs->{'group_by'}
77 1393 129 if not defined $j->[0]{'-alias'} or $need_joins{$j->[0]{'-alias'}}
84 2463 221 $need_joins{$_} ? :
106 0 87 unless ref $attrs->{'from'} eq 'ARRAY' and @{$attrs->{'from'};} > 1 and ref $attrs->{'from'}[0] eq 'HASH' and ref $attrs->{'from'}[1] eq 'ARRAY'
123 15 72 if delete $inner_attrs->{'_order_is_artificial'} or not $inner_attrs->{'rows'}
134 20 0 ref $node eq 'ARRAY' && ref $node->[0] eq 'HASH' ? :
87 20 ref $node eq 'HASH' ? :
139 87 0 if (($h->{'-alias'} || '') eq $root_alias and $h->{'-rsrc'})
146 0 87 unless $root_node
157 432 322 if $colinfo->{$sel} and $colinfo->{$sel}{'-source_alias'} ne $root_alias
160 17 305 if (ref $sel eq 'HASH') { }
295 20 elsif (not ref $sel and my $ci = $colinfo->{$sel}) { }
184 219 411 unless $_->{'-seen_columns'}
185 0 555 unless my $ci = $colinfo->{$_}
186 37 518 if ($ci->{'-source_alias'} eq $root_alias and not $$selected_root_columns{$ci->{'-colname'}}++)
213 39 6 if (grep {$_ ne $root_alias;} keys %{{} unless $inner_aliastypes->{'multiplying'};} and !$inner_aliastypes->{'grouping'} || $inner_attrs->{'_grouped_by_distinct'})
214 0 87 unless $inner_aliastypes->{'multiplying'}
230 0 39 unless my(@pks) = map({"$root_alias.$_";} $root_node->{'-rsrc'}->primary_columns)
233 0 39 unless $cur_sel->{$col}++
236 0 39 $inner_select_with_extras ? :
271 17 69 if ($root_node_offset) { }
303 204 140 unless $outer_aliastypes->{$_}
311 109 10 if ($outer_select_chain->{$alias}) { }
8 2 elsif (&first(sub { $_->{$alias}; } , @outer_nonselecting_chains)) { }
318 6 2 $outer_aliastypes->{'multiplying'}{$alias} ? :
326 2 4 if ($may_need_outer_group_by and $attrs->{'_grouped_by_distinct'})
358 0 1120 if ref $attrs->{'from'} ne 'ARRAY'
369 1846 1034 if ref $j eq 'ARRAY'
371 8 2872 unless my $al = $j->{'-alias'}
377 897 1975 if ref $node eq 'ARRAY' and not $j->{'-is_single'}
384 1030 1842 unless $j->{'-join_path'}
369 2503 if grep {$aliases_by_type->{'multiplying'}{$_};} grep({$_ ne $al;} map({values %$_;} @{[] unless $j->{'-join_path'};}))
408 995 125 unless (defined $sql_maker->{'quote_char'} and length $sql_maker->{'quote_char'})
436 86 1034 ref $attrs->{'from'}[0] eq 'ARRAY' ? :
447 459 0 if not defined $_ or ref $_ eq 'ARRAY' and @$_ == 0 || @$_ == 2
456 0 10204 if (ref $_)
472 0 1120 unless $to_scan->{'selecting'}
477 655 9519 if ($colinfo->{$piece} and my $alias = $colinfo->{$piece}{'-source_alias'})
495 8978 18918 if (my(@matches) = $piece =~ /$al_re/g)
507 12602 9394 if $col =~ / \. /x
513 1534 85719 if (my(@matches) = $piece =~ /$col_re/g)
525 0 2872 unless my $alias = $j->{'-alias'}
529 1838 1034 unless $j->{'-join_type'} and $j->{'-join_type'} =~ /^left (?: \s+ outer)? $/xi
534 48 4456 unless keys %{$$aliases_by_type{$_};}
553 399 14 if (not ref $_ or ref $_ ne 'HASH')
556 0 399 if ($colinfos->{$_} and not $_ =~ /\./)
564 44 66 unless my(@order_by) = $self->_extract_order_criteria($attrs->{'order_by'})
582 0 166 if $order_by[$o_idx][0] =~ /^ (?: min | max ) \s* \( .+ \) $/xi
586 1 2 if (@{$order_by[$o_idx];} != 1 or not $chunk_ci = $$colinfos{$order_by[$o_idx][0]} and $attrs->{'_aliastypes'})
597 3 163 unless $chunk_ci
600 88 75 if $group_index{$chunk_ci->{'-fq_colname'}}
609 61 14 if $group_already_unique
612 16 59 if ($group_already_unique and not $aliastypes->{'multiplying'}{$chunk_ci->{'-source_alias'}} and not $aliastypes->{'premultiplied'}{$chunk_ci->{'-source_alias'}}) { }
638 105 40 ref $_ eq 'ARRAY' ? :
649 40 19 $is_desc ? :
659 1 65 if $leftovers
663 46 19 if (@new_order_by)
669 46 19 @new_order_by ? :
676 39 18 $_[2] ? :
686 0 8136 if (&blessed($ident) and $ident->isa('DBIx::Class::ResultSource')) { }
8135 1 elsif (ref $ident eq 'ARRAY') { }
694 8269 3137 if (ref $_ eq 'HASH')
697 3137 8269 if (ref $_ eq 'ARRAY' and ref $_->[0] eq 'HASH')
702 11391 15 if $tabinfo->{'-rsrc'}
719 0 8136 if $colnames and not @$colnames
731 57756 198 unless $colnames
746 103757 5927 if $seen_cols{$colname} and @{$seen_cols{$colname};} == 1
748 18 109666 unless $source_alias
750 0 109666 unless my $rsrc = $alias2src->{$source_alias}
755 0 109666 unless +($colinfos->{$source_alias} ||= $rsrc->columns_info)->{$colname}
51900 57766 $col eq $colname ? :
767 51900 57766 if $col eq $colname
793 0 216 unless $switch_branch
0 216 unless @{[] unless $switch_branch;}
805 247 30 if ($sw_idx->{$jalias}) { }
831 0 259 if ref $from ne 'ARRAY' or ref $from->[0] ne 'HASH' or not defined $from->[0]{'-alias'}
834 41 218 if $from->[0]{'-alias'} eq $target_alias
837 218 52 if ($from->[$i][0]{'-alias'} || '') eq $target_alias
850 22 2017 unless wantarray
853 897 1120 $orig_quote_chars ? :
860 683 555 ref $_ ? :
865 843 395 unless $chunk->[0] =~ s/^ $lq (.+?) $rq $sep $lq (.+?) $rq $/"$1.$2";/ex
874 1120 919 if ($sql_maker) { }
894 27 3 $where ? :
0 30 unless my(@cols) = (map({$_->[0];} $self->_extract_order_criteria($order_by)), $where ? keys %{$self->_extract_fixed_condition_columns($where);} : ())
899 30 0 keys %$colinfo ? :
914 77 10 if $src->_identifying_column_set($_)
929 0 43 unless defined $nodes
935 0 43 unless @ord_cols
948 17 94 unless my $colinfo = $colinfos->{$col}
951 8 86 unless $$valid_aliases{$colinfo->{'-source_alias'}}
956 85 1 if $colinfo->{'-source_alias'} eq $attrs->{'alias'}
962 8 35 unless $seen_main_src_cols
971 25 1 $colinfos->{$_} && $colinfos->{$_}{'-source_alias'} eq $attrs->{'alias'} ? :
972 19 16 $attrs->{'where'} ? :
978 35 0 $attrs->{'result_source'}->_identifying_column_set([keys %$seen_main_src_cols, @$main_src_fixed_cols_from_cond]) ? :
995 142 29992 if (not $where) { }
26226 3766 elsif ($where_is_anded_array or ref $where eq 'HASH') { }
3407 359 elsif (ref $where eq 'ARRAY') { }
1002 4493 21733 $where_is_anded_array ? :
1006 29593 1125 if (ref $chunk eq 'HASH') { }
502 623 elsif (ref $chunk eq 'ARRAY') { }
442 181 elsif (not length ref $chunk) { }
1010 128 33651 if ($_ eq '')
1011 60 68 &is_literal_value($chunk->{$_}) ? :
1021 447 55 if @$chunk
1027 10 432 if $where_is_anded_array and !defined($chunk) || $chunk eq ''
1037 307 25841 unless @pairs
1039 212 25291 unless my(@conds) = $self->_collapse_cond_unroll_pairs(\@pairs)
1044 0 34264 if (ref $c ne 'HASH') { }
1051 618 39544 if ($col =~ /^\-and$/i) { }
1651 37893 elsif ($col =~ /^\-/) { }
1598 36295 elsif (exists $fin->{$col}) { }
1055 0 0 ref $c->{$col} eq 'HASH' ? :
618 0 ref $c->{$col} eq 'ARRAY' ? :
1064 80 3116 ref $_ eq 'ARRAY' && ($_->[0] || '') =~ /^\-and$/i ? :
1083 156 5520 unless defined $where->[$i] and length $where->[$i]
1089 1153 4367 if ($logic_mod) { }
3000 1367 elsif (not length ref $where->[$i]) { }
1091 0 1153 unless ref $where->[$i] eq 'HASH' or ref $where->[$i] eq 'ARRAY'
1094 85 918 unless my $sub_elt = $self->_collapse_cond({$logic_mod, $where->[$i]})
1098 369 549 if (@keys == 1 and not $keys[0] =~ /^\-/) { }
1106 1 2999 unless my $sub_elt = $self->_collapse_cond({@{$where;}[$i, $i + 1]})
1117 553 2520 if (not $fin_idx) { }
1365 1155 elsif (keys %$fin_idx == 1) { }
1128 3244 16 if (ref $fin_idx->{$_} eq 'HASH' and keys %{$$fin_idx{$_};} == 1) { }
1131 122 3122 if (ref $r eq 'ARRAY' and @$r == 1 && $l =~ /^\-and$/i || $l =~ /^\-or$/i) { }
0 3122 elsif (ref $r eq 'HASH' and keys %$r == 1 and $l =~ /^\-(?:and|or)$/i) { }
1177 0 2137 if @$and == 0
1180 1379 758 if (ref $and->[0] eq 'HASH' and not grep({exists $fin->{$_};} keys %{$$and[0];})) { }
1197 34969 2652 unless ref $fin->{$col} eq 'ARRAY' and ($fin->{$col}[0] || '') =~ /^\-and$/i
1199 963 4304 !length(ref $_) || &is_plain_value($_) ? :
163 5267 !defined($_) ? :
1204 358 2294 if (keys %$val_bag == 1) { }
1212 28170 0 keys %$fin ? :
1223 241 35561 if ($lhs eq '') { }
5300 30261 elsif ($lhs =~ /^\-and$/i) { }
2280 27981 elsif ($lhs =~ /^\-or$/i) { }
1231 303 1977 ref $rhs eq 'HASH' ? :
1235 6 27975 if (ref $rhs eq 'HASH' and not keys %$rhs) { }
322 27653 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $rhs->{'-ident'}) { }
33 27620 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $rhs->{'-value'} and &is_plain_value($rhs->{'-value'})) { }
1460 26160 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $rhs->{'='}) { }
266 25894 elsif (ref $rhs eq 'ARRAY') { }
7 25887 elsif (ref $rhs eq 'HASH' and (my($subop) = keys %$rhs) == 1 and length ref((values %$rhs)[0]) and my $vref = &is_plain_value(scalar((values %$rhs)[0]))) { }
1246 696 764 if (length ref $rhs->{'='} and &is_literal_value($rhs->{'='})) { }
1253 0 769 if (keys %$p > 1)
1268 749 20 !length(ref $r) || ref $r eq 'HASH' && keys %$rhs == 1 && exists $rhs->{'='} || &is_plain_value($r) ? :
1281 60 206 if (not @$rhs) { }
154 52 elsif (($rhs->[0] || '') =~ /^\-(?:and|or)$/i) { }
15 37 elsif (@$rhs == 1) { }
1285 0 154 if @$rhs == 1
1288 144 10 if ($rhs->[0] =~ /^\-and$/i) { }
5 5 elsif (@$rhs == 2) { }
1352 242 12466 if (not defined($v = $where_hash->{$c})) { }
477 11989 elsif (ref $v eq 'HASH' and keys %$v == 1) { }
11222 767 elsif (not length ref $v or &is_plain_value($v)) { }
81 774 elsif (ref $v eq 'ARRAY' and ($v->[0] || '') eq '-and') { }
1353 108 134 if $consider_nulls
1360 12 465 if (exists $v->{'-value'}) { }
374 91 elsif (length ref $v->{'='} and ref $v->{'='} eq 'HASH' && keys %{$$v{'='};} == 1 && exists $v->{'='}{'-ident'} || &is_literal_value($v->{'='})) { }
1361 12 0 if (defined $v->{'-value'}) { }
0 0 elsif ($consider_nulls) { }
1391 51 135 unless exists $subval->{$c}
1396 79 34 !length(ref $subval->{$c}) || &is_plain_value($subval->{$c}) ? :
22 113 !defined($subval->{$c}) ? :
1400 11743 965 if (keys %$vals == 1) { }
54 911 elsif (keys %$vals > 1) { }
1402 11738 5 unless not $consider_nulls and exists $vals->{'UNDEF'}