Branch Coverage

blib/lib/SQL/YASP.pm
Criterion Covered Total %
branch 64 474 13.5


line true false branch
104 0 0 unless $self->tree_create($stmt, @$tokens)
0 1 if ($cmd eq 'create') { }
1 0 elsif ($cmd eq 'select') { }
0 0 elsif ($cmd eq 'insert') { }
0 0 elsif ($cmd eq 'update') { }
0 0 elsif ($cmd eq 'delete') { }
0 0 elsif ($opts{'allow_unknown_command'}) { }
105 0 1 unless $self->tree_select($stmt, @$tokens)
109 0 0 unless $self->tree_insert($stmt, @$tokens)
113 0 0 unless $self->tree_update($stmt, @$tokens)
117 0 0 unless $self->tree_delete($stmt, @$tokens)
148 0 0 if ($$stmt{'create_type'} eq 'table')
176 0 0 if (exists $$self{'non_fields'}{'create'} and exists $$self{'non_fields'}{'create'}{$fieldargs[0]})
201 0 0 if ($arg eq 'not')
241 0 1 unless defined $unset
285 0 0 if ($$unset{'into'})
287 0 0 unless get_set_fields($stmt, $$unset{'into'}, $unset)
315 0 0 unless get_set_fields($stmt, $opener, $unset)
331 0 0 if (not $$stmt{'set'} and $$unset{'values'})
338 0 0 if (@fields != @exprs)
371 1 0 if (@def == 1) { }
0 0 elsif (@def >= 3 and $def[-2] eq 'as') { }
377 0 1 if ($def[0] eq '*' and $$stmt{'table_definitions'}) { }
429 1 0 unless exists $$self{'lukas'}
430 1 0 unless exists $$self{'type_fix'}
431 1 0 unless exists $$self{'perl_regex'}
432 1 0 unless exists $$self{'star_comments'}
433 1 0 unless exists $$self{'dash_comments'}
434 1 0 unless exists $$self{'pound_comments'}
435 1 0 unless exists $$self{'!_is_not'}
436 1 0 unless exists $$self{'backslash_escape'}
437 1 0 unless exists $$self{'dquote_escape'}
438 1 0 unless exists $$self{'field_braces'}
476 0 1 unless ((my $class = ref $self) eq 'SQL::YASP')
480 0 0 unless @isa
481 0 0 unless @isa
485 0 0 unless @isa
486 0 0 unless @isa
507 1 0 unless (ref $self)
516 0 1 if $$self{'keep_org_sql'}
532 0 1 unless $self->build_tree($rv, \@tokens, %opts)
551 1 0 unless (exists $opts{$$els[0]})
562 0 2 if ($opts{$sname} == 1) { }
0 2 elsif ($opts{$sname} == 6) { }
1 1 elsif ($opts{$sname} == 7) { }
0 1 elsif ($opts{$sname} == 2) { }
0 1 elsif ($opts{$sname} == 8) { }
1 0 elsif ($opts{$sname} == 3) { }
0 0 elsif ($opts{$sname} == 4) { }
0 0 elsif ($opts{$sname} == 5) { }
580 0 1 if ref $def
586 0 1 if (@{$table_def;}) { }
599 1 0 if (keys %$tdefs == 1)
603 1 0 if ($key eq $val)
622 0 0 if ($$expr[-1] eq 'desc')
686 0 0 unless @{$arr;}
687 0 0 unless ref $$arr[0]
690 0 0 unless defined $opts{'arg_name'}
716 0 1 ref $sql ? :
717 1 0 unless defined $i
725 0 41 if (defined $inquote) { }
0 41 elsif ($inlinecomment) { }
0 41 elsif ($instar) { }
0 41 elsif ($char eq '-' and $$self{'dash_comments'} and $chars[$i] eq '-') { }
0 41 elsif ($char eq '#' and $$self{'pound_comments'}) { }
0 41 elsif ($char eq '/' and $$self{'star_comments'} and $chars[$i] eq '*') { }
0 41 elsif ($$self{'field_braces'} and $char eq '[') { }
0 41 elsif ($quotes{$char}) { }
0 41 elsif ($char eq '=' and $$self{'perl_regex'} and $chars[$i] and $chars[$i] eq '~') { }
0 41 elsif ($char eq '(') { }
0 41 elsif ($char eq ')') { }
727 0 0 if ($char eq '\\' and $$self{'backslash_escape'}) { }
0 0 elsif ($char eq $inquote) { }
735 0 0 if (not $inregex and defined $chars[$i] and $chars[$i] eq $inquote and $$self{'dquote_escape'}) { }
744 0 0 if ($inregex) { }
769 0 0 unless $char =~ /[\n\r]/
775 0 0 if ($char eq '*' and $chars[$i] eq '/')
863 0 1 $$self{'field_braces'} ? :
0 1 if (ref $el or $$self{'field_braces'} ? $el =~ /^['"\[]/ : $el =~ /^['"]/) { }
1 0 elsif (length $el) { }
884 8 0 unless (ref $el or $el =~ /^['"]/)
885 0 8 if ($el eq '?') { }
0 8 elsif ($el eq '!' and $$self{'!_is_not'}) { }
917 7 0 unless (ref $el)
918 0 7 if ($$dtokens{$el})
919 0 0 if (not ref $rv[$i + 1] and exists $$dtokens{$el}{$rv[$i + 1]})
963 0 0 if ($rv =~ s/^'(.*)'$/$1/s) { }
0 0 elsif ($rv =~ s/^"(.*)"$/$1/s) { }
1012 0 3 unless ref $outer
1013 0 3 if $opts{'max'}
1018 0 2 $opts{'max'} ? :
2 7 if (not ref $el and exists $dels{$el} and $opts{'max'} ? @rv < $opts{'max'} : 1) { }
1019 0 2 if ($opts{'keep_del_back'})
1022 2 0 if ($firstdone or @current)
1028 2 0 if ($opts{'keep_del_front'})
1038 3 0 if wantarray
1060 0 0 if wantarray
1073 0 2 unless tie %hash, 'Tie::IxHash'
1108 0 0 if (ref $arg) { }
1110 0 0 if (UNIVERSAL::isa($arg, 'HASH') and $$arg{'placeholder'}) { }
1117 0 0 if (@rv and $arg ne ',')
1132 0 0 ref $_[0] ? :
1149 0 1 if (defined $sql)
1169 0 0 unless $opts{'db_record'}
1173 0 0 if ($n eq '*') { }
1180 0 0 unless $v->evalexpr($sendopts, $val)
1186 0 0 if (exists $opts{'set'})
1190 0 0 if ($_[$i] eq 'set')
1289 0 0 if (ref $_[1]) { }
1298 0 0 if (exists $$opts{'set'})
1303 0 0 if ($_[$i] eq 'set')
1314 0 0 if (UNIVERSAL::isa($org_args, 'HASH'))
1321 0 0 if (UNIVERSAL::isa($org_args, 'ARRAY')) { }
0 0 elsif (ref $org_args) { }
1347 0 0 unless (@args)
1353 0 0 if (@args == 1)
1355 0 0 unless defined $arg
1358 0 0 if (UNIVERSAL::isa($arg, 'HASH'))
1360 0 0 if ($$arg{'placeholder'}) { }
1361 0 0 if ($$opts{'params'} and @{$$opts{'params'};}) { }
1363 0 0 if ($$arg{'index'} > $#{$$opts{'params'};})
1382 0 0 if (UNIVERSAL::isa($arg, 'ARRAY'))
1386 0 0 if ($$parser{'field_braces'} and $arg =~ /^\[.+\]$/s)
1391 0 0 unless ($$opts{'db_record'})
1401 0 0 if ($$parser{'normalize_fields'})
1411 0 0 if ($$opts{'assume_fields'} or exists $$opts{'db_record'}{$field_name}) { }
1427 0 0 if ($$funcs{$arg}) { }
0 0 elsif ($$opts{'db_record'} and $$parser{'field_braces'} != 2 and exists $$opts{'db_record'}{$arg}) { }
0 0 elsif ($$opts{'const'} and exists $$opts{'const'}{$arg}) { }
0 0 elsif ($arg =~ /^['"]/) { }
0 0 elsif (is_numeric($arg)) { }
1472 0 0 if (not ref $carg and $$bg{$carg})
1478 0 0 if ($$funcs{$carg} and $i > 1 and exists $allops{$args[$i - 1]})
1493 0 0 if ($left[-1] eq 'not')
1499 0 0 if ($argtype == 2) { }
1506 0 0 unless evalexpr(\@left, $opts, $a)
1507 0 0 unless evalexpr([@args[$i + 1 .. $#args]], $opts, $b)
1511 0 0 if ($lukas) { }
0 0 elsif ($typefix) { }
1512 0 0 unless ($argtype == 4 or defined $a and defined $b)
1523 0 0 if ($argtype == 3) { }
0 0 elsif ($argtype == 0) { }
1529 0 0 unless defined $a
1530 0 0 unless defined $b
1538 0 0 $rv ? :
0 0 if $rettype == 1
1539 0 0 if $not
1548 0 0 if (my $function = $$funcs{$args[0]})
1552 0 0 if ($argtype == 1)
1563 0 0 if ($argtype == 2)
1572 0 0 unless evalexpr($arg, $opts, $arg)
1576 0 0 if (not $argtype) { }
0 0 elsif ($argtype == 4) { }
0 0 elsif ($argtype == 3) { }
1577 0 0 unless defined $_
0 0 if $typefix
1588 0 0 if $typefix
1610 0 0 if ($SQL::YASP::err)
1611 0 0 unless ($setval)
1618 0 0 if ($setval)
1638 0 0 if exists $$self{'comparetype'}
1648 0 0 unless $defs = $opts{'defs'}
1659 0 0 unless (@args)
1665 0 0 if (@args == 1)
1667 0 0 unless defined $arg
1670 0 0 if (UNIVERSAL::isa($arg, 'HASH'))
1675 0 0 if (UNIVERSAL::isa($arg, 'ARRAY'))
1679 0 0 if ($$funcs{$arg}) { }
0 0 elsif (exists $$defs{$arg}) { }
0 0 elsif ($opts{'const'} and exists $opts{'const'}{$arg}) { }
0 0 elsif ($arg =~ /^['"]/) { }
0 0 elsif (is_numeric($arg)) { }
1682 0 0 if defined $$func{'c'}
1720 0 0 if (not ref $carg and $$bg{$carg})
1722 0 0 if defined $$subdef{'c'}
1732 0 0 if (my $function = $$funcs{$args[0]})
1733 0 0 if $$function{'c'}
1749 0 0 unless $rv and $rv == 1
1750 0 0 $_[1] ? :
1774 0 0 if defined $_[0] and not ref $_[0]
1782 0 0 unless is_numeric($_[0])
1798 0 0 unless (defined $min and defined $max)
1801 0 0 unless evalexpr($expr, $opts, $expr)
1802 0 0 unless evalexpr($min, $opts, $min)
1803 0 0 unless evalexpr($max, $opts, $max)
1815 0 0 unless evalexpr($left, $opts, $left)
1817 0 0 unless $left
0 0 if (defined $left or not $$opts{'parser'}{'lukas'})
1820 0 0 unless evalexpr($right, $opts, $right)
1821 0 0 if $right and not defined $left
1875 0 0 unless evalexpr($arga, $opts, $arga)
1880 0 0 if ($$argb[$i] eq 'escape')
1883 0 0 unless evalexpr(\@clause, $opts, $esc)
1891 0 0 unless evalexpr($argb, $opts, $argb)
1902 0 0 if $bonusopts{'i'}
1923 0 0 unless evalexpr($arg1, $opts, $arg1)
1928 0 0 if (@arg2 == 1 and $arg2[0] eq 'null')
1930 0 0 if (@arg2 == 2 and $arg2[0] eq 'not' and $arg2[1] eq 'null')
1956 0 0 if $$rx{'params'}
1970 0 0 unless evalexpr($arg1, $opts, $arg1)
1971 0 0 if $ci
1975 0 0 unless evalexpr($choice, $opts, $choice)
1976 0 0 if $ci
1977 0 0 if $arg1 eq $choice
2048 0 0 if $_[0]{'parser'}{'lukas'} and not defined $_[1]
2049 0 0 $_[1] ? :
2101 0 0 unless evalexpr($expr, $opts, $val)
2103 0 0 if ($val)
2104 0 0 unless evalexpr($true, $opts, $val)
2108 0 0 unless ($false and @{$false;})
2111 0 0 unless evalexpr($false, $opts, $val)
2134 0 0 unless defined $sep
2142 0 0 if defined $_
2151 0 0 unless my $fh = 'FileHandle'->new($_[1])
2175 0 0 if $_[1] >= 0
2176 0 0 $_[1] =~ /\.0*[1-9]/ ? :
2182 0 0 if $_[1] <= 0
2183 0 0 $_[1] =~ /\.0*[1-9]/ ? :
2285 0 0 unless ($str)
2286 0 0 unless evalexpr($left, $opts, $str)
2292 0 0 unless evalexpr($str, $opts, $str)
2307 0 0 unless ($leading or $trailing)
2311 0 0 if (@args) { }
2312 0 0 unless evalexpr(\@args, $opts, $regex)
2318 0 0 if $leading
2319 0 0 if $trailing
2331 0 0 unless @padstr
2349 0 0 unless @padstr
2368 0 0 unless evalexpr($str, $opts, $str)
2369 0 0 unless evalexpr($pos, $opts, $pos)
2371 0 0 unless evalexpr($len, $opts, $len)
0 0 if ($len) { }
2389 0 0 if ($count < 0)
2395 0 0 if $reverse
2397 0 0 if (@arr > $count)
2400 0 0 if $reverse
2421 0 0 if (lc $_[$i] eq $val)