Branch Coverage

blib/lib/SQL/Wizard/Renderer.pm
Criterion Covered Total %
branch 216 264 81.8


line true false branch
69 99 575 if $part eq "*"
70 3 572 if $RESERVED{uc $part}
71 0 572 if $part =~ /[A-Z]/
72 0 572 if $part =~ /[^a-z0-9_]/
78 0 3 ($self->{'dialect'} || 'ansi') eq 'mysql' ? :
80 0 3 $_ eq '*' ? :
87 631 3 unless grep {$self->_needs_quoting($_);} @parts
93 0 321 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 429 unless my $handler = $dispatch{$type}
149 0 284 unless defined $thing
150 99 185 if (builtin::blessed($thing) and $thing->isa("SQL::Wizard::Expr"))
161 3 163 if (builtin::blessed($thing) and $thing->isa("SQL::Wizard::Expr"))
164 0 163 unless $thing =~ /^(\w+\.)*\w+(\|\w+)?$/
168 30 133 $alias ? :
187 4 18 if ($node->{'_compare'})
191 0 4 unless $VALID_OPS{$sql_op}
194 2 2 if $c->{'left'}->isa("SQL::Wizard::Expr::Select")
195 0 4 if $c->{'right'}->isa("SQL::Wizard::Expr::Select")
200 0 18 if ($node->{'_truncate'})
202 0 0 unless $table =~ /^(\w+\.)*\w+$/
208 7 11 if ($node->{'_subquery'})
214 2 9 if ($node->{'_between'} or $node->{'_not_between'})
216 1 1 $node->{'_between'} ? :
224 1 8 if ($node->{'_cast'})
226 0 1 unless $type =~ /^\w[\w\s(),]*$/
233 2 6 if ($node->{'_logic'})
244 2 0 if @parts > 1
249 1 5 if ($node->{'_not'})
261 4 24 if ($node->{'expr'}->isa("SQL::Wizard::Expr::Select"))
271 2 4 if $node->{'nulls'}
303 4 142 if ($node->{'_cte'})
311 60 86 unless $node->{'columns'}
316 2 144 $node->{'distinct'} ? :
320 146 0 if ($node->{'from'})
322 12 134 ref $node->{'from'} eq 'ARRAY' ? :
325 12 146 if (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr::Join')) { }
332 146 0 if ($i == 0) { }
344 78 68 if ($node->{'where'})
346 75 2 if (defined $wsql and $wsql ne "")
353 7 138 if ($node->{'group_by'})
354 0 7 ref $node->{'group_by'} eq 'ARRAY' ? :
365 3 142 if ($node->{'having'})
367 1 2 if (defined $hsql and $hsql ne "")
374 2 143 if ($node->{'window'})
377 0 2 unless $name =~ /^\w+$/
387 7 138 if ($node->{'order_by'})
388 3 4 ref $node->{'order_by'} eq 'ARRAY' ? :
391 2 6 if (ref $o eq 'HASH') { }
0 6 elsif (not ref $o and $o =~ /^-(.+)/) { }
4 2 elsif (not ref $o) { }
396 2 0 unless ref $col
421 4 141 if (defined $node->{'limit'})
426 3 142 if (defined $node->{'offset'})
446 12 1 if (defined $node->{'on'})
447 1 11 if (ref $node->{'on'} eq 'HASH') { }
471 1 5 if ($node->{'operand'})
478 2 7 if ($node->{'operand'}) { }
493 5 1 if (defined $node->{'else'})
510 4 5 if ($spec->{'name'})
511 0 4 unless $spec->{'name'} =~ /^\w+$/
525 6 1 if ($spec->{'-partition_by'})
527 1 5 ref $spec->{'-partition_by'} eq 'ARRAY' ? :
537 7 0 if ($spec->{'-order_by'})
539 3 4 ref $spec->{'-order_by'} eq 'ARRAY' ? :
542 3 4 if (ref $o eq 'HASH') { }
0 4 elsif (not ref $o and $o =~ /^-(.+)/) { }
4 0 elsif (not ref $o) { }
546 3 0 unless ref $col
569 1 6 if ($spec->{'-frame'})
586 11 9 if ($entry->{'type'})
594 1 8 if ($node->{'order_by'})
595 0 1 ref $node->{'order_by'} eq 'ARRAY' ? :
598 0 1 if (ref $o eq 'HASH') { }
0 1 elsif (not ref $o and $o =~ /^-(.+)/) { }
1 0 elsif (not ref $o) { }
602 0 0 unless ref $col
624 1 8 if (defined $node->{'limit'})
629 0 9 if (defined $node->{'offset'})
645 1 3 $node->{'recursive'} ? :
654 1 4 if (ref $query eq 'HASH' and $query->{'-initial'}) { }
679 1 6 if ($node->{'select'}) { }
5 1 elsif (ref $node->{'values'} eq 'HASH') { }
1 0 elsif (ref $node->{'values'} eq 'ARRAY') { }
681 1 0 if ($node->{'columns'})
703 1 0 if ($node->{'columns'})
721 1 6 if ($node->{'on_conflict'})
738 1 6 if ($node->{'on_duplicate'})
750 1 6 if ($node->{'returning'})
766 1 5 if (ref $node->{'table'} eq 'ARRAY') { }
769 1 1 if (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr::Join')) { }
797 1 5 if ($node->{'from'})
798 1 0 ref $node->{'from'} eq 'ARRAY' ? :
809 5 1 if ($node->{'where'})
811 5 0 if (defined $ws and $ws ne "")
818 1 5 if (defined $node->{'limit'})
825 1 5 if ($node->{'returning'})
844 1 5 if ($node->{'using'})
850 5 1 if ($node->{'where'})
852 5 0 if (defined $ws and $ws ne "")
859 1 5 if ($node->{'returning'})
873 1 114 if (builtin::blessed($where) and $where->isa("SQL::Wizard::Expr"))
878 101 13 if (ref $where eq "HASH")
885 0 103 if (builtin::blessed($key) and $key->isa("SQL::Wizard::Expr"))
896 2 101 if (not defined $val) { }
8 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') { }
908 1 1 if (not @$val) { }
913 0 3 if (builtin::blessed($v) and $v->isa('SQL::Wizard::Expr')) { }
933 12 1 if (ref $where eq "ARRAY")
945 42 0 if (ref $val eq "HASH")
953 1 41 unless $VALID_OPS{$sql_op}
956 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')) { }
957 5 5 $sql_op eq '-NOT_IN' ? :
958 4 6 if (builtin::blessed($rhs) and $rhs->isa('SQL::Wizard::Expr')) { }
6 0 elsif (ref $rhs eq 'ARRAY') { }
963 2 4 if (not @$rhs) { }
965 1 1 $neg ? :
969 0 9 if (builtin::blessed($v) and $v->isa('SQL::Wizard::Expr')) { }
982 2 1 if ($sql_op eq '!=' or $sql_op eq '<>') { }
989 1 2 if $rhs->isa("SQL::Wizard::Expr::Select")
1015 6 17 if (not ref $item and $item =~ /^-(and|or)$/i)
1019 4 2 if ($i <= $#items and ref $items[$i] eq "ARRAY")
1028 11 6 if (ref $item eq 'HASH') { }
1 5 elsif (ref $item eq 'ARRAY') { }
5 0 elsif (builtin::blessed($item) and $item->isa('SQL::Wizard::Expr')) { }
1046 6 11 if @parts > 1