Branch Coverage

lib/DB/Handy.pm
Criterion Covered Total %
branch 1127 1748 64.4


line true false branch
35 0 11 if ($] < "5.006")
37 1 10 if $INC[-1] eq "."
78 10 21 unless (-d $self->{'base_dir'})
82 0 10 if ($@)
96 1 10 if (-d $path)
103 0 10 if ($@)
113 3 30 unless (-d $path)
125 0 1 unless (-d $path)
132 0 1 if ($@)
136 1 0 if $self->{'db_name'} eq $db_name
144 0 4 unless (opendir DH, $base)
145 4 8 if not /^\./
155 1 66 unless $self->{'db_name'}
157 0 66 if -f $sch_file
164 0 165 unless exists $TYPE_SIZE{$type}
166 3 162 if ($type eq 'CHAR') { }
60 102 elsif ($type eq 'VARCHAR') { }
167 0 3 unless $size and $size > 0
181 0 66 unless open FH, "> $sch_file"
190 0 66 unless open FH, '> ' . $self->_file($table, "dat")
197 0 3 unless $self->{'db_name'}
199 3 0 if ($sch and $sch->{'indexes'})
202 1 0 if -f $f
207 6 3 if -f $f
211 3 0 if (opendir DH, $dir)
213 0 26 if $f =~ /^\Q$table\E\.[^.]+\.idx$/
223 0 6 unless $self->{'db_name'}
226 0 6 unless opendir DH, $dir
227 22 37 /^(.+)\.sch$/ ? :
234 0 5 unless my $sch = $self->_load_schema($table)
243 0 15 unless $self->{'db_name'}
244 0 15 unless my $sch = $self->_load_schema($table)
247 0 15 unless $col_def
248 0 15 if $sch->{'indexes'}{$idxname}
250 7 8 $unique ? :
254 0 15 unless open FH, ">> $sch_file"
271 0 1 unless $self->{'db_name'}
272 0 1 unless my $sch = $self->_load_schema($table)
273 0 1 unless $sch->{'indexes'}{$idxname}
282 0 1 unless $self->{'db_name'}
283 0 1 unless my $sch = $self->_load_schema($table)
292 0 694 unless $self->{'db_name'}
293 1 693 unless my $sch = $self->_load_schema($table)
297 318 14 unless $ix->{'unique'}
299 5 9 if ($self->_idx_lookup_exact($table, $ix, $val) >= 0)
306 14 1180 if (!defined($row->{$cn}) || $row->{$cn} eq '' and defined $sch->{'defaults'}{$cn})
310 0 688 unless $sch->{'notnull'}
311 7 32 unless defined $row->{$cn} and $row->{$cn} ne ""
313 0 681 unless $sch->{'checks'}
314 3 7 unless eval_bool($sch->{'checks'}{$cn}, $row)
316 0 678 unless my $packed = $self->_pack_record($sch, $row)
319 0 678 unless open FH, ">> $dat"
336 0 10 unless $self->{'db_name'}
337 0 10 unless my $sch = $self->_load_schema($table)
344 0 10 unless open FH, "+< $dat"
354 10 70 unless defined $n and $n == $recsize
355 65 5 if (substr($raw, 0, 1) ne "\0")
357 12 53 if (not $where_sub or &$where_sub($row))
379 0 2 unless $self->{'db_name'}
380 0 2 unless my $sch = $self->_load_schema($table)
386 0 2 unless open IN_FH, "< $dat"
388 0 2 unless (open OUT_FH, "> $tmp")
397 2 17 unless defined $n and $n == $recsize
398 13 4 if (substr($raw, 0, 1) ne "\0")
406 0 2 unless rename $tmp, $dat
409 0 3 unless $self->_rebuild_index($table, $ix->{'name'})
425 28 1137 if ($sql =~ /\(\s*SELECT\b/i)
430 28 0 if ($sql =~ /^(?:SELECT|INSERT|UPDATE|DELETE)\b/i)
435 4 1133 if ($sql =~ /^CREATE\s+DATABASE\s+(\w+)$/i)
436 4 0 $self->create_database($1) ? :
440 26 1107 if ($sql =~ /^USE\s+(\w+)$/i)
441 24 2 $self->use_database($1) ? :
445 0 1107 if ($sql =~ /^DROP\s+DATABASE\s+(\w+)$/i)
446 0 0 $self->drop_database($1) ? :
450 1 1106 if ($sql =~ /^SHOW\s+DATABASES$/i)
453 1 1105 if ($sql =~ /^SHOW\s+TABLES$/i)
456 1 1104 if ($sql =~ /^SHOW\s+(?:INDEXES|INDICES|INDEX)\s+(?:ON|FROM)\s+(\w+)$/i)
458 1 0 defined $ixs ? :
462 2 1102 if ($sql =~ /^DESCRIBE\s+(\w+)$/i)
464 2 0 $cols ? :
468 67 1035 if ($sql =~ /^CREATE\s+TABLE\s+(\w+)\s*\((.+)\)$/is)
474 0 166 if ($cd =~ /^PRIMARY\s+KEY\s*\(\s*(\w+)\s*\)$/is)
479 63 103 if ($cd =~ /^(\w+)\s+(CHAR|VARCHAR)\s*\(\s*(\d+)\s*\)(.*)/is) { }
103 0 elsif ($cd =~ /^(\w+)\s+(\w+)(.*)/is) { }
490 0 166 unless defined $rest
491 1 165 if $rest =~ /\bPRIMARY\s+KEY\b/is
492 15 151 if $rest =~ /\b(?:NOT\s+NULL|PRIMARY\s+KEY)\b/is
493 3 4 defined $1 ? :
7 159 if $rest =~ /\bDEFAULT\s+(?:'([^']*)'|(-?\d+\.?\d*))/is
494 6 160 if $rest =~ /\bCHECK\s*\((.+)\)/is
496 1 66 if defined $pk
497 1 66 unless $self->create_table($tbl, [@cols])
498 0 55 if (%nn or %defs or %chks or defined $pk)
499 0 11 unless my $sch = $self->_load_schema($tbl)
503 1 10 if defined $pk
508 3 1032 if ($sql =~ /^DROP\s+TABLE\s+(\w+)$/i)
509 3 0 $self->drop_table($1) ? :
513 15 1017 if ($sql =~ /^CREATE\s+(UNIQUE\s+)?INDEX\s+(\w+)\s+ON\s+(\w+)\s*\(\s*(\w+)\s*\)$/i)
515 7 8 $uniq ? :
15 0 $self->create_index($idxname, $tbl, $col, $uniq ? 1 : 0) ? :
519 1 1016 if ($sql =~ /^DROP\s+INDEX\s+(\w+)\s+ON\s+(\w+)$/i)
520 1 0 $self->drop_index($1, $2) ? :
524 2 1014 if ($sql =~ /^VACUUM\s+(\w+)$/i)
526 2 0 defined $n ? :
530 684 330 if ($sql =~ /^INSERT\s+INTO\s+(\w+)\s*\(([^)]+)\)\s*VALUES\s*\((.+)\)$/i)
536 668 16 $self->insert($tbl, \%row) ? :
540 4 326 if ($sql =~ /^INSERT\s+INTO\s+(\w+)\s*\(([^)]+)\)\s+(SELECT\b.+)$/is)
548 4 0 if ($sel =~ /^SELECT\s+(.*?)\s+FROM\s+/is)
552 0 4 if $res->{'type'} eq "error"
563 10 0 @src_cols ? :
566 20 0 defined $src_keys[$i] ? :
568 10 0 if $self->insert($tbl, {%row})
572 291 35 if ($sql =~ /^SELECT\b/i)
575 25 10 if ($sql =~ /^UPDATE\s+(\w+)\s+SET\s+(.+?)(\s+WHERE\s+.+)?$/is)
576 24 1 defined $3 ? :
579 24 1 if ($wc =~ /\bWHERE\s+(.+)/is)
584 17 8 defined $n ? :
588 10 0 if ($sql =~ /^DELETE\s+FROM\s+(\w+)(.*)?$/is)
589 10 0 defined $2 ? :
591 10 0 if ($rest =~ /\bWHERE\s+(.+)/is)
596 10 0 defined $n ? :
628 4 28 if ($sql =~ /\bFROM\s*\(/i)
633 0 28 if ($sql =~ /^SELECT\s*\(/i)
639 0 28 if ref $expanded eq "HASH"
642 4 24 if ($expanded =~ /\(\s*SELECT\b/i)
657 0 4 unless ($sql =~ /^SELECT\s+(.+?)\s+FROM\s+(\w+)(.*)?$/i)
660 4 0 defined $3 ? :
662 0 4 unless my $sch = $self->_load_schema($tbl)
666 4 0 unless ($col_str =~ /^\*$/)
672 0 4 if ($rest =~ s/\bLIMIT\s+(\d+)//i)
675 0 4 if ($rest =~ s/\bOFFSET\s+(\d+)//i)
678 1 3 if ($rest =~ s/\bORDER\s+BY\s+(\w+)(?:\s+(ASC|DESC))?//i)
680 0 1 defined $2 ? :
685 4 0 if ($rest =~ /\bWHERE\s+(.+)/i)
700 0 4 unless open FH, "< $dat"
707 4 28 unless defined $n and $n == $recsize
708 28 0 if (substr($raw, 0, 1) ne "\0")
716 15 13 if &$filter({%qrow})
724 1 3 if (my $ob = $opts{'order_by'})
725 1 0 defined $opts{'order_dir'} ? :
728 3 0 defined $va ? :
3 0 defined $vb ? :
0 3 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/ ? :
732 0 3 $dir eq 'desc' ? :
737 0 4 defined $opts{'offset'} ? :
738 0 4 if $off
739 0 4 if (defined $opts{'limit'})
741 0 0 if $last > $#results
749 15 0 if (@sel_cols) { }
785 0 26 unless defined $pos
798 4 22 if (_subquery_is_correlated($inner_sql))
810 0 22 if (not $inner_res or $inner_res->{'type'} eq "error")
811 0 0 $inner_res ? :
815 0 22 unless $inner_res->{'data'}
819 11 11 if ($prefix =~ /\bIN\s*$/i or $prefix =~ /\bNOT\s+IN\s*$/i) { }
3 8 elsif ($prefix =~ /\b(?:EXISTS|NOT\s+EXISTS)\s*$/i) { }
825 15 0 defined $rv[0] ? :
826 15 0 if ($v =~ /^-?\d+\.?\d*$/) { }
833 9 2 if (@vals) { }
846 1 2 @inner_rows ? :
851 0 8 if (@inner_rows > 1)
854 1 7 if (@inner_rows == 0) { }
859 7 0 defined $rv[0] ? :
860 7 0 $v =~ /^-?\d+\.?\d*$/ ? :
883 26 0 if ($inner_sql =~ /\bFROM\s+(\w+)(?:\s+(?:AS\s+)?(\w+))?/i)
884 24 2 defined $2 ? :
888 0 0 defined $2 ? :
895 4 1 unless $inner_tables{$tbl}
914 29 2574 if (substr($sql, $i, 1) eq "(")
919 28 1 if ($peek =~ /^SELECT\b/i)
928 16 1442 if ($ch eq q[']) { }
1402 40 elsif (not $in_str) { }
934 3 1399 if ($ch eq '(') { }
31 1368 elsif ($ch eq ')') { }
940 2 1 if $depth > 1 and $p2 =~ /^SELECT\b/i
948 26 2 if ($depth == 0 and not $has_nested)
961 26 0 defined $best_start ? :
974 22 28 unless %$outer_row
981 264 0 defined $outer_row->{$qkey} ? :
982 200 64 $val =~ /^-?\d+\.?\d*$/ ? :
984 132 132 if (index($qkey, '.') != -1) { }
1027 3 3 if ($part =~ /^(NOT\s+)?EXISTS\s*\((.+)\)\s*$/is)
1030 1 2 $neg ? :
1039 0 3 if ($part =~ /^([\w.]+)\s+(NOT\s+)?IN\s*\((\s*SELECT\b.+)\)\s*$/is)
1042 0 0 $neg ? :
1052 1 2 if ($part =~ /^([\w.]+)\s*(=|!=|<>|<=|>=|<|>)\s*\((\s*SELECT\b.+)\)\s*$/is)
1066 2 0 if ($part =~ /^(\w+)\s*(=|!=|<>|<=|>=|<|>|LIKE)\s*(?:'([^']*)'|(-?\d+\.?\d*))$/i)
1068 0 2 defined $sv ? :
1086 0 334 if ($ch eq q['] and not $in_str) { }
0 334 elsif ($ch eq q['] and $in_str) { }
0 334 elsif ($in_str) { }
4 330 elsif ($ch eq '(') { }
4 326 elsif ($ch eq ')') { }
0 326 elsif ($depth == 0 and substr($expr, $i, 5) =~ /^AND\s/i) { }
1116 6 0 if $cur =~ /\S/
1126 0 6 unless $conds and @$conds
1131 4 2 if (($c->{'type'} || '') eq 'subquery') { }
1145 2 34 if $plain_sub and not &$plain_sub($row)
1152 28 0 $res && $res->{'type'} eq 'rows' ? :
1154 12 16 if ($op eq 'EXISTS') { }
8 8 elsif ($op eq 'NOT_EXISTS') { }
0 8 elsif ($op eq 'IN' or $op eq 'NOT_IN') { }
8 0 elsif ($op eq 'CMP') { }
1155 5 7 unless @rows
1158 4 4 if @rows
1161 0 0 defined $$row{$c->{'col'}} ? :
1165 0 0 defined $rv[0] ? :
1167 0 0 $num ? :
0 0 if ($num ? $col_val == $rv : $col_val eq $rv)
1172 0 0 if $found and $op eq "NOT_IN"
1173 0 0 if not $found and $op eq "IN"
1176 0 8 if @rows > 1
1178 4 4 if (@rows == 0) { }
1185 4 4 unless defined $rhs
1186 4 0 defined $$row{$c->{'col'}} ? :
1189 0 4 if ($cop eq '=') { }
0 4 elsif ($cop eq '!=' or $cop eq '<>') { }
0 4 elsif ($cop eq '<') { }
4 0 elsif ($cop eq '>') { }
0 0 elsif ($cop eq '<=') { }
0 0 elsif ($cop eq '>=') { }
1190 0 0 $num ? :
0 0 unless $num ? $lhs == $rhs : $lhs eq $rhs
1193 0 0 $num ? :
0 0 unless $num ? $lhs != $rhs : $lhs ne $rhs
1196 0 0 $num ? :
0 0 unless $num ? $lhs < $rhs : $lhs lt $rhs
1199 4 0 $num ? :
0 4 unless $num ? $lhs > $rhs : $lhs gt $rhs
1202 0 0 $num ? :
0 0 unless $num ? $lhs <= $rhs : $lhs le $rhs
1205 0 0 $num ? :
0 0 unless $num ? $lhs >= $rhs : $lhs ge $rhs
1224 0 4 unless ($sql =~ /^SELECT\s+(.+?)\s+FROM\s*\(/is)
1232 0 4 unless ($paren_start >= 0)
1237 0 4 unless (defined $inner_sql)
1247 4 0 if ($after =~ s/^(?:AS\s+)?(\w+)\s*//i) { }
1256 1 3 if ($after =~ s/\bLIMIT\s+(\d+)//i)
1259 0 4 if ($after =~ s/\bOFFSET\s+(\d+)//i)
1262 1 3 if ($after =~ s/\bORDER\s+BY\s+([\w.]+)(?:\s+(ASC|DESC))?//i)
1268 2 2 if ($after =~ /\bWHERE\s+(.+)/i)
1275 0 4 if (not $inner_res or $inner_res->{'type'} eq "error")
1276 0 0 $inner_res ? :
1280 0 4 unless $inner_res->{'data'}
1289 0 40 $k =~ /\.(\w+)$/ ? :
1297 2 2 if ($outer_where_str =~ /\S/)
1304 1 3 if (my $ob = $outer_opts{'order_by'})
1309 17 0 defined $DB::Handy::a->{$ob} ? :
1312 17 0 defined $DB::Handy::b->{$ob} ? :
1313 17 0 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/ ? :
1317 0 17 $dir eq 'desc' ? :
1323 0 4 if $off
1324 1 3 if (defined $outer_opts{'limit'})
1326 0 1 if $last > $#qualified_rows
1332 0 4 if ($outer_cols_str =~ /^\s*\*\s*$/) { }
1340 13 0 if (exists $r->{$w}) { }
0 0 elsif ($w =~ /^$alias\.(\w+)$/ and exists $r->{$1}) { }
1350 0 0 if ($k =~ /\.\Q$w\E$/ or $k eq $w)
1377 0 0 if ref $expanded eq "HASH"
1392 0 204 if ($ch eq q['] and not $in_str) { }
0 204 elsif ($ch eq q['] and $in_str) { }
204 0 elsif (not $in_str) { }
1399 4 200 if ($ch eq '(') { }
4 196 elsif ($ch eq ')') { }
1404 4 0 if ($depth == 0)
1424 0 477 unless defined $val
1425 353 124 if ($type eq 'INT') { }
89 35 elsif ($type eq 'FLOAT') { }
1427 0 353 if $iv > 2147483647
1428 0 353 if $iv < '-2147483648'
1435 89 0 if unpack "C", "\1\0"
1438 2 87 if ($b[0] & 128) { }
1463 0 388 unless -f $idx_file
1465 0 388 unless open FH, "< $idx_file"
1469 0 388 unless ($magic eq "SDBIDX1\n")
1476 388 23429 unless defined $n and $n == $entry_size
1487 0 357 unless open FH, "> $idx_file"
1504 1670 167 if ($entries->[$mid][0] lt $key_bytes) { }
1541 12 5 if ($entries->[$pos][1] == $rec_no)
1548 12 0 if $deleted
1555 0 19 unless @$entries
1558 17 2 if (defined $lo_val)
1564 12 7 if (defined $hi_val)
1575 0 18 unless my $sch = $self->_load_schema($table)
1577 0 18 unless $ix
1581 18 0 if (-f $dat)
1583 0 18 unless open FH, "< $dat"
1589 18 79 unless defined $n and $n == $recsize
1590 79 0 if (substr($raw, 0, 1) ne "\0")
1604 0 131 unless $conds and @$conds
1605 110 21 unless %{$sch->{'indexes'};}
1611 0 21 unless my $ix = $col2ix{$c->{'col'}}
1613 12 9 if ($op eq '=') { }
1 8 elsif ($op eq '<') { }
1 7 elsif ($op eq '<=') { }
2 5 elsif ($op eq '>') { }
5 0 elsif ($op eq '>=') { }
1651 158 10 unless %{$sch->{'indexes'};}
1659 3 7 if ($where_expr =~ /^(\w+)\s+BETWEEN\s+$VAL\s+AND\s+$VAL\s*$/i)
1661 0 3 defined $lo_s ? :
1662 0 3 defined $hi_s ? :
1663 0 3 unless my $ix = $col2ix{$col}
1667 7 0 if ($where_expr =~ /^(\w+)\s+$OP\s+$VAL\s+AND\s+\1\s+$OP\s+$VAL\s*$/i)
1669 0 7 defined $v1s ? :
1670 0 7 defined $v2s ? :
1671 0 7 unless my $ix = $col2ix{$col}
1674 6 1 if ($op1 eq '>' or $op1 eq '>=') { }
1710 0 27 unless $self->{'db_name'}
1719 0 56 unless my $sch = $self->_load_schema($js->{'table'})
1731 0 27 unless defined $cur_rows[0] or not $self->{'_last_err'}
1742 29 0 if ($js->{'on_left'} and $js->{'on_right'})
1753 29 0 if (defined $on_r_alias and defined $on_r_col)
1756 135 3 defined $$rr{"$on_r_alias.$on_r_col"} ? :
1765 1 28 if ($join_type eq 'CROSS' or not defined $on_l_alias) { }
22 6 elsif ($join_type eq 'INNER') { }
5 1 elsif ($join_type eq 'LEFT') { }
1 0 elsif ($join_type eq 'RIGHT') { }
1777 145 0 defined $$lr{"$on_l_alias.$on_l_col"} ? :
1779 145 0 $use_hash ? :
1781 0 127 if $use_hash == 0 and not _join_row_matches($lr, $rr, $on_l_alias, $on_l_col, $on_r_alias, $on_r_col)
1789 32 0 defined $$lr{"$on_l_alias.$on_l_col"} ? :
1792 32 0 $use_hash ? :
1795 27 5 if (@$matches) { }
1812 5 0 defined $$rr{"$on_r_alias.$on_r_col"} ? :
1816 35 0 defined $lr->{$l_alias_key} ? :
1817 6 29 if $lkey eq $rkey
1819 3 2 if (@matched_lefts) { }
1843 15 12 if (@$where_conds)
1851 5 22 if (my $ob = $opts->{'order_by'})
1858 54 0 defined $va && $va =~ /^-?\d+\.?\d*$/ && defined $vb && $vb =~ /^-?\d+\.?\d*$/ ? :
1862 11 43 $dir eq 'desc' ? :
1870 1 26 if $offset
1871 2 25 if (defined $opts->{'limit'})
1873 0 2 if $last > $#cur_rows
1880 25 2 if ($col_specs and @$col_specs)
1885 0 52 if ($cs eq '*') { }
1 51 elsif ($cs =~ /^(\w+)\.\*$/) { }
1898 1 0 $alias_info{$a} ? :
1899 1 0 if ($sch)
1915 175 0 if (exists $r->{$ck}) { }
1922 0 0 if ($k =~ /\.\Q$ck\E$/ or $k eq $ck)
1940 0 56 unless my $sch = $self->_load_schema($table)
1946 0 56 unless (open FH, "< $dat")
1952 56 311 unless defined $n and $n == $recsize
1953 0 311 if substr($raw, 0, 1) eq "\0"
1981 75 0 if ($qname =~ /^(\w+)\.(\w+)$/)
1990 0 0 defined $la ? :
1991 0 0 defined $ra ? :
1992 0 0 unless defined $lv and defined $rv
1995 0 0 if ($lv =~ /^-?\d+\.?\d*$/ and $rv =~ /^-?\d+\.?\d*$/)
1996 0 0 $lv == $rv ? :
1998 0 0 $lv eq $rv ? :
2013 0 15 unless $conds and @$conds
2020 97 0 if (defined $c->{'lhs_alias'}) { }
2027 0 0 if ($k =~ /\.\Q$c->{'lhs_col'}\E$/ or $k eq $c->{'lhs_col'})
2033 1 96 unless defined $lv
2037 0 97 if (defined $c->{'rhs_col'}) { }
2038 0 0 if (defined $c->{'rhs_alias'}) { }
2043 0 0 if ($k =~ /\.\Q$c->{'rhs_col'}\E$/ or $k eq $c->{'rhs_col'})
2053 8 89 unless defined $rv
2058 8 89 if ($op eq "IN" or $op eq "NOT_IN")
2062 0 8 unless defined $cv
2064 8 0 $num2 ? :
4 4 if ($num2 ? $lhs_val == $cv : $lhs_val eq $cv)
2069 0 8 if $found and $op eq "NOT_IN"
2070 4 4 if not $found and $op eq "IN"
2076 77 12 if ($op eq '=') { }
0 12 elsif ($op eq '!=' or $op eq '<>') { }
0 12 elsif ($op eq '<') { }
9 3 elsif ($op eq '>') { }
0 3 elsif ($op eq '<=') { }
3 0 elsif ($op eq '>=') { }
0 0 elsif ($op eq 'LIKE') { }
2077 39 38 $num ? :
58 19 unless $num ? $lv == $rv : $lv eq $rv
2080 0 0 $num ? :
0 0 unless $num ? $lv != $rv : $lv ne $rv
2083 0 0 $num ? :
0 0 unless $num ? $lv < $rv : $lv lt $rv
2086 9 0 $num ? :
4 5 unless $num ? $lv > $rv : $lv gt $rv
2089 0 0 $num ? :
0 0 unless $num ? $lv <= $rv : $lv le $rv
2092 3 0 $num ? :
1 2 unless $num ? $lv >= $rv : $lv ge $rv
2097 0 0 unless $lv =~ /^$p$/i
2122 0 27 unless $sql =~ /^SELECT\s+(.+?)\s+FROM\s+(.+)$/is
2133 1 26 if ($from_rest =~ s/\s+OFFSET\s+(\d+)\s*$//i)
2136 2 25 if ($from_rest =~ s/\s+LIMIT\s+(\d+)\s*$//i)
2139 6 21 if ($from_rest =~ s/\s+ORDER\s+BY\s+([\w.]+)(?:\s+(ASC|DESC))?\s*$//i)
2151 15 12 if ($from_rest =~ s/\s+WHERE\s+(.+)$//i)
2165 0 27 unless ($fr =~ s/^(\w+)(?:\s+(?:AS\s+)?(\w+))?//)
2168 27 0 defined $2 ? :
2175 5 24 if (defined $type_kw and $type_kw =~ /LEFT/i) { }
1 23 elsif (defined $type_kw and $type_kw =~ /RIGHT/i) { }
1 22 elsif (defined $type_kw and $type_kw =~ /CROSS/i) { }
2184 0 29 unless defined $alias
2195 0 27 if @join_specs < 2
2201 1 26 if ($sel_str =~ /^\s*\*\s*$/) { }
2215 15 12 if $where_str =~ /\S/
2224 0 15 unless defined $expr and $expr =~ /\S/
2230 10 7 if ($part =~ /^((?:\w+\.)?\w+)\s*(=|!=|<>|<=|>=|<|>)\s*((?:\w+\.)?\w+)$/i and not $part =~ /'/) { }
1 6 elsif ($part =~ /^((?:\w+\.)?\w+)\s+(NOT\s+)?IN\s*\(([^)]*)\)\s*$/i) { }
6 0 elsif ($part =~ /^((?:\w+\.)?\w+)\s*(=|!=|<>|<=|>=|<|>|LIKE)\s*(?:'([^']*)'|(-?\d+\.?\d*))$/i) { }
2234 10 0 if ($rhs =~ /^-?\d+\.?\d*$/) { }
2252 0 1 defined $sv ? :
0 1 defined $nl ? :
2254 0 1 $neg ? :
2265 6 0 defined $sv ? :
2292 1083 80 if $self->{'_tables'}{$table}
2294 8 72 unless (-f $sch_file)
2299 0 72 unless (open FH, "< $sch_file")
2307 72 254 if (/^RECSIZE=(\d+)/) { }
180 74 elsif (/^COL=(\w+):(\w+):(\d+)/) { }
1 73 elsif (/^NOTNULL=(\w+)/) { }
0 73 elsif (/^DEFAULT=(\w+):(.+)/) { }
1 72 elsif (/^CHECK=(\w+):(.+)/) { }
0 72 elsif (/^PK=(\w+)/) { }
0 72 elsif (/^IDX=(\w+):(\w+):([01])/) { }
2334 0 0 $cdef ? :
0 0 $cdef ? :
2349 0 12 unless open FH, "> $sch_file"
2358 0 12 unless $sch->{'notnull'}
2361 0 12 unless $sch->{'defaults'}
2364 0 12 unless $sch->{'checks'}
2367 1 11 if $sch->{'pk'}
2376 1244 2 defined $$row{$col->{'name'}} ? :
2379 869 377 if ($t eq 'INT') { }
79 298 elsif ($t eq 'FLOAT') { }
2381 0 869 if $iv > 2147483647
2382 0 869 if $iv < '-2147483648'
2405 4089 2722 if ($t eq 'INT') { }
287 2435 elsif ($t eq 'FLOAT') { }
2407 3 4086 if $uv > 2147483647
2428 0 10 unless defined $wi
2429 10 0 if ref $wi eq "CODE"
2430 0 0 if ref $wi eq "ARRAY"
2440 69 2185 if ($ch eq '(') { }
69 2116 elsif ($ch eq ')') { }
99 2017 elsif ($ch eq ',' and $depth == 0) { }
2456 67 0 if $cur =~ /\S/
2465 0 1164 unless length $str
2466 270 894 if ($str =~ s/^'((?:[^']|'')*)'(?:\s*,\s*|\s*$)//) { }
0 894 elsif ($str =~ s/^(NULL)(?:\s*,\s*|\s*$)//i) { }
894 0 elsif ($str =~ s/^(-?\d+\.?\d*)(?:\s*,\s*|\s*$)//) { }
2494 0 0 if ($part =~ /^(\w+)\s+(NOT\s+)?IN\s*\(([^)]*)\)\s*$/i)
2502 0 0 defined $sv ? :
0 0 defined $nl ? :
2504 0 0 $neg ? :
2513 0 0 if ($part =~ /^(NOT\s+)?EXISTS\s*\((\d+)\)$/i)
2515 0 0 $val ? :
2516 0 0 if $neg
2522 0 0 if ($part =~ /^(NOT\s+)?EXISTS\s+(\d+)$/i)
2524 0 0 $val ? :
2525 0 0 if $neg
2531 0 0 if ($part =~ /^(\w+)\s*(=|!=|<>|<=|>=|<|>)\s*NULL$/i)
2537 0 0 if ($part =~ /^(\w+)\s+IS\s+(NOT\s+)?NULL$/i)
2539 0 0 $neg ? :
2544 0 0 if ($part =~ /^(\w+)\s*(=|!=|<>|<=|>=|<|>|LIKE)\s*(?:'([^']*)'|(-?\d+\.?\d*))$/i)
2546 0 0 defined $sv ? :
2554 4 2 unless $conds and @$conds
2561 0 8 if ($op eq 'CONST') { }
0 8 elsif ($op eq 'IN' or $op eq 'NOT_IN') { }
0 8 elsif ($op eq 'IS_NULL') { }
0 8 elsif ($op eq 'IS_NOT_NULL') { }
2562 0 0 unless $c->{'val'}
2566 0 0 defined $$row{$c->{'col'}} ? :
2569 0 0 unless defined $cv
2571 0 0 $num ? :
0 0 if ($num ? $rv == $cv : $rv eq $cv)
2576 0 0 if $found and $op eq "NOT_IN"
2577 0 0 if not $found and $op eq "IN"
2581 0 0 unless not defined $$row{$c->{'col'}} or $$row{$c->{'col'}} eq ""
2584 0 0 unless defined $$row{$c->{'col'}} and $$row{$c->{'col'}} ne ""
2588 8 0 defined $$row{$c->{'col'}} ? :
2591 4 4 if ($op eq '=') { }
0 4 elsif ($op eq '!=' or $op eq '<>') { }
0 4 elsif ($op eq '<') { }
4 0 elsif ($op eq '>') { }
0 0 elsif ($op eq '<=') { }
0 0 elsif ($op eq '>=') { }
0 0 elsif ($op eq 'LIKE') { }
2592 4 0 $num ? :
0 4 unless $num ? $rv == $cv : $rv eq $cv
2595 0 0 $num ? :
0 0 unless $num ? $rv != $cv : $rv ne $cv
2598 0 0 $num ? :
0 0 unless $num ? $rv < $cv : $rv lt $cv
2601 4 0 $num ? :
2 2 unless $num ? $rv > $cv : $rv gt $cv
2604 0 0 $num ? :
0 0 unless $num ? $rv <= $cv : $rv le $cv
2607 0 0 $num ? :
0 0 unless $num ? $rv >= $cv : $rv ge $cv
2612 0 0 unless $rv =~ /^$p$/i
2629 0 2792 unless defined $expr
2631 0 2792 unless length $expr
2632 0 2792 if $expr =~ /^NULL$/i
2633 88 2704 if $expr =~ /^-?\d+\.?\d*$/
2634 18 2686 if ($expr =~ /^'((?:[^']|'')*)'$/)
2638 0 2686 if ($expr =~ /^\((.+)\)$/s and not $1 =~ /^\s*SELECT\b/i)
2641 9 2677 if ($expr =~ /^CASE\b(.*)\bEND$/is)
2644 4 2673 if ($expr =~ /^COALESCE\s*\((.+)\)$/is)
2647 4 2 if defined $v and $v ne ""
2651 2 2671 if ($expr =~ /^NULLIF\s*\((.+)\)$/is)
2653 0 2 unless @a == 2
2655 2 0 if (defined $va and defined $vb)
2656 2 0 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/ ? :
1 1 if $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/ ? $va == $vb : $va eq $vb
2660 2 2669 if ($expr =~ /^CAST\s*\(\s*(.+?)\s+AS\s+(\w+(?:\s*\(\s*\d+\s*\))?)\s*\)$/is)
2663 0 2 unless defined $v
2664 1 1 if $t =~ /^INT/i
2665 0 1 if $t =~ /^(FLOAT|REAL|DOUBLE|NUMERIC|DECIMAL)/i
2668 9 2660 if ($expr =~ /^(UPPER|LOWER|LENGTH|ABS|SIGN|TRIM|LTRIM|RTRIM)\s*\((.+)\)$/is)
2671 0 9 unless defined $v
2672 2 7 if $fn eq "UPPER"
2673 3 4 if $fn eq "LOWER"
2674 2 2 if $fn eq "LENGTH"
2675 0 2 if $fn eq "ABS"
2676 0 0 $v < 0 ? :
0 0 $v > 0 ? :
0 2 if $fn eq "SIGN"
2677 2 0 if ($fn eq "TRIM")
2681 0 0 if ($fn eq "LTRIM")
2685 0 0 if ($fn eq "RTRIM")
2690 0 2660 if ($expr =~ /^ROUND\s*\((.+)\)$/is)
2693 0 0 unless defined $v
2694 0 0 @a > 1 ? :
2697 0 2660 if ($expr =~ /^(FLOOR|CEIL(?:ING)?)\s*\((.+)\)$/is)
2700 0 0 unless defined $v
2701 0 0 $fn eq 'FLOOR' ? :
2703 0 2660 if ($expr =~ /^MOD\s*\((.+)\)$/is)
2705 0 0 unless @a == 2
2707 0 0 if $b == 0
2710 1 2659 if ($expr =~ /^(?:SUBSTR|SUBSTRING)\s*\((.+)\)$/is)
2713 0 1 if ($inner =~ /^(.+?)\s+FROM\s+(\S+)(?:\s+FOR\s+(.+))?$/is) { }
2720 0 1 unless defined $s
2722 0 1 if $st < 1
2723 1 0 defined $le ? :
2727 0 2659 if ($expr =~ /^CONCAT\s*\((.+)\)$/is)
2732 0 0 defined $v ? :
2740 28 7927 if (defined $p)
2744 6 22 if ($opsym eq "||")
2745 6 0 defined $lv ? :
6 0 defined $rv ? :
2747 0 22 unless defined $lv and defined $rv
2749 10 12 if $opsym eq "+"
2750 0 12 if $opsym eq "-"
2751 6 6 if $opsym eq "*"
2752 0 6 if $opsym eq '/' || $opsym eq '%' and $r == 0
2753 0 6 if $opsym eq "/"
2754 6 0 if $opsym eq "%"
2757 0 2631 if ($expr =~ /^-([\w('.].*)$/s)
2759 0 0 unless defined $v
2762 39 2592 if ($expr =~ /^(\w+)\.(\w+)$/)
2764 9 30 exists $$row{"$a.$c"} ? :
2766 2592 0 if $expr =~ /^\w+$/
2774 0 9 unless ($body =~ /^\s*WHEN\b/i)
2775 0 0 if $body =~ s/^(.+?)\s+(?=WHEN\b)//is
2778 9 0 if $body =~ s/\s*\bELSE\b\s+(.+?)\s*$//is
2782 0 15 if (defined $base) { }
2789 6 9 if $m
2791 3 0 defined $else ? :
2797 34 0 if ($expr =~ /^(.+?)\s*(=|!=|<>|<=|>=|<|>)\s*(.+)$/s)
2800 0 34 unless defined $lv and defined $rv
2802 5 0 $n ? :
5 29 if $op eq "="
2803 0 0 $n ? :
0 29 if $op =~ /^(!|<>)/
2804 10 0 $n ? :
10 19 if $op eq "<"
2805 0 0 $n ? :
0 19 if $op eq ">"
2806 4 0 $n ? :
4 15 if $op eq "<="
2807 15 0 $n ? :
15 0 if $op eq ">="
2809 0 0 if ($expr =~ /^(.+)\s+IS\s+(NOT\s+)?NULL$/is)
2811 0 0 $2 ? :
2824 17 2387 if ($ch eq q['] and not $in_q) { }
17 2370 elsif ($ch eq q['] and $in_q) { }
71 2299 elsif ($in_q) { }
45 2254 elsif ($ch eq '(') { }
45 2209 elsif ($ch eq ')') { }
87 2122 elsif ($ch eq ',' and $d == 0) { }
2851 251 0 if $cur =~ /\S/
2863 2 28443 if ($ch eq q['] and not $in_q) { }
2 28441 elsif ($ch eq q['] and $in_q) { }
0 28441 elsif (not $in_q and $ch eq '(') { }
0 28441 elsif (not $in_q and $ch eq ')') { }
20484 7957 elsif (not $in_q and $d == 0 and $i > 0) { }
2876 29 20455 if (substr($expr, $i) =~ /^($op_pat)/)
2889 0 234 unless defined $expr and $expr =~ /\S/
2897 3 292 if @or > 1
2899 26 266 if @and > 1
2900 2 264 if $expr =~ /^NOT\s+(.+)$/is
2901 1 263 if ($expr =~ /^\((.+)\)$/s and not $1 =~ /^\s*SELECT\b/i)
2918 80 6594 if ($ch eq q['] and not $in_q) { }
80 6514 elsif ($ch eq q['] and $in_q) { }
319 6195 elsif ($in_q) { }
34 6161 elsif ($ch eq '(') { }
34 6127 elsif ($ch eq ')') { }
35 6092 elsif ($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/) { }
2946 32 3 if ($kw eq "AND")
2949 6 26 if ($before =~ /\bBETWEEN\s+\S+\s*$/i)
2967 29 558 @parts > 1 ? :
2973 3 260 if ($part =~ /^(NOT\s+)?EXISTS\s*\((\d+)\)$/i)
2975 1 2 $v ? :
2976 0 3 if $neg
2979 11 249 if ($part =~ /^([\w.]+)\s+(NOT\s+)?IN\s*\(([^)]*)\)$/is)
2984 2 16 if (defined $nl) { }
0 16 elsif (defined $sv) { }
2995 3 8 $neg ? :
2997 1 248 if $part =~ /^[\w.]+\s*(?:=|!=|<>|<=|>=|<|>)\s*NULL$/is
2998 3 245 if ($part =~ /^([\w.]+)\s+IS\s+(NOT\s+)?NULL$/is)
2999 2 1 $2 ? :
3001 6 239 if ($part =~ /^([\w.]+)\s+(NOT\s+)?BETWEEN\s+(.+?)\s+AND\s+(.+)$/is)
3005 1 5 $neg ? :
3007 5 234 if ($part =~ /^(.+?)\s+(NOT\s+)?LIKE\s+('(?:[^']|'')*'|\S+)$/is)
3012 1 4 $neg ? :
3014 234 0 if ($part =~ /^(.+?)\s*(=|!=|<>|<=|>=|<|>)\s*(.+)$/s)
3019 27 207 if ($rhs =~ /^'((?:[^']|'')*)'$/) { }
3033 26 268 if ($op eq "AND")
3035 251 221 unless &$s($_[0])
3037 3 265 if ($op eq "OR")
3039 12 18 if &$s($_[0])
3041 2 263 if ($op eq "NOT")
3043 1 11 &$s($_[0]) ? :
3050 263 0 defined $c->{'op'} ? :
3051 8 24 $c->{'val'} ? :
4 259 if $op eq "CONST"
3052 1 258 if ($op eq "IS_NULL")
3054 3 0 unless not defined $v
3056 2 256 if ($op eq "IS_NOT_NULL")
3058 6 0 if defined $v
3060 6 250 if ($op eq "BETWEEN" or $op eq "NOT_BETWEEN")
3064 0 30 unless defined $v
3066 30 0 $n ? :
3067 4 26 $neg ? :
3070 11 239 if ($op eq "IN" or $op eq "NOT_IN")
3073 77 0 defined $_[0]{$col} ? :
3076 16 93 unless defined $cv
3078 93 0 $n ? :
32 61 if ($n ? $rv == $cv : $rv eq $cv)
3083 21 56 $neg ? :
3086 5 234 if ($op eq "LIKE" or $op eq "NOT_LIKE")
3090 0 24 unless defined $v
3091 10 14 $v =~ /^$re$/is ? :
3092 3 21 $neg ? :
3099 0 1221 unless defined $lv
3100 0 1221 $rhs_expr =~ /^[\w.]+$/ && !($rhs_expr =~ /^-?\d+\.?\d*$/) ? :
3101 0 1221 unless defined $rv
3103 494 149 $n ? :
643 578 if $op2 eq "="
3104 8 2 $n ? :
10 568 if $op2 =~ /^(!|<>)/
3105 49 0 $n ? :
49 519 if $op2 eq "<"
3106 324 0 $n ? :
324 195 if $op2 eq ">"
3107 93 0 $n ? :
93 102 if $op2 eq "<="
3108 102 0 $n ? :
102 0 if $op2 eq ">="
3119 2 289 if @up > 1
3120 27 262 if ($sql =~ /\bJOIN\b/i)
3126 0 27 if ($join_sql =~ s/\bHAVING\s+(.+?)(?=\s*(?:ORDER\s+BY|LIMIT|OFFSET|$))//is)
3130 1 26 if ($join_sql =~ s/\bGROUP\s+BY\s+(.+?)(?=\s*(?:HAVING|ORDER\s+BY|LIMIT|OFFSET|$))//is)
3139 27 0 if ($parsed)
3144 1 26 if ($needs_groupby) { }
3157 0 27 unless $rows
3159 1 26 if ($needs_groupby)
3163 1 0 if ($sql =~ /^SELECT\s+(.+?)\s+FROM\b/is)
3167 2 1 if ($c =~ /^(.+?)\s+AS\s+(\w+)\s*$/is) { }
3171 1 0 $c =~ /^(\w+)\.(\w+)$/ ? :
3179 1 0 if (@gb_join) { }
3188 0 0 $col =~ /^(\w+)\.(\w+)$/ && defined $row->{$2} ? :
6 0 defined $row->{$col} ? :
3190 6 0 defined $v ? :
3192 3 3 unless exists $gr{$k}
3210 0 3 if ($having_join ne "")
3215 0 0 unless where_sub($h)->({%out})
3221 1 0 if (defined $opts->{'order_by'})
3225 0 3 defined $DB::Handy::a->{$ob} ? :
3226 0 3 defined $DB::Handy::b->{$ob} ? :
3227 0 3 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/ ? :
3230 0 3 $dir eq 'desc' ? :
3233 0 1 if (defined $opts->{'offset'} and $opts->{'offset'} > 0)
3236 0 1 if (defined $opts->{'limit'})
3238 0 0 if $l > $#results
3246 0 262 unless my $p = $self->parse_select($sql)
3249 25 237 if $needs_agg
3250 7 230 unless my $sch = $self->_load_schema($tbl)
3253 189 41 if ($where_expr ne "")
3255 131 58 if ($where_expr =~ /^(\w+)\s*(=|!=|<>|<=|>=|<|>)\s*(?:'([^']*)'|(-?\d+\.?\d*))$/ and not $where_expr =~ /\b(?:OR|AND|NOT|BETWEEN|IN)\b/i)
3259 15 116 defined $sv ? :
3261 21 110 if (defined $idx)
3265 0 21 unless open FH, "< $dat"
3273 0 53 unless defined $n and $n == $rs
3274 0 53 if substr($raw, 0, 1) eq "\0"
3276 53 0 if not $wsub or &$wsub($row)
3287 10 158 if (defined $idx_range)
3291 0 10 unless open FH, "< $dat"
3299 0 71 unless defined $n and $n == $rs
3300 0 71 if substr($raw, 0, 1) eq "\0"
3302 71 0 if not $wsub or &$wsub($row)
3312 0 199 unless open FH, "< $dat"
3319 199 1169 unless defined $n and $n == $rs
3320 11 1158 if substr($raw, 0, 1) eq "\0"
3322 458 700 if not $ws or &$ws($row)
3332 0 262 unless $sql =~ s/^SELECT\s+//is
3334 3 259 if $sql =~ s/^DISTINCT\s+//is
3336 0 262 unless defined $col_str and defined $rest
3339 262 0 if $rest =~ s/^(\w+)//
3342 0 262 if ($rest =~ /^\s+(\w+)/ and not $1 =~ /^(?:WHERE|GROUP|ORDER|HAVING|LIMIT|OFFSET|INNER|LEFT|RIGHT|JOIN|ON|UNION)$/i)
3346 0 262 unless $tbl
3348 4 258 if $rest =~ s/\s+OFFSET\s+(\d+)\s*$//is
3349 8 254 if $rest =~ s/\s+LIMIT\s+(\d+)\s*$//is
3351 44 218 if ($rest =~ s/(?:^|\s+)ORDER\s+BY\s+(.+?)(?=\s*(?:LIMIT|OFFSET|$))//is)
3357 8 38 if $item =~ s/\s+(ASC|DESC)\s*$//is
3362 3 259 if $rest =~ s/(?:^|\s+)HAVING\s+(.+?)(?=\s*(?:ORDER|LIMIT|OFFSET|$))//is
3365 11 251 if ($rest =~ s/(?:^|\s+)GROUP\s+BY\s+(.+?)(?=\s*(?:HAVING|ORDER|LIMIT|OFFSET|$))//is)
3369 193 69 if $rest =~ /(?:^|\s*)WHERE\s+(.+)/is
3381 8 2660 if ($ch eq q['] and not $in_q) { }
8 2652 elsif ($ch eq q['] and $in_q) { }
45 2607 elsif (not $in_q and $ch eq '(') { }
45 2562 elsif (not $in_q and $ch eq ')') { }
262 2300 elsif (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/) { }
3408 43 219 if $cs eq "*"
3413 57 240 if ($c =~ /^(.+?)\s+AS\s+(\w+)\s*$/is) { }
3419 0 240 $expr =~ /^(\w+)\.(\w+)$/ ? :
3434 35 195 if (@$ob)
3439 0 0 defined $ra->{$e} ? :
257 0 if (defined $vv) { }
3440 0 0 defined $rb->{$e} ? :
257 0 if (defined $vv) { }
3441 192 65 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/ ? :
3442 37 220 if lc $dir eq "desc"
3443 222 35 if $c
3450 226 4 unless defined $offset
3451 3 227 if $offset
3452 8 222 if (defined $limit)
3454 0 8 if $l > $#sorted
3461 98 449 if ($star) { }
3472 3 227 if ($distinct)
3476 19 0 defined $r->{$_} ? :
3477 8 11 unless $s{$k}++
3489 0 25 unless my $sch = $self->_load_schema($tbl)
3491 4 21 $where_expr ne '' ? :
3494 0 25 unless open FH, "< $dat"
3501 25 141 unless defined $n and $n == $rs
3502 9 132 if substr($raw, 0, 1) eq "\0"
3504 117 15 if not $ws or &$ws($row)
3510 11 14 if (@$gb) { }
3512 71 0 defined $v ? :
3513 29 42 unless exists $gr{$k}
3524 42 1 defined $grp->[0] ? :
3527 7 36 if ($having ne "")
3532 2 5 unless where_sub($h)->({%out})
3536 9 16 if (@$ob)
3541 0 0 defined $ra->{$e} ? :
22 0 if (defined $vv) { }
3542 0 0 defined $rb->{$e} ? :
22 0 if (defined $vv) { }
3543 8 14 $va =~ /^-?\d+\.?\d*$/ && $vb =~ /^-?\d+\.?\d*$/ ? :
3544 0 22 if lc $dir eq "desc"
3545 22 0 if $c
3550 25 0 unless defined $offset
3551 0 25 if $offset
3552 0 25 if (defined $limit)
3554 0 0 if $l > $#results
3562 32 63 if $expr =~ /^COUNT\s*\(\s*\*\s*\)$/is
3563 1 62 if ($expr =~ /^COUNT\s*\(\s*DISTINCT\s+(.+)\s*\)$/is)
3566 5 0 defined $vv ? :
3569 30 32 if ($expr =~ /^(COUNT|SUM|AVG|MIN|MAX)\s*\((.+)\)$/is)
3573 0 30 unless @vals
3574 0 30 if $fn eq "COUNT"
3575 13 17 if ($fn eq "SUM")
3580 9 8 if ($fn eq "AVG")
3585 2 6 if ($fn eq "MIN")
3586 4 0 $a =~ /^-?\d+\.?\d*$/ && $b =~ /^-?\d+\.?\d*$/ ? :
3588 6 0 if ($fn eq "MAX")
3589 13 0 $a =~ /^-?\d+\.?\d*$/ && $b =~ /^-?\d+\.?\d*$/ ? :
3608 43 14786 if ($ch eq q['] and not $in_q) { }
43 14743 elsif ($ch eq q['] and $in_q) { }
186 14557 elsif ($in_q) { }
66 14491 elsif ($ch eq '(') { }
66 14425 elsif ($ch eq ')') { }
2 14423 elsif ($d == 0 and not $in_q and uc substr($sql, $i, 5) eq 'UNION' and $i == 0 || substr($sql, $i - 1, 1) =~ /\s/ and $i + 5 < $len and substr($sql, $i + 5, 1) =~ /[\s(]/) { }
3638 1 1 if ($i + 3 <= $len and uc substr($sql, $i, 3) eq 'ALL' and $i + 3 >= $len || substr($sql, $i + 3, 1) =~ /\s/) { }
3656 291 0 if $cur =~ /\S/
3665 0 2 if $r0->{'type'} eq "error"
3671 1 1 if $sep ne "ALL"
3673 0 2 if $r->{'type'} eq "error"
3676 1 1 if ($dedup)
3680 4 0 defined $r->{$_} ? :
3681 3 1 unless $s{$k}++
3696 26 0 if $part =~ /^(\w+)\s*=\s*(.+)$/
3703 0 25 unless $self->{'db_name'}
3704 0 25 unless my $sch = $self->_load_schema($table)
3709 0 25 unless open FH, "+< $dat"
3719 17 77 unless defined $x and $x == $rs
3720 76 1 if (substr($raw, 0, 1) ne "\0")
3722 35 41 if (not $ws or &$ws($row))
3730 6 4 unless $ix->{'unique'} and exists $$set_exprs{$ix->{'col'}}
3733 4 0 if ($ep >= 0)
3737 0 4 unless open IF_FH, "< $ef"
3743 2 2 if (unpack("N", $rn) != $rno)
3752 0 33 unless $sch->{'notnull'}
3753 11 1 unless exists $set_exprs->{$cn}
3754 1 0 unless (defined $row->{$cn} and $row->{$cn} ne "")
3761 0 32 unless $sch->{'checks'}
3762 6 9 unless exists $set_exprs->{$cn}
3763 5 4 unless (eval_bool($sch->{'checks'}{$cn}, $row))
3774 4 3 unless exists $$set_exprs{$ix->{'col'}}
3816 0 23 unless ref $opts eq "HASH"
3818 0 23 unless (defined $engine)
3820 0 0 if ($opts->{'RaiseError'})
3829 1 22 defined $opts->{'PrintError'} ? :
3834 22 1 if ($database and !defined($opts->{'AutoUse'}) || $opts->{'AutoUse'})
3836 2 20 if ($res->{'type'} eq "error")
3840 0 22 if ($res->{'type'} eq "error")
3853 2 21 if (defined $dsn and $dsn =~ /[=;]/) { }
3859 21 0 defined $dsn ? :
3861 20 3 unless ref $opts eq "HASH"
3868 0 74 unless my $sth = $self->prepare($sql)
3875 0 132 unless (defined $sql and $sql =~ /\S/)
3886 0 11 unless ref $attr eq "HASH"
3887 0 11 unless my $sth = $self->prepare($sql)
3888 0 11 unless $sth->execute(@bind)
3895 0 2 unless my $rows = $self->selectall_arrayref($sql, {"Slice", {}}, @bind)
3906 0 15 unless my $sth = $self->prepare($sql)
3907 0 15 unless $sth->execute(@bind)
3916 0 2 unless my $sth = $self->prepare($sql)
3917 0 2 unless $sth->execute(@bind)
3926 2 7 unless defined $val
3944 0 1 unless my $cols = $self->{'_engine'}->describe_table($table)
3952 0 4 $_->{'not_null'} ? :
3963 1 2 $_[0]{'_disconnected'} ? :
3971 0 8 unless defined $code
3975 1 7 if ($self->{'PrintError'})
3978 2 6 if ($self->{'RaiseError'})
4018 2 134 if (not @bind and @{$self->{'_bind_params'};})
4025 16 120 if (@bind)
4036 8 128 if ($res->{'type'} eq "error")
4041 55 73 if ($res->{'type'} eq "rows")
4056 73 0 if ($res->{'type'} eq "ok")
4058 56 17 if (defined $res->{'message'} and $res->{'message'} =~ /(\d+)\s+row/)
4063 51 22 if ($sql =~ /^\s*INSERT\b/i)
4070 0 0 if (ref $res->{'data'} eq "ARRAY")
4088 54 1 $data && @$data ? :
4089 0 55 unless defined $sql
4092 55 0 if ($sql =~ /^SELECT\s+(.*?)\s+FROM\b/is) { }
4100 1 54 if $col_str =~ /(?:^|\s)\*(?:\s|$)/
4105 16 637 if ($ch eq '(') { }
16 621 elsif ($ch eq ')') { }
35 586 elsif ($ch eq ',' and $depth == 0) { }
4110 54 0 if length $cur
4115 21 68 if ($part =~ /\bAS\s+(\w+)\s*$/is) { }
0 68 elsif ($part =~ /^(\w+)\.(\w+)$/) { }
68 0 elsif ($part =~ /^(\w+)$/) { }
4133 53 1 if (@$data)
4136 0 87 unless $keys{$nm}
4145 1 112 unless defined $self->{'_rows'}
4146 21 91 if $self->{'_cursor'} >= scalar @{$self->{'_rows'};}
4154 4 22 unless my $href = $self->fetchrow_hashref
4155 22 0 @{$self->{'NAME'};} ? :
4162 0 2 unless my $aref = $self->fetchrow_arrayref
4174 0 14 unless defined $self->{'_rows'}
4176 12 2 if (ref $slice eq 'HASH') { }
4224 8 0 unless defined $code
4229 8 0 if ref $dbh
4235 0 18 unless defined $val
4236 13 5 if $val =~ /^-?\d+\.?\d*$/