Branch Coverage

blib/lib/SQL/Format.pm
Criterion Covered Total %
branch 250 268 93.2


line true false branch
87 0 209 unless $method
88 2 207 unless @_
101 3 26 if (not defined $val) { }
17 9 elsif (ref $val eq 'ARRAY') { }
1 8 elsif (ref $val eq 'SCALAR') { }
105 16 1 if (@$val) { }
109 1 25 if ($ref eq 'HASH') { }
4 21 elsif ($ref eq 'ARRAY') { }
1 20 elsif ($ref eq 'REF' and ref $$_ eq 'ARRAY') { }
116 1 3 if (ref $term eq 'ARRAY') { }
1 4 elsif (ref $term eq 'REF' and ref $$term eq 'ARRAY') { }
124 3 1 ref $term eq 'SCALAR' ? :
130 1 0 ref $term eq 'SCALAR' ? :
159 2 36 if (ref $val eq 'ARRAY') { }
12 24 elsif (ref $val eq 'HASH') { }
24 0 elsif (defined $val) { }
163 2 3 if (ref $v eq 'HASH') { }
188 8 129 if (ref $val eq 'ARRAY')
194 0 8 @ret == 1 ? :
197 2 127 unless ref $val eq 'HASH'
199 2 125 unless %$val
205 3 140 if (uc $org_key eq '-OR') { }
4 136 elsif (uc $org_key eq '-AND') { }
15 121 elsif (ref $v eq 'ARRAY') { }
60 61 elsif (ref $v eq 'HASH') { }
2 59 elsif (ref $v eq 'REF' and ref $$v eq 'ARRAY') { }
1 58 elsif (ref $v eq 'SCALAR') { }
1 57 elsif (not defined $v) { }
212 9 6 if (ref $v->[0] or ($v->[0] || '') eq '-and' or ($v->[0] || '') eq '-or') { }
1 5 elsif (@$v == 0) { }
224 4 5 if ($v->[0] and $v->[0] eq '-and') { }
4 1 elsif ($v->[0] and $v->[0] eq '-or') { }
250 2 58 scalar keys %$v > 1 ? :
255 18 44 if ($OP_TYPE_MAP->{'in'}{$op}) { }
10 34 elsif ($OP_TYPE_MAP->{'between'}{$op}) { }
15 19 elsif ($OP_TYPE_MAP->{'like'}{$op}) { }
1 18 elsif (ref $v eq 'SCALAR') { }
6 12 elsif (ref $v eq 'ARRAY') { }
2 10 elsif (ref $v eq 'REF' and ref $$v eq 'ARRAY') { }
257 10 8 if ($ref eq 'ARRAY') { }
2 6 elsif ($ref eq 'REF') { }
2 4 elsif ($ref eq 'SCALAR') { }
2 2 elsif (defined $v) { }
258 8 2 if (@$v) { }
260 1 1 $op eq 'IN' ? :
279 1 1 $op eq 'IN' ? :
284 1 1 $op eq 'IN' ? :
289 6 4 if ($ref eq 'ARRAY') { }
2 2 elsif ($ref eq 'REF') { }
2 0 elsif ($ref eq 'SCALAR') { }
295 2 10 if (ref $value eq 'SCALAR') { }
2 8 elsif (ref $value eq 'REF') { }
326 3 12 if ($ref eq 'HASH')
330 3 12 if ($ref eq 'ARRAY') { }
3 9 elsif ($ref eq 'SCALAR') { }
335 3 3 if (ref $value eq 'SCALAR') { }
342 2 4 if ($escape_char)
352 1 2 if ($escape_char)
360 1 8 if ($escape_char)
371 3 3 if ($op eq '=') { }
3 0 elsif ($op eq '!=') { }
372 2 1 if (@$v) { }
381 2 1 if (@$v) { }
405 58 4 $no_paren ? :
425 0 143 $no_paren ? :
435 7 16 if (exists $val->{'group_by'})
439 2 21 if (exists $val->{'having'})
444 10 13 if (exists $val->{'order_by'})
448 7 16 if (defined $val->{'limit'})
449 1 6 if $val->{'limit'} =~ /\D/
451 4 2 if ($val->{'offset'}) { }
452 1 3 if $val->{'offset'} =~ /\D/
454 3 0 if ($limit_dialect == 1) { }
0 0 elsif ($limit_dialect == 2) { }
0 0 elsif ($limit_dialect == 3) { }
481 11 1 unless ref $val eq 'ARRAY'
483 0 13 unless ref $param eq 'HASH'
485 0 13 unless $param->{'table'} and $param->{'condition'}
490 2 11 if (ref $param->{'condition'} eq 'ARRAY') { }
10 1 elsif (ref $param->{'condition'} eq 'HASH') { }
497 1 9 keys %$cond > 1 ? :
501 1 10 if (uc $k eq '-WHERE') { }
2 8 elsif (ref $v eq 'HASH') { }
1 7 elsif (ref $v eq 'REF' and ref $$v eq 'ARRAY') { }
505 1 1 keys %$v > 1 ? :
509 1 2 if (ref $v->{$op} eq 'REF' and ref ${$v->{$op};} eq 'ARRAY') { }
517 1 2 $no_paren ? :
528 9 2 $no_paren ? :
542 2 380 if ref $stuff eq 'SCALAR'
543 2 378 unless $QUOTE_CHAR and $NAME_SEP
544 6 372 if $stuff eq '*'
545 2 370 if substr($stuff, 0, 1) eq $QUOTE_CHAR
546 3 367 if $stuff =~ /\(/
557 4 12 if (ref $v eq 'HASH') { }
558 1 3 if $v->{'alias'}
559 4 0 if (exists $v->{'index'} and ref $v->{'index'})
562 0 4 unless $SUPPORTED_INDEX_TYPE_MAP->{$type}
564 0 4 unless defined $v->{'index'}{'keys'}
566 1 3 unless ref $keys eq 'ARRAY'
584 2 15 if (not defined $stuff) { }
6 9 elsif (ref $stuff eq 'HASH') { }
2 7 elsif (ref $stuff eq 'ARRAY') { }
592 4 4 if (my $sort_op = $$SORT_OP_ALIAS{uc $_}) { }
604 2 2 if (ref $part eq 'HASH') { }
606 2 2 if (my $sort_op = $$SORT_OP_ALIAS{uc $_}) { }
630 8 12 ref $val eq 'HASH' ? :
635 4 22 if (ref $val eq 'SCALAR') { }
3 19 elsif (ref $val eq 'REF' and ref $$val eq 'ARRAY') { }
658 3 70 if (exists $args{'driver'} and defined $args{'driver'})
660 2 1 unless (defined $args{'quote_char'})
661 1 1 $driver eq 'mysql' ? :
663 2 1 unless (defined $args{'limit_dialect'})
665 1 1 $driver eq 'mysql' ? :
690 1 12 unless defined $table
703 1 11 if (my $join = delete $opts->{'join'})
707 5 7 if ($where and (ref $where eq 'HASH' and keys %$where) or ref $where eq 'ARRAY' and @$where)
711 3 9 if (keys %$opts)
715 1 11 if ($suffix)
724 2 6 unless defined $table and ref $values
735 3 3 ref $values eq 'HASH' ? :
740 1 8 if (ref $val eq 'SCALAR') { }
1 7 elsif (ref $val eq 'REF' and ref $$val eq 'ARRAY') { }
766 2 9 unless defined $table and ref $set
781 2 7 if ($where and (ref $where eq 'HASH' and keys %$where) or ref $where eq 'ARRAY' and @$where)
785 1 8 if (keys %$opts)
797 1 6 unless defined $table
810 3 3 if ($where and (ref $where eq 'HASH' and keys %$where) or ref $where eq 'ARRAY' and @$where)
814 1 5 if (keys %$opts)
824 3 10 unless ref $cols eq 'ARRAY' and ref $values eq 'ARRAY'
843 2 42 if (ref $val eq 'SCALAR') { }
2 40 elsif (ref $val eq 'REF' and ref $$val eq 'ARRAY') { }
866 2 8 if ($opts->{'update'})
876 3 5 unless ref $values eq 'ARRAY' and ref $values->[0] eq 'HASH'
890 0 1 unless ref $values and ref $update_values