Branch Coverage

lib/DBIx/OptimalQuery.pm
Criterion Covered Total %
branch 0 402 0.0


line true false branch
69 0 0 if $sth->{'_already_executed'}
73 0 0 if $sth->count == 0
89 0 0 if @binds
92 0 0 if (not $sth->{'oq'}{'joins'}{$from_dep}[0]) { }
0 0 elsif (not defined $sth->{'oq'}{'joins'}{$from_dep}[2]) { }
96 0 0 unless $sql =~ /\b$from_dep\s*$/
110 0 0 if $old_join_sql ne ''
120 0 0 if $old_join_sql
121 0 0 if $c->{'where_sql'}
122 0 0 if @where
127 0 0 $c->{'order_by_sql'} ? :
134 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}{'AutoSetLongReadLen'} and scalar @{$c->{'selected_lobs'};})
144 0 0 if (not $sth->{'oq'}{'dbh'}{'LongReadLen'} or $SetLongReadLen > $sth->{'oq'}{'dbh'}{'LongReadLen'})
171 0 0 if ($sth->{'oq'}{'joins'}{$sd->[0]}[3]{'new_cursor_order_by'})
186 0 0 if defined $sth->{'oq'}{'joins'}{$joinAlias}[2]
189 0 0 if (not defined $joinWhereSql) { }
198 0 0 if ($joinWhereSql)
199 0 0 if $where_sql
215 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}{'AutoSetLongReadLen'} and scalar @{$c->{'selected_lobs'};})
223 0 0 if (not $sth->{'oq'}{'dbh'}{'LongReadLen'} or $SetLongReadLen > $sth->{'oq'}{'dbh'}{'LongReadLen'})
234 0 0 if $sth->{'oq'}{'debug'}
245 0 0 if ($@)
261 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle') { }
0 0 elsif ($sth->{'oq'}{'dbtype'} eq 'Microsoft SQL Server') { }
0 0 elsif ($sth->{'oq'}{'dbtype'} eq 'Pg') { }
279 0 0 unless exists $sth->{'oq'}{'select'}{'U_ID'}
285 0 0 if ($sql =~ s/\ (ORDER BY\ .*?)$//) { }
0 0 elsif (exists $sth->{'oq'}{'select'}{'U_ID'}) { }
289 0 0 if ($bindCount > 0)
300 0 0 if ($sql =~ s/^(\s*SELECT\s*)//)
334 0 0 unless (exists $sth->{'show'})
343 0 0 unless exists $sth->{'filter'}
344 0 0 unless exists $sth->{'sort'}
369 0 0 if exists $sth->{'oq'}{'select'}{$show}
377 0 0 if ($sth->{'oq'}{'select'}{$colAlias}[3]{'always_select'})
391 0 0 if ($sth->{'oq'}{'select'}{$colAlias}[3]{'is_hidden'})
395 0 0 unless (exists $dep_idx->{$_})
400 0 0 if $all_deps_met
426 0 0 if $parent_cursor_idx eq ''
437 0 0 unless $select
444 0 0 if (not $select->[3]{'select_sql'} and $select->[3]{'date_format'}) { }
446 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' or $sth->{'oq'}{'dbtype'} eq 'Pg') { }
0 0 elsif ($sth->{'oq'}{'dbtype'} eq 'mysql') { }
462 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}->get_col_types('select')->{$show} eq 'clob')
468 0 0 if ($select_sql->[0] ne '')
529 0 0 if $sth->{'filter'} eq '' and $sth->{'hiddenFilter'} eq '' and $sth->{'forceFilter'} eq ''
542 0 0 if (not ref $i) { }
546 0 0 if ref $i->{'deps'} eq 'ARRAY'
547 0 0 if ref $i->{'binds'} eq 'ARRAY'
548 0 0 if exists $i->{'sql'}
549 0 0 if exists $i->{'name'}
562 0 0 if (uc $_[2] eq 'CONTAINS') { }
0 0 elsif (uc $_[2] eq 'NOT CONTAINS') { }
570 0 0 unless exists $oq->{'select'}{$colAlias}
572 0 0 unless $oq->{'select'}{$colAlias}[3]{'filter_sql'}
583 0 0 unless $nice =~ /^[\d\.\-]+/
589 0 0 unless $v =~ s/^\'// and $v =~ s/\'$//
606 0 0 if ($token[2]{'sql'} eq '?' and $token[2]{'binds'}[0] eq '') { }
0 0 elsif ($token[0]{'colAlias'} and $token[2]{'colAlias'}) { }
612 0 0 if ($t0 eq 'char' or $t0 eq 'clob') { }
614 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
615 0 0 if ($op =~ /NOT\ /i or $op =~ /\!/) { }
630 0 0 if ($op =~ /NOT\ /i or $op =~ /\!/) { }
649 0 0 if ($op =~ /NOT\ /i or $op =~ /\!/) { }
667 0 0 if ($t0 ne $t1)
668 0 0 if ($oq->{'dbtype'} eq 'Oracle')
669 0 0 unless $t0 eq 'char'
670 0 0 unless $t1 eq 'char'
673 0 0 if ($token[1]{'name'} =~ /contains/)
677 0 0 if ($oq->{'dbtype'} eq 'Oracle' or $oq->{'dbtype'} eq 'SQLite') { }
690 0 0 if ($token[1]{'name'} =~ /contains/) { }
0 0 elsif ($token[1]{'sql'} =~ /like/i and $token[2]{'sql'} eq '?') { }
691 0 0 unless (exists $oq->{'select'}{$token[0]{'colAlias'}}[3]{'date_format'})
694 0 0 if ($token[2]{'sql'} eq '?') { }
699 0 0 unless (exists $oq->{'select'}{$token[0]{'colAlias'}}[3]{'date_format'})
712 0 0 if (exists $oq->{'select'}{$token[0]{'colAlias'}}[3]{'date_format'} and $token[1]{'sql'} =~ /like/i and $token[2]{'sql'} eq '?') { }
0 0 elsif (exists $oq->{'select'}{$token[0]{'colAlias'}}[3]{'date_format'} and not $token[1]{'sql'} =~ /like/i and $token[2]{'sql'} eq '?') { }
0 0 elsif ($token[1]{'sql'} =~ /\=|\<|\>/ and $oq->get_col_type($token[0]{'colAlias'}, 'filter') eq 'num') { }
0 0 elsif ($token[1]{'sql'} =~ /\=|\<|\>/ and $oq->{'dbtype'} eq 'Oracle' and $oq->get_col_type($token[0]{'colAlias'}, 'filter') eq 'clob') { }
714 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
0 0 elsif ($oq->{'dbtype'} eq 'mysql') { }
726 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
0 0 elsif ($oq->{'dbtype'} eq 'mysql') { }
739 0 0 unless $v =~ /^\-?(\d*\.\d+|\d+)$/
763 0 0 if ($parentDep) { }
774 0 0 if ($oq->{'joins'}{$path[-1]}[3]{'new_cursor'}) { }
782 0 0 if (@path)
795 0 0 if ($fromSql =~ /^(.*)\bON\s*\((.*)\)\s*$/is) { }
804 0 0 if ($token[2]{'name'} eq '""') { }
0 0 elsif ($token[1]{'sql'} eq '!=') { }
0 0 elsif ($token[1]{'sql'} =~ s/NOT\ //) { }
805 0 0 if ($token[1]{'sql'} eq '=') { }
0 0 elsif ($token[1]{'sql'} eq 'IS NULL') { }
828 0 0 if @preBinds
842 0 0 unless ref $args eq 'ARRAY'
846 0 0 if (ref $r eq 'ARRAY') { }
0 0 elsif (ref $r eq 'HASH') { }
854 0 0 unless ref $r->{'sql_generator'} eq 'CODE'
856 0 0 unless ref $deps
857 0 0 if (ref $binds eq 'ARRAY') { }
864 0 0 unless ref $r
874 0 0 if ($sth->{'filter'} ne '')
876 0 0 unless my $filter = $sth->{'oq'}->parse($DBIx::OptimalQuery::filterGrammar, $sth->{'filter'}, \%translations)
885 0 0 if ($sth->{'hiddenFilter'} ne '')
887 0 0 unless my $hiddenFilter = $sth->{'oq'}->parse($DBIx::OptimalQuery::filterGrammar, $sth->{'hiddenFilter'}, \%translations)
889 0 0 if $c->{'where_sql'} ne ''
895 0 0 if ($sth->{'forceFilter'} ne '')
897 0 0 unless my $forceFilter = $sth->{'oq'}->parse($DBIx::OptimalQuery::filterGrammar, $sth->{'forceFilter'}, \%translations)
899 0 0 if $c->{'where_sql'} ne ''
914 0 0 if ($sth->{'sort'} ne '')
922 0 0 unless ref $_[2] eq 'ARRAY'
924 0 0 unless ref $sort eq 'HASH'
939 0 0 if ($sql_sort_opts_to_append)
941 0 0 $sql_sort_opts_to_append =~ /desc/ ? :
948 0 0 unless s/^\'// and s/\'$//
955 0 0 unless ref $args eq 'ARRAY'
959 0 0 if (ref $r eq 'ARRAY') { }
0 0 elsif (ref $r eq 'HASH') { }
967 0 0 unless ref $r->{'sql_generator'} eq 'CODE'
969 0 0 unless ref $deps
972 0 0 unless ref $r
981 0 0 unless exists $oq->{'select'}{$colAlias}
984 0 0 unless $oq->{'select'}{$colAlias}[3]{'sort_sql'}
987 0 0 if $oq->{'select'}{$colAlias}[2] eq ''
990 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}->get_col_types('select')->{$colAlias} eq 'clob' and not $sql =~ /^cast\(/i)
1000 0 0 unless my $result = $sth->{'oq'}->parse($DBIx::OptimalQuery::sortGrammar, $sth->{'sort'}, \%translations)
1023 0 0 unless $sth->count > 0
1035 0 0 if (my $v = $c->{'sth'}->fetch) { }
1040 0 0 if ($c->{'sth'}{'TYPE'}[$i] eq '3' and $v->[$i] =~ /\./)
1076 0 0 if $c->{'sth'}
1087 0 0 unless (defined $sth->{'count'})
1105 0 0 if @binds
1108 0 0 if (not $sth->{'oq'}{'joins'}{$from_dep}[0]) { }
0 0 elsif (not $sth->{'oq'}{'joins'}{$from_dep}[2]) { }
1111 0 0 unless $sql =~ /\b$from_dep\s*$/
1124 0 0 if ($sql)
1125 0 0 if $old_join_sql ne ''
1136 0 0 if $old_join_sql
1137 0 0 if $c->{'where_sql'}
1138 0 0 if @where
1152 0 0 if $sth->{'oq'}{'debug'}
1154 0 0 if ($@)
1171 0 0 if (wantarray) { }
1266 0 0 unless $oq->{'dbh'}
1268 0 0 unless ref $oq->{'select'} eq 'HASH'
1270 0 0 unless ref $oq->{'joins'} eq 'HASH'
1276 0 0 if $oq->{'dbtype'} eq 'ODBC'
1362 0 0 if exists $$translations{$_[0]}
1363 0 0 if exists $DBIx::OptimalQuery::translations->{'*default*'}
1388 0 0 unless exists $oq->{'AutoSetLongReadLen'}
1405 0 0 if (ref $oq->{$key}{$alias} eq 'ARRAY' and defined $oq->{$key}{$alias}[$i] and ref $oq->{$key}{$alias}[$i] ne 'ARRAY')
1418 0 0 if exists $opts->{$opt} and ref $opts->{$opt} ne 'ARRAY'
1424 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1431 0 0 if (exists $opts->{'new_cursor'})
1432 0 0 if (ref $opts->{'new_cursor'} ne 'HASH') { }
1438 0 0 unless exists $opts->{'new_cursor'}{'keys'} and exists $opts->{'new_cursor'}{'join'} and exists $opts->{'new_cursor'}{'sql'}
1445 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1453 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1459 0 0 if (ref $oq->{'named_filters'}{$named_filter} eq 'ARRAY')
1462 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1495 0 0 if defined $oq->{'joins'}{$joinAlias}[2]
1498 0 0 if (defined $whereSql) { }
1500 0 0 if scalar @whereBinds
1514 0 0 if (/\G\s*\(/cgs) { }
0 0 elsif (/\G\s*(\w+)\b/cgs) { }
1520 0 0 if $c eq $q
0 0 if ($q) { }
0 0 elsif ($c eq q['] or $c eq '"') { }
0 0 elsif ($c eq '(') { }
0 0 elsif ($c eq ')') { }
1538 0 0 if (/\G\s*([\d\w\_]+)\s*/cgs and lc $1 ne 'on')
1544 0 0 if (/\G\s*\((.*)\)\s*$/cgs)
1555 0 0 if ($part =~ /\b([\w\d\_]+)\.([\w\d\_]+)\b/) { }
1558 0 0 if ($dep eq $joinAlias) { }
1602 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1604 0 0 unless $sql =~ /\b$joinAlias\s*$/
1622 0 0 if @whereSql
1634 0 0 if $@
1635 0 0 unless defined $drivingTableCount
1636 0 0 if $count != $drivingTableCount
1699 0 0 if defined $oq->{'col_types'}
1710 0 0 if (exists $s->[3]{'col_type'}) { }
1726 0 0 unless defined $type->[1]
1738 0 0 if ($oq->{'dbtype'} eq 'Oracle' and $#binds == -1)
1746 0 0 if (%deps)
1763 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1767 0 0 unless $sql =~ /\b$joinAlias\s*$/
1783 0 0 if $#where > -1
1791 0 0 if ($oq->{'dbtype'} eq 'Oracle' or $oq->{'dbtype'} eq 'Microsoft SQL Server') { }
0 0 elsif ($oq->{'dbtype'} eq 'mysql') { }
1808 0 0 if ($@)
1821 0 0 unless my $type = $type_map->{$type_code}
1827 0 0 if ($selectColTypeOrder[$i] eq 'default')
1859 0 0 unless ref $deps eq 'ARRAY'
1881 0 0 if $maxRecurse == 0
1884 0 0 if (defined $oq->{'joins'}{$dep}[0])
1886 0 0 unless exists $idx{$parent_dep}
1892 0 0 unless (exists $idx{$dep})
1895 0 0 if (not defined $oq->{'joins'}{$dep}[0] or exists $oq->{'joins'}{$dep}[3]{'new_cursor'}) { }