Branch Coverage

blib/lib/DBIx/Class/Storage/DBIHacks.pm
Criterion Covered Total %
branch 300 340 88.2


line true false branch
38 57 893 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 671 if $attrs->{'_force_prune_multiplying_joins'} or $attrs->{'group_by'}
77 1394 130 if not defined $j->[0]{-'alias'} or $need_joins{$j->[0]{-'alias'}}
84 2465 222 $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 16 71 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 20 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 410 unless $$_{-'seen_columns'}
185 0 554 unless my $ci = $colinfo->{$_}
186 37 517 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 1121 if ref $attrs->{'from'} ne 'ARRAY'
369 1848 1035 if ref $j eq 'ARRAY'
371 8 2875 unless my $al = $$j{-'alias'}
377 898 1977 if ref $node eq 'ARRAY' and not $$j{-'is_single'}
384 1031 1844 unless $$j{-'join_path'}
370 2505 if grep {$aliases_by_type->{'multiplying'}{$_};} grep({$_ ne $al;} map({values %$_;} @{[] unless $$j{-'join_path'};}))
408 996 125 unless (defined $sql_maker->{'quote_char'} and length $sql_maker->{'quote_char'})
436 86 1035 ref $attrs->{'from'}[0] eq 'ARRAY' ? :
447 459 0 if not defined $_ or ref $_ eq 'ARRAY' and @$_ == 0 || @$_ == 2
456 0 10216 if (ref $_)
472 0 1121 unless $to_scan->{'selecting'}
477 660 9526 if ($colinfo->{$piece} and my $alias = $colinfo->{$piece}{-'source_alias'})
495 8985 18949 if (my(@matches) = $piece =~ /$al_re/g)
507 12620 9414 if $col =~ / \. /x
513 1543 85962 if (my(@matches) = $piece =~ /$col_re/g)
525 0 2875 unless my $alias = $$j{-'alias'}
529 1839 1036 unless $$j{-'join_type'} and $$j{-'join_type'} =~ /^left (?: \s+ outer)? $/xi
534 48 4459 unless keys %{$$aliases_by_type{$_};}
553 399 14 if (not ref $_ or ref $_ ne 'HASH')
556 0 399 if ($colinfos->{$_} and not $_ =~ /\./)
564 45 65 unless my(@order_by) = $self->_extract_order_criteria($attrs->{'order_by'})
582 0 165 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 162 unless $chunk_ci
600 87 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 64 if $leftovers
663 46 18 if (@new_order_by)
669 46 18 @new_order_by ? :
676 39 18 $_[2] ? :
686 0 8096 if (&blessed($ident) and $ident->isa('DBIx::Class::ResultSource')) { }
8095 1 elsif (ref $ident eq 'ARRAY') { }
694 8229 3139 if (ref $_ eq 'HASH')
697 3139 8229 if (ref $_ eq 'ARRAY' and ref $_->[0] eq 'HASH')
702 11353 15 if $$tabinfo{-'rsrc'}
719 0 8096 if $colnames and not @$colnames
731 57562 198 unless $colnames
746 103377 5923 if $seen_cols{$colname} and @{$seen_cols{$colname};} == 1
748 18 109282 unless $source_alias
750 0 109282 unless my $rsrc = $alias2src->{$source_alias}
755 0 109282 unless ($colinfos->{$source_alias} ||= $rsrc->columns_info)->{$colname}
51710 57572 $col eq $colname ? :
767 51710 57572 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 258 if ref $from ne 'ARRAY' or ref $from->[0] ne 'HASH' or not defined $from->[0]{-'alias'}
834 40 218 if $from->[0]{-'alias'} eq $target_alias
837 218 52 if ($from->[$i][0]{-'alias'} || '') eq $target_alias
850 22 2014 unless wantarray
853 893 1121 $orig_quote_chars ? :
860 683 558 ref $_ ? :
865 846 395 unless $chunk->[0] =~ s/^ $lq (.+?) $rq $sep $lq (.+?) $rq $/"$1.$2";/ex
874 1121 915 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 76 10 if $src->_identifying_column_set($_)
929 0 42 unless defined $nodes
935 0 42 unless @ord_cols
948 17 93 unless my $colinfo = $colinfos->{$col}
951 8 85 unless $$valid_aliases{$$colinfo{-'source_alias'}}
956 84 1 if $$colinfo{-'source_alias'} eq $attrs->{'alias'}
962 8 34 unless $seen_main_src_cols
971 25 1 $colinfos->{$_} && $colinfos->{$_}{-'source_alias'} eq $attrs->{'alias'} ? :
972 18 16 $attrs->{'where'} ? :
978 34 0 $attrs->{'result_source'}->_identifying_column_set([keys %$seen_main_src_cols, @$main_src_fixed_cols_from_cond]) ? :
995 142 29886 if (not $where) { }
26125 3761 elsif ($where_is_anded_array or ref $where eq 'HASH') { }
3402 359 elsif (ref $where eq 'ARRAY') { }
1002 4490 21635 $where_is_anded_array ? :
1006 29491 1123 if (ref $chunk eq 'HASH') { }
500 623 elsif (ref $chunk eq 'ARRAY') { }
442 181 elsif (not length ref $chunk) { }
1010 128 33540 if ($_ eq '')
1011 60 68 &is_literal_value($chunk->{$_}) ? :
1021 445 55 if @$chunk
1027 10 432 if $where_is_anded_array and !defined($chunk) || $chunk eq ''
1037 307 25740 unless @pairs
1039 212 25190 unless my(@conds) = $self->_collapse_cond_unroll_pairs(\@pairs)
1044 0 34171 if (ref $c ne 'HASH') { }
1051 620 39446 if ($col =~ /^\-and$/i) { }
1643 37803 elsif ($col =~ /^\-/) { }
1616 36187 elsif (exists $fin->{$col}) { }
1055 0 0 ref $c->{$col} eq 'HASH' ? :
620 0 ref $c->{$col} eq 'ARRAY' ? :
1064 90 3142 ref $_ eq 'ARRAY' && ($_->[0] || '') =~ /^\-and$/i ? :
1083 156 5512 unless defined $where->[$i] and length $where->[$i]
1089 1153 4359 if ($logic_mod) { }
2994 1365 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 2993 unless my $sub_elt = $self->_collapse_cond({@{$where;}[$i, $i + 1]})
1117 553 2515 if (not $fin_idx) { }
1363 1152 elsif (keys %$fin_idx == 1) { }
1128 3238 16 if (ref $fin_idx->{$_} eq 'HASH' and keys %{$$fin_idx{$_};} == 1) { }
1131 122 3116 if (ref $r eq 'ARRAY' and @$r == 1 && $l =~ /^\-and$/i || $l =~ /^\-or$/i) { }
0 3116 elsif (ref $r eq 'HASH' and keys %$r == 1 and $l =~ /^\-(?:and|or)$/i) { }
1177 0 2127 if @$and == 0
1180 1369 758 if (ref $and->[0] eq 'HASH' and not grep({exists $fin->{$_};} keys %{$$and[0];})) { }
1197 34831 2680 unless ref $fin->{$col} eq 'ARRAY' and ($fin->{$col}[0] || '') =~ /^\-and$/i
1199 965 4351 !length(ref $_) || &is_plain_value($_) ? :
180 5316 !defined($_) ? :
1204 346 2334 if (keys %$val_bag == 1) { }
1212 28064 0 keys %$fin ? :
1223 241 35485 if ($lhs eq '') { }
5297 30188 elsif ($lhs =~ /^\-and$/i) { }
2275 27913 elsif ($lhs =~ /^\-or$/i) { }
1231 303 1972 ref $rhs eq 'HASH' ? :
1235 6 27907 if (ref $rhs eq 'HASH' and not keys %$rhs) { }
322 27585 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $$rhs{-'ident'}) { }
33 27552 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $$rhs{-'value'} and &is_plain_value($$rhs{-'value'})) { }
1458 26094 elsif (ref $rhs eq 'HASH' and keys %$rhs == 1 and exists $rhs->{'='}) { }
285 25809 elsif (ref $rhs eq 'ARRAY') { }
7 25802 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 697 761 if (length ref $rhs->{'='} and &is_literal_value($rhs->{'='})) { }
1253 0 766 if (keys %$p > 1)
1268 746 20 !length(ref $r) || ref $r eq 'HASH' && keys %$rhs == 1 && exists $rhs->{'='} || &is_plain_value($r) ? :
1281 60 225 if (not @$rhs) { }
174 51 elsif (($rhs->[0] || '') =~ /^\-(?:and|or)$/i) { }
15 36 elsif (@$rhs == 1) { }
1285 0 174 if @$rhs == 1
1288 164 10 if ($rhs->[0] =~ /^\-and$/i) { }
5 5 elsif (@$rhs == 2) { }
1352 242 12372 if (not defined($v = $where_hash->{$c})) { }
475 11897 elsif (ref $v eq 'HASH' and keys %$v == 1) { }
11135 762 elsif (not length ref $v or &is_plain_value($v)) { }
81 765 elsif (ref $v eq 'ARRAY' and ($v->[0] || '') eq '-and') { }
1353 108 134 if $consider_nulls
1360 12 463 if (exists $$v{-'value'}) { }
374 89 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 11656 958 if (keys %$vals == 1) { }
54 904 elsif (keys %$vals > 1) { }
1402 11651 5 unless not $consider_nulls and exists $vals->{'UNDEF'}