Condition Coverage

lib/DB/Handy.pm
Criterion Covered Total %
condition 403 704 57.2


and 3 conditions

line !l l&&!r l&&r condition
167 0 0 6 $size and $size > 0
199 0 0 3 $sch and $sch->{'indexes'}
306 2785 11 14 !defined($row->{$cn}) || $row->{$cn} eq '' and defined $sch->{'defaults'}{$cn}
311 6 1 32 defined $row->{$cn} and $row->{$cn} ne ""
354 0 10 70 defined $n and $n == $recsize
397 0 2 17 defined $n and $n == $recsize
707 0 4 28 defined $n and $n == $recsize
728 3 0 0 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/
781 25 0 27 $sql =~ /\(\s*SELECT\b/i and $iter++ < $max_depth
926 25 4 1486 $j < $len and $depth > 0
940 0 1 2 $depth > 1 and $p2 =~ /^SELECT\b/i
948 0 2 27 $depth == 0 and not $has_nested
1086 334 0 0 $ch eq "'" and not $in_str
334 0 0 $ch eq "'" and $in_str
266 60 0 $depth == 0 and substr($expr, $i, 5) =~ /^AND\s/i
1126 0 0 6 $conds and @$conds
1145 28 6 2 $plain_sub and not &$plain_sub($row)
1152 0 0 28 $res && $res->{'type'} eq 'rows'
1166 0 0 0 $col_val =~ /^-?\d+\.?\d*$/ && $rv =~ /^-?\d+\.?\d*$/
1172 0 0 0 $found and $op eq "NOT_IN"
1173 0 0 0 not $found and $op eq "IN"
1188 0 0 4 $lhs =~ /^-?\d+\.?\d*$/ && $rhs =~ /^-?\d+\.?\d*$/
1313 0 0 17 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/
1340 0 0 0 $w =~ /^$alias\.(\w+)$/ and exists $r->{$1}
1392 204 0 0 $ch eq "'" and not $in_str
204 0 0 $ch eq "'" and $in_str
1476 0 1877 296906 defined $n and $n == $entry_size
1519 29 0 9 $pos < @$entries and $entries->[$pos][0] eq $key_bytes
1540 0 0 17 $pos < @$entries and $entries->[$pos][0] eq $key_bytes
1561 21 0 19 not $lo_inc and $lo_pos < @$entries
21 10 9 not $lo_inc and $lo_pos < @$entries and $entries->[$lo_pos][0] eq $lo_key
1567 4 1 36 $hi_inc and $p < @$entries
5 18 18 $hi_inc and $p < @$entries and $entries->[$p][0] eq $hi_key
1589 0 37 79 defined $n and $n == $recsize
1604 0 0 147 $conds and @$conds
1618 4 13 26 $pos < @$entries and $entries->[$pos][0] eq $key_bytes
1755 2 8 34 $pos < @$entries and $entries->[$pos][0] eq $key
1775 0 0 3 defined $recs and not defined $best_rng
1834 9 76 100 $pos < @$entries and $entries->[$pos][0] eq $key
1906 10 42 407 $pos < @$entries and $entries->[$pos][0] eq $key
1983 0 0 29 $js->{'on_left'} and $js->{'on_right'}
1994 0 0 29 defined $on_r_alias and defined $on_r_col
2022 127 0 0 $use_hash == 0 and not _join_row_matches($lr, $rr, $on_l_alias, $on_l_col, $on_r_alias, $on_r_col)
2099 0 0 54 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/
2121 0 2 25 $col_specs and @$col_specs
2193 0 56 311 defined $n and $n == $recsize
2233 0 0 0 defined $lv and defined $rv
2236 0 0 0 $lv =~ /^-?\d+\.?\d*$/ and $rv =~ /^-?\d+\.?\d*$/
2254 0 0 15 $conds and @$conds
2304 0 0 8 $lhs_val =~ /^-?\d+\.?\d*$/ && $cv =~ /^-?\d+\.?\d*$/
2310 4 4 0 $found and $op eq "NOT_IN"
2311 4 0 4 not $found and $op eq "IN"
2315 38 0 51 $lv =~ /^-?\d+\.?\d*$/ && $rv =~ /^-?\d+\.?\d*$/
2416 0 24 5 defined $type_kw and $type_kw =~ /LEFT/i
0 23 1 defined $type_kw and $type_kw =~ /RIGHT/i
0 22 1 defined $type_kw and $type_kw =~ /CROSS/i
2465 0 0 15 defined $expr and $expr =~ /\S/
2471 7 0 10 $part =~ /^((?:\w+\.)?\w+)\s*(=|!=|<>|<=|>=|<|>)\s*((?:\w+\.)?\w+)$/i and not $part =~ /'/
2681 2459 0 120 $ch eq "," and $depth == 0
2795 0 4 2 $conds and @$conds
2811 0 0 0 $rv =~ /^-?\d+\.?\d*$/ && $cv =~ /^-?\d+\.?\d*$/
2817 0 0 0 $found and $op eq "NOT_IN"
2818 0 0 0 not $found and $op eq "IN"
2825 0 0 0 defined $$row{$c->{'col'}} and $$row{$c->{'col'}} ne ""
2831 0 0 8 $rv =~ /^-?\d+\.?\d*$/ && defined $cv && $cv =~ /^-?\d+\.?\d*$/
2879 4296 0 0 $expr =~ /^\((.+)\)$/s and not $1 =~ /^\s*SELECT\b/i
2888 0 2 4 defined $v and $v ne ""
2896 0 0 2 defined $va and defined $vb
2897 0 0 2 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/
2988 0 0 22 defined $lv and defined $rv
2993 0 6 0 $opsym eq '/' || $opsym eq '%' and $r == 0
3025 0 0 0 defined $bv && defined $wv && ($bv =~ /^-?\d+\.?\d*$/ && $wv =~ /^-?\d+\.?\d*$/ ? $bv == $wv : $bv eq $wv)
3041 0 0 34 defined $lv and defined $rv
3042 0 0 34 $lv =~ /^-?\d+\.?\d*$/ && $rv =~ /^-?\d+\.?\d*$/
3052 0 0 0 defined $v && $v ne ''
3065 2687 17 17 $ch eq "'" and not $in_q
2687 0 17 $ch eq "'" and $in_q
2424 6 96 $ch eq "," and $d == 0
3104 39421 2 2 $ch eq "'" and not $in_q
39421 0 2 $ch eq "'" and $in_q
2 39419 0 not $in_q and $ch eq "("
2 39419 0 not $in_q and $ch eq ")"
2 0 39419 not $in_q and $d == 0
2 12785 26634 not $in_q and $d == 0 and $i > 0
3130 0 0 335 defined $expr and $expr =~ /\S/
3142 421 0 2 $expr =~ /^\((.+)\)$/s and not $1 =~ /^\s*SELECT\b/i
3159 11659 252 252 $ch eq "'" and not $in_q
11659 0 252 $ch eq "'" and $in_q
761 0 9910 $d == 0 and not $in_q
761 9759 151 $d == 0 and not $in_q and uc substr($expr, $i, $kl) eq $kw
9759 6 145 $d == 0 and not $in_q and uc substr($expr, $i, $kl) eq $kw and $i == 0 || substr($expr, $i - 1, 1) =~ /\s/
6 0 145 $d == 0 and not $in_q and uc substr($expr, $i, $kl) eq $kw and $i == 0 || substr($expr, $i - 1, 1) =~ /\s/ and $i + $kl < $len
6 16 129 $d == 0 and not $in_q and uc substr($expr, $i, $kl) eq $kw and $i == 0 || substr($expr, $i - 1, 1) =~ /\s/ and $i + $kl < $len and substr($expr, $i + $kl, 1) =~ /\s/
3306 0 0 50 $v =~ /^-?\d+\.?\d*$/ && $lo =~ /^-?\d+\.?\d*$/ && $hi =~ /^-?\d+\.?\d*$/
3307 6 8 36 $v >= $lo && $v <= $hi
0 0 0 $v ge $lo && $v le $hi
3318 36 0 1524 $rv =~ /^-?\d+\.?\d*$/ && $cv =~ /^-?\d+\.?\d*$/
3341 618 1327 0 $rhs_expr =~ /^[\w.]+$/ && !($rhs_expr =~ /^-?\d+\.?\d*$/)
3343 607 0 1338 $lv =~ /^-?\d+\.?\d*$/ && $rv =~ /^-?\d+\.?\d*$/
3429 0 0 0 $col =~ /^(\w+)\.(\w+)$/ && defined $row->{$2}
3468 3 0 0 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/
3474 1 0 0 defined $opts->{'offset'} and $opts->{'offset'} > 0
3496 143 0 147 $where_expr =~ /^(\w+)\s*(=|!=|<>|<=|>=|<|>)\s*(?:'([^']*)'|(-?\d+\.?\d*))$/ and not $where_expr =~ /\b(?:OR|AND|NOT|BETWEEN|IN)\b/i
3514 0 0 85 defined $n and $n == $rs
3540 0 0 95 defined $n and $n == $rs
3566 0 0 40 defined $n and $n == $rs
3589 0 0 90 defined $n and $n == $rs
3613 0 0 420 defined $n and $n == $rs
3633 0 263 1517 defined $n and $n == $rs
3650 0 0 408 defined $col_str and defined $rest
3656 80 328 0 $rest =~ /^\s+(\w+)/ and not $1 =~ /^(?:WHERE|GROUP|ORDER|HAVING|LIMIT|OFFSET|INNER|LEFT|RIGHT|JOIN|ON|UNION)$/i
3695 3261 8 8 $ch eq "'" and not $in_q
3261 0 8 $ch eq "'" and $in_q
27 3189 45 not $in_q and $ch eq "("
27 3144 45 not $in_q and $ch eq ")"
27 154 2990 not $in_q and $d == 0
181 2582 408 not $in_q and $d == 0 and uc substr($str, $i, 4) eq "FROM"
2736 0 408 not $in_q and $d == 0 and uc substr($str, $i, 4) eq "FROM" and $i == 0 || substr($str, $i - 1, 1) =~ /\s/
0 408 0 not $in_q and $d == 0 and uc substr($str, $i, 4) eq "FROM" and $i == 0 || substr($str, $i - 1, 1) =~ /\s/ and $i + 4 >= $len || substr($str, $i + 4, 1) =~ /\s/
3742 59 281 36 @$col_specs == 1 && $col_specs->[0][0] eq '*'
3755 65 0 214 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/
3815 0 25 141 defined $n and $n == $rs
3857 14 0 8 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/
3900 0 0 4 $a =~ /^-?\d+\.?\d*$/ && $b =~ /^-?\d+\.?\d*$/
3903 0 0 13 $a =~ /^-?\d+\.?\d*$/ && $b =~ /^-?\d+\.?\d*$/
3922 21311 99 99 $ch eq "'" and not $in_q
21311 0 99 $ch eq "'" and $in_q
488 0 20284 $d == 0 and not $in_q
488 20284 0 $d == 0 and not $in_q and $i == 0 || substr($sql, $i - 1, 1) =~ /\s/
3946 4206 0 4 uc substr($sql, $i, 5) eq "UNION" and $i + 5 < $len
4206 0 4 uc substr($sql, $i, 5) eq "UNION" and $i + 5 < $len and substr($sql, $i + 5, 1) =~ /[\s(]/
4190 0 16 uc substr($sql, $i, 9) eq "INTERSECT" and $i + 9 < $len
4190 0 16 uc substr($sql, $i, 9) eq "INTERSECT" and $i + 9 < $len and substr($sql, $i + 9, 1) =~ /[\s(]/
4178 0 12 uc substr($sql, $i, 6) eq "EXCEPT" and $i + 6 < $len
4178 0 12 uc substr($sql, $i, 6) eq "EXCEPT" and $i + 6 < $len and substr($sql, $i + 6, 1) =~ /[\s(]/
3962 0 32 32 $i < $len and substr($sql, $i, 1) =~ /\s/
3964 28 0 4 $kw eq "UNION" and $i + 3 <= $len
28 2 2 $kw eq "UNION" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL"
2 0 2 $kw eq "UNION" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL" and $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
14 0 16 $kw eq "INTERSECT" and $i + 3 <= $len
14 14 2 $kw eq "INTERSECT" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL"
14 2 0 $kw eq "INTERSECT" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL" and $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
16 0 12 $kw eq "EXCEPT" and $i + 3 <= $len
16 9 3 $kw eq "EXCEPT" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL"
9 3 0 $kw eq "EXCEPT" and $i + 3 <= $len and uc substr($sql, $i, 3) eq "ALL" and $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
3969 0 2 2 $i < $len and substr($sql, $i, 1) =~ /\s/
3976 0 2 2 $i < $len and substr($sql, $i, 1) =~ /\s/
3983 0 3 3 $i < $len and substr($sql, $i, 1) =~ /\s/
4041 20 2 33 $in_rhs{$k} and not $seen{$k}++
4121 0 17 77 defined $x and $x == $rs
4132 5 1 4 $ix->{'unique'} and exists $$set_exprs{$ix->{'col'}}
4156 0 1 0 defined $row->{$cn} and $row->{$cn} ne ""
4236 0 25 0 $database and !defined($opts->{'AutoUse'}) || $opts->{'AutoUse'}
4255 0 23 2 defined $dsn and $dsn =~ /[=;]/
4277 0 0 145 defined $sql and $sql =~ /\S/
4420 14 133 2 not @bind and @{$self->{'_bind_params'};}
4460 0 17 56 defined $res->{'message'} and $res->{'message'} =~ /(\d+)\s+row/
4490 0 1 67 $data && @$data
4507 646 2 41 $ch eq "," and $depth == 0

or 2 conditions

line l !l condition
73 36 0 $args{'base_dir'} || 'simpledbms_data'
0 36 $args{'db_name'} || ''
776 29 0 $outer_row ||= {}
1131 4 2 $c->{'type'} || ''
1264 0 1 $2 || 'ASC'
1305 1 0 $outer_opts{'order_dir'} || 'asc'
1313 0 0 $va || ''
0 0 $vb || ''
1322 0 4 $outer_opts{'offset'} || 0
1426 1292 1 $val || 0
1952 27 0 $opts ||= {}
1953 27 0 $where_conds ||= []
1979 29 0 $js->{'type'} || 'INNER'
2020 121 24 $right_hash{$lkey} || []
2033 27 5 $right_hash{$lkey} || []
2093 5 0 $opts->{'order_dir'} || 'asc'
2099 0 0 $va || ''
0 0 $vb || ''
2110 1 26 $opts->{'offset'} || 0
2382 1 5 $2 || 'ASC'
2621 1810 18 $v || 0
2935 0 0 eval_expr($a[1], $row) || 0
2962 1 0 eval_expr($ste, $row) || 1
2964 1 0 eval_expr($le, $row) || 0
3464 1 0 $opts->{'order_dir'} || 'asc'
4052 5 3 $rhs_cnt{$k} || 0
3 5 $used{$k} || 0
4077 10 4 $rhs_cnt{$k} || 0
6 8 $removed{$k} || 0
4231 25 0 $database || ''
1 24 $opts->{'RaiseError'} || 0
4257 1 0 $p{'base_dir'} || $p{'dir'} || '.'
4454 67 1 $n || '0E0'
4468 56 17 $affected || '0E0'

or 3 conditions

line l !l&&r !l&&!r condition
306 22 3 2785 !defined($row->{$cn}) || $row->{$cn} eq ''
357 0 12 53 not $where_sub or &$where_sub($row)
498 10 1 84 %nn or %defs
11 0 84 %nn or %defs or %chks
1 0 84 %nn or %defs or %chks or defined $pk
810 0 0 23 not $inner_res or $inner_res->{'type'} eq "error"
819 12 0 11 $prefix =~ /\bIN\s*$/i or $prefix =~ /\bNOT\s+IN\s*$/i
1154 0 0 8 $op eq "IN" or $op eq "NOT_IN"
1189 0 0 4 $cop eq "!=" or $cop eq "<>"
1275 0 0 4 not $inner_res or $inner_res->{'type'} eq "error"
1350 0 0 0 $k =~ /\.\Q$w\E$/ or $k eq $w
1674 2 7 1 $op1 eq ">" or $op1 eq ">="
1713 27 0 0 $part =~ /^(\w+)\s*($OP)\s*($VAL)$/ or $part =~ /^($VAL)\s*($OP)\s*(\w+)$/
1726 0 0 0 $rev{uc $2} || uc $2
1748 0 0 13 $op eq "!=" or $op eq "<>"
1898 0 0 57 $op eq "!=" or $op eq "<>"
1972 27 0 0 defined $cur_rows[0] or not $self->{'_last_err'}
2006 1 0 28 $join_type eq "CROSS" or not defined $on_l_alias
2163 0 0 0 $k =~ /\.\Q$ck\E$/ or $k eq $ck
2268 0 0 0 $k =~ /\.\Q$c->{'lhs_col'}\E$/ or $k eq $c->{'lhs_col'}
2284 0 0 0 $k =~ /\.\Q$c->{'rhs_col'}\E$/ or $k eq $c->{'rhs_col'}
2299 8 0 89 $op eq "IN" or $op eq "NOT_IN"
2317 0 0 12 $op eq "!=" or $op eq "<>"
2802 0 0 8 $op eq "IN" or $op eq "NOT_IN"
2822 0 0 0 not defined $$row{$c->{'col'}} or $$row{$c->{'col'}} eq ""
2832 0 0 4 $op eq "!=" or $op eq "<>"
2993 0 6 0 $opsym eq '/' || $opsym eq '%'
3052 0 0 0 !defined($v) || $v eq ''
3159 12 133 6 $i == 0 || substr($expr, $i - 1, 1) =~ /\s/
3301 9 1 404 $op eq "BETWEEN" or $op eq "NOT_BETWEEN"
3311 41 6 357 $op eq "IN" or $op eq "NOT_IN"
3327 4 1 352 $op eq "LIKE" or $op eq "NOT_LIKE"
3377 1 0 26 @gb_join || $having_join ne '' || $has_agg
3489 11 14 383 @$gb || $having ne '' || grep({$_->[0] =~ /\b(?:COUNT|SUM|AVG|MIN|MAX)\s*\(/is;} @$col_specs)
3517 0 85 0 not $wsub or &$wsub($row)
3543 0 95 0 not $wsub or &$wsub($row)
3569 0 25 15 not $wsub or &$wsub($row)
3592 0 90 0 not $wsub or &$wsub($row)
3616 0 420 0 not $wsub or &$wsub($row)
3636 371 323 812 not $ws or &$ws($row)
3695 0 408 0 $i == 0 || substr($str, $i - 1, 1) =~ /\s/
0 408 0 $i + 4 >= $len || substr($str, $i + 4, 1) =~ /\s/
3818 107 10 15 not $ws or &$ws($row)
3922 466 3744 16074 $i == 0 || substr($sql, $i - 1, 1) =~ /\s/
3964 0 2 0 $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
0 2 0 $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
0 3 0 $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/
4021 2 0 30 $sep eq "UNION" or $sep eq ""
4066 17 2 15 $in_rhs{$k} or $seen{$k}++
4124 4 31 41 not $ws or &$ws($row)
4236 24 0 1 !defined($opts->{'AutoUse'}) || $opts->{'AutoUse'}
4243 0 0 0 $DB::Handy::errstr || $res->{'message'}
4258 1 0 0 $p{'database'} || $p{'db'} || $database