Branch Coverage

blib/lib/SQL/Wizard/Renderer.pm
Criterion Covered Total %
branch 210 256 82.0


line true false branch
69 93 554 if $part eq "*"
70 3 551 if $RESERVED{uc $part}
71 0 551 if $part =~ /[A-Z]/
72 0 551 if $part =~ /[^a-z0-9_]/
78 0 3 ($self->{'dialect'} || 'ansi') eq 'mysql' ? :
80 0 3 $_ eq '*' ? :
87 608 3 unless grep {$self->_needs_quoting($_);} @parts
93 0 316 if ($string =~ /$INJECTION_GUARD/mix)
101 0 28 unless $col =~ /^(\w+\.)*(\w+|\*)$/
107 0 14 unless $col =~ /^(\w+\.)*\w+$/
113 0 9 unless $value =~ /^\d+$/
141 0 405 unless my $handler = $dispatch{$type}
149 0 275 unless defined $thing
150 93 182 if (builtin::blessed($thing) and $thing->isa("SQL::Wizard::Expr"))
161 3 157 if (builtin::blessed($thing) and $thing->isa("SQL::Wizard::Expr"))
164 0 157 unless $thing =~ /^(\w+\.)*\w+(\|\w+)?$/
168 26 131 $alias ? :
187 0 18 if ($node->{'_truncate'})
189 0 0 unless $table =~ /^(\w+\.)*\w+$/
195 7 11 if ($node->{'_subquery'})
201 2 9 if ($node->{'_between'} or $node->{'_not_between'})
203 1 1 $node->{'_between'} ? :
211 1 8 if ($node->{'_cast'})
213 0 1 unless $type =~ /^\w[\w\s(),]*$/
220 2 6 if ($node->{'_logic'})
231 2 0 if @parts > 1
236 1 5 if ($node->{'_not'})
248 4 24 if ($node->{'expr'}->isa("SQL::Wizard::Expr::Select"))
258 2 4 if $node->{'nulls'}
290 4 136 if ($node->{'_cte'})
298 57 83 unless $node->{'columns'}
303 2 138 $node->{'distinct'} ? :
307 140 0 if ($node->{'from'})
309 12 128 ref $node->{'from'} eq 'ARRAY' ? :
312 12 140 if (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr::Join')) { }
319 140 0 if ($i == 0) { }
331 72 68 if ($node->{'where'})
333 69 2 if (defined $wsql and $wsql ne "")
340 7 132 if ($node->{'group_by'})
341 0 7 ref $node->{'group_by'} eq 'ARRAY' ? :
352 3 136 if ($node->{'having'})
354 1 2 if (defined $hsql and $hsql ne "")
361 2 137 if ($node->{'window'})
364 0 2 unless $name =~ /^\w+$/
374 7 132 if ($node->{'order_by'})
375 3 4 ref $node->{'order_by'} eq 'ARRAY' ? :
378 2 6 if (ref $o eq 'HASH') { }
0 6 elsif (not ref $o and $o =~ /^-(.+)/) { }
4 2 elsif (not ref $o) { }
383 2 0 unless ref $col
408 4 135 if (defined $node->{'limit'})
413 3 136 if (defined $node->{'offset'})
433 12 1 if (defined $node->{'on'})
434 1 11 if (ref $node->{'on'} eq 'HASH') { }
458 1 5 if ($node->{'operand'})
465 2 7 if ($node->{'operand'}) { }
480 5 1 if (defined $node->{'else'})
497 4 5 if ($spec->{'name'})
498 0 4 unless $spec->{'name'} =~ /^\w+$/
512 6 1 if ($spec->{'-partition_by'})
514 1 5 ref $spec->{'-partition_by'} eq 'ARRAY' ? :
524 7 0 if ($spec->{'-order_by'})
526 3 4 ref $spec->{'-order_by'} eq 'ARRAY' ? :
529 3 4 if (ref $o eq 'HASH') { }
0 4 elsif (not ref $o and $o =~ /^-(.+)/) { }
4 0 elsif (not ref $o) { }
533 3 0 unless ref $col
556 1 6 if ($spec->{'-frame'})
573 11 9 if ($entry->{'type'})
581 1 8 if ($node->{'order_by'})
582 0 1 ref $node->{'order_by'} eq 'ARRAY' ? :
585 0 1 if (ref $o eq 'HASH') { }
0 1 elsif (not ref $o and $o =~ /^-(.+)/) { }
1 0 elsif (not ref $o) { }
589 0 0 unless ref $col
611 1 8 if (defined $node->{'limit'})
616 0 9 if (defined $node->{'offset'})
632 1 3 $node->{'recursive'} ? :
641 1 4 if (ref $query eq 'HASH' and $query->{'-initial'}) { }
666 1 6 if ($node->{'select'}) { }
5 1 elsif (ref $node->{'values'} eq 'HASH') { }
1 0 elsif (ref $node->{'values'} eq 'ARRAY') { }
668 1 0 if ($node->{'columns'})
690 1 0 if ($node->{'columns'})
708 1 6 if ($node->{'on_conflict'})
725 1 6 if ($node->{'on_duplicate'})
737 1 6 if ($node->{'returning'})
753 1 5 if (ref $node->{'table'} eq 'ARRAY') { }
756 1 1 if (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr::Join')) { }
784 1 5 if ($node->{'from'})
785 1 0 ref $node->{'from'} eq 'ARRAY' ? :
796 5 1 if ($node->{'where'})
798 5 0 if (defined $ws and $ws ne "")
805 1 5 if (defined $node->{'limit'})
812 1 5 if ($node->{'returning'})
831 1 5 if ($node->{'using'})
837 5 1 if ($node->{'where'})
839 5 0 if (defined $ws and $ws ne "")
846 1 5 if ($node->{'returning'})
860 1 108 if (builtin::blessed($where) and $where->isa("SQL::Wizard::Expr"))
865 99 9 if (ref $where eq "HASH")
872 0 101 if (builtin::blessed($key) and $key->isa("SQL::Wizard::Expr"))
883 2 99 if (not defined $val) { }
6 93 elsif (builtin::blessed($val) and $val->isa('SQL::Wizard::Expr')) { }
42 51 elsif (ref $val eq 'HASH') { }
2 49 elsif (ref $val eq 'ARRAY') { }
895 1 1 if (not @$val) { }
900 0 3 if (builtin::blessed($v) and $v->isa('SQL::Wizard::Expr')) { }
920 8 1 if (ref $where eq "ARRAY")
932 42 0 if (ref $val eq "HASH")
940 1 41 unless $VALID_OPS{$sql_op}
943 10 31 if ($sql_op eq '-IN' or $sql_op eq '-NOT_IN') { }
3 28 elsif (not defined $rhs) { }
3 25 elsif (builtin::blessed($rhs) and $rhs->isa('SQL::Wizard::Expr')) { }
944 5 5 $sql_op eq '-NOT_IN' ? :
945 4 6 if (builtin::blessed($rhs) and $rhs->isa('SQL::Wizard::Expr')) { }
6 0 elsif (ref $rhs eq 'ARRAY') { }
950 2 4 if (not @$rhs) { }
952 1 1 $neg ? :
956 0 9 if (builtin::blessed($v) and $v->isa('SQL::Wizard::Expr')) { }
969 2 1 if ($sql_op eq '!=' or $sql_op eq '<>') { }
976 1 2 if $rhs->isa("SQL::Wizard::Expr::Select")
1002 6 13 if (not ref $item and $item =~ /^-(and|or)$/i)
1006 4 2 if ($i <= $#items and ref $items[$i] eq "ARRAY")
1015 11 2 if (ref $item eq 'HASH') { }
1 1 elsif (ref $item eq 'ARRAY') { }
1 0 elsif (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr')) { }
1033 6 7 if @parts > 1