Branch Coverage

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


line true false branch
68 0 0 if $sth->{'_already_executed'}
72 0 0 if $sth->count == 0
88 0 0 if @binds
91 0 0 if (not $sth->{'oq'}{'joins'}{$from_dep}[0]) { }
0 0 elsif (not defined $sth->{'oq'}{'joins'}{$from_dep}[2]) { }
95 0 0 unless $sql =~ /\b$from_dep\s*$/
109 0 0 if $old_join_sql ne ''
119 0 0 if $old_join_sql
120 0 0 if $c->{'where_sql'}
121 0 0 if @where
126 0 0 $c->{'order_by_sql'} ? :
133 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}{'AutoSetLongReadLen'} and scalar @{$c->{'selected_lobs'};})
143 0 0 if (not $sth->{'oq'}{'dbh'}{'LongReadLen'} or $SetLongReadLen > $sth->{'oq'}{'dbh'}{'LongReadLen'})
170 0 0 if ($sth->{'oq'}{'joins'}{$sd->[0]}[3]{'new_cursor_order_by'})
185 0 0 if defined $sth->{'oq'}{'joins'}{$joinAlias}[2]
188 0 0 if (not defined $joinWhereSql) { }
197 0 0 if ($joinWhereSql)
198 0 0 if $where_sql
214 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}{'AutoSetLongReadLen'} and scalar @{$c->{'selected_lobs'};})
222 0 0 if (not $sth->{'oq'}{'dbh'}{'LongReadLen'} or $SetLongReadLen > $sth->{'oq'}{'dbh'}{'LongReadLen'})
233 0 0 if $sth->{'oq'}{'debug'}
244 0 0 if ($@)
260 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') { }
278 0 0 unless exists $sth->{'oq'}{'select'}{'U_ID'}
284 0 0 if ($sql =~ s/\ (ORDER BY\ .*?)$//) { }
0 0 elsif (exists $sth->{'oq'}{'select'}{'U_ID'}) { }
288 0 0 if ($bindCount > 0)
299 0 0 if ($sql =~ s/^(\s*SELECT\s*)//)
333 0 0 unless (exists $sth->{'show'})
342 0 0 unless exists $sth->{'filter'}
343 0 0 unless exists $sth->{'sort'}
368 0 0 if exists $sth->{'oq'}{'select'}{$show}
376 0 0 if ($sth->{'oq'}{'select'}{$colAlias}[3]{'always_select'})
390 0 0 if ($sth->{'oq'}{'select'}{$colAlias}[3]{'is_hidden'})
394 0 0 unless (exists $dep_idx->{$_})
399 0 0 if $all_deps_met
425 0 0 if $parent_cursor_idx eq ''
436 0 0 unless $select
443 0 0 if (not $select->[3]{'select_sql'} and $select->[3]{'date_format'}) { }
445 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' or $sth->{'oq'}{'dbtype'} eq 'Pg') { }
0 0 elsif ($sth->{'oq'}{'dbtype'} eq 'mysql') { }
461 0 0 if ($sth->{'oq'}{'dbtype'} eq 'Oracle' and $sth->{'oq'}->get_col_types('select')->{$show} eq 'clob')
467 0 0 if ($select_sql->[0] ne '')
530 0 0 if $sth->{$filterType} eq ''
535 0 0 if ($c->{'where_sql'}) { }
541 0 0 if $filterType eq 'filter'
577 0 0 unless $sth->count > 0
589 0 0 if (my $v = $c->{'sth'}->fetch) { }
594 0 0 if ($c->{'sth'}{'TYPE'}[$i] eq '3' and $v->[$i] =~ /\./)
630 0 0 if $c->{'sth'}
641 0 0 unless (defined $sth->{'count'})
658 0 0 if @binds
661 0 0 if (not $sth->{'oq'}{'joins'}{$from_dep}[0]) { }
0 0 elsif (not $sth->{'oq'}{'joins'}{$from_dep}[2]) { }
664 0 0 unless $sql =~ /\b$from_dep\s*$/
677 0 0 if ($sql)
678 0 0 if $old_join_sql ne ''
689 0 0 if $old_join_sql
690 0 0 if $c->{'where_sql'}
691 0 0 if @where
705 0 0 if $sth->{'oq'}{'debug'}
707 0 0 if ($@)
724 0 0 if (wantarray) { }
819 0 0 unless $oq->{'dbh'}
821 0 0 unless ref $oq->{'select'} eq 'HASH'
823 0 0 unless ref $oq->{'joins'} eq 'HASH'
829 0 0 if $oq->{'dbtype'} eq 'ODBC'
851 0 0 if $f eq ''
865 0 0 if ($f =~ /\G(\w+)\s*\(\s*/cg) { }
868 0 0 unless (exists $oq->{'named_filters'}{$namedFilter})
876 0 0 if ($f =~ /\G\)\s*/cg) { }
0 0 elsif ($f =~ /\G(\-?\d*\.\d+)\s*\,*\s*/cg or $f =~ /\G(\-?\d+)\s*\,*\s*/cg or $f =~ /\G\'([^\']*)\'\s*\,*\s*/cg or $f =~ /\G\"([^\"]*)\"\s*\,*\s*/cg or $f =~ /\G(\w+)\s*\,*\s*/cg) { }
889 0 0 if $error
893 0 0 if ($parenthesis > 0)
909 0 0 if ($f =~ /\G\[([^\]]+)\]\s*/cg) { }
0 0 elsif ($f =~ /\G(\w+)\s*/cg) { }
916 0 0 unless ($oq->{'select'}{$lexp})
923 0 0 if ($f =~ /\G(\!\=|\=|\<\=|\>\=|\<|\>|like|not\ ?like|contains|not\ ?contains)\s*/cig) { }
932 0 0 if ($f =~ /\G\[([^\]]+)\]\s*/cg) { }
0 0 elsif ($f =~ /\G\'([^\']*)\'\s*/cg or $f =~ /\G\"([^\"]*)\"\s*/cg) { }
0 0 elsif ($f =~ /\G(\S+)\s*/cg) { }
948 0 0 if ($oq->{'select'}{$rexp})
960 0 0 if ($parenthesis > 0)
970 0 0 if ($f =~ /(AND|OR)\s*/cig) { }
978 0 0 if ($error)
1002 0 0 if ($exp eq 'AND') { }
0 0 elsif ($exp eq 'OR') { }
0 0 elsif ($exp->[0] == 1) { }
0 0 elsif ($exp->[0] == 2) { }
0 0 elsif ($exp->[0] == 3) { }
1021 0 0 if $leftOpts->{'filter_sql'}
1022 0 0 if ref $leftSql eq 'ARRAY'
1030 0 0 if ($rightName eq '') { }
0 0 elsif ($rightName =~ /\s/) { }
1036 0 0 if $leftOpts->{'db_formatter'}
1039 0 0 if ($rval eq '') { }
1040 0 0 if ($leftType eq 'char' or $leftType eq 'clob') { }
1041 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
1048 0 0 $operator =~ /\!|NOT/i ? :
1050 0 0 $operator =~ /\!|NOT/i ? :
1057 0 0 if ($operator =~ /\=|\<|\>/) { }
1060 0 0 if ($leftType eq 'date' or $leftType eq 'datetime') { }
0 0 elsif ($leftType eq 'num' and not $rval =~ /^(\-?\d*\.\d+|\-?\d+)$/) { }
0 0 elsif ($oq->{'dbtype'} eq 'Oracle' and $leftType eq 'clob') { }
1063 0 0 if ($rval =~ /today\s*([\+\-])\s*(\d+)\s*(minute|hour|day|week|month|year|)s?/i) { }
0 0 elsif ($rval =~ /today\s*/i) { }
1068 0 0 if $num != 1
1069 0 0 if $sign eq '-'
1071 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
1072 0 0 $leftType eq 'datetime' ? :
1073 0 0 if ($unit eq 'MINUTE') { }
0 0 elsif ($unit eq 'HOUR') { }
0 0 elsif ($unit eq 'WEEK') { }
0 0 elsif ($unit eq 'MONTH') { }
0 0 elsif ($unit eq 'YEAR') { }
1085 0 0 $leftType eq 'datetime' ? :
1092 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
1093 0 0 $leftType eq 'datetime' ? :
1095 0 0 $leftType eq 'datetime' ? :
1103 0 0 if ($rval =~ m[^(\d\d\d\d)[\-/](\d\d?)[\-/](\d\d?)]) { }
0 0 elsif ($rval =~ m[^(\d\d?)[\-/](\d\d?)[\-/](\d\d\d\d)]) { }
0 0 elsif ($rval =~ m[^(\d\d?)[\-/](\d\d?)[\-/](\d\d)\b]) { }
0 0 elsif ($rval =~ m[^(\d\d\d\d)[\-/](\d\d?)]) { }
0 0 elsif ($rval =~ /^(\d\d\d\d)/) { }
1127 0 0 if ($leftType eq 'datetime')
1128 0 0 if ($rval =~ /\b(\d\d?)\:(\d\d?)[\:\.](\d\d?)/) { }
0 0 elsif ($rval =~ /\b(\d\d?)\:(\d\d?)/) { }
0 0 elsif ($rval =~ /\b(\d\d?)\s*(am|pm)/i) { }
1141 0 0 if ($rval =~ /A/i) { }
0 0 elsif ($rval =~ /P/i) { }
1149 0 0 if ($oq->{'dbtype'} eq 'mysql') { }
1152 0 0 if ($m)
1155 0 0 if ($d)
1159 0 0 if ($mi ne '')
1160 0 0 $hourType ? :
1163 0 0 if ($s ne '')
1167 0 0 if ($hourType)
1178 0 0 if ($leftType eq 'datetime' and $mi eq '')
1187 0 0 if ($m)
1190 0 0 if ($d)
1194 0 0 if ($mi ne '')
1195 0 0 $hourType ? :
1198 0 0 if ($s ne '')
1202 0 0 if ($hourType)
1214 0 0 if ($leftType eq 'datetime' and $mi eq '')
1223 0 0 if ($oq->{'dbtype'} eq 'mysql') { }
1251 0 0 if ($operatorName =~ /contains/i)
1252 0 0 if !$leftType eq 'char' or $leftType eq 'clob'
1253 0 0 $operatorName =~ /not/i ? :
1258 0 0 if ($operator =~ /like/i)
1266 0 0 if ($leftOpts->{'date_format'})
1267 0 0 if ($oq->{'dbtype'} eq 'mysql') { }
1284 0 0 if ++$i == 50
1286 0 0 unless $parentDep
1292 0 0 if ($oq->{'joins'}{$path[-1]}[3]{'new_cursor'}) { }
1300 0 0 if (@path)
1313 0 0 if ($fromSql =~ /^(.*)\bON\s*\((.*)\)\s*$/is) { }
1322 0 0 if ($rightName eq q['']) { }
0 0 elsif ($operator eq '!=') { }
0 0 elsif ($operator =~ s/NOT\ //) { }
1323 0 0 if ($operator eq '=') { }
0 0 elsif ($operator eq 'IS NULL') { }
1346 0 0 if @preBinds
1354 0 0 if $rightSql ne ''
1361 0 0 if $rightName ne ''
1375 0 0 if (ref $f eq 'ARRAY') { }
0 0 elsif (ref $f eq 'HASH') { }
1379 0 0 unless ref $f->{'sql_generator'} eq 'CODE'
1384 0 0 if ref $filterSql eq 'ARRAY'
1396 0 0 if (ref $filterDeps eq 'ARRAY') { }
0 0 elsif ($filterDeps) { }
1415 0 0 if $leftOpts->{'filter_sql'}
1416 0 0 if ref $leftSql eq 'ARRAY'
1423 0 0 if $rightOpts->{'filter_sql'}
1424 0 0 if ref $rightSql eq 'ARRAY'
1429 0 0 if ($leftType ne $rightType)
1430 0 0 if ($oq->{'dbtype'} eq 'mysql') { }
1431 0 0 unless $leftType eq 'char'
1432 0 0 unless $rightType eq 'char'
1434 0 0 unless $leftType eq 'char'
1435 0 0 unless $rightType eq 'char'
1440 0 0 if ($leftType eq 'char')
1441 0 0 $oq->{'dbtype'} eq 'Oracle' ? :
1447 0 0 if ($operatorName =~ /contains/i)
1448 0 0 $operatorName =~ /not/i ? :
1451 0 0 $oq->{'dbtype'} eq 'Oracle' || $oq->{'dbtype'} eq 'SQLite' ? :
1474 0 0 if ($parenthesis > 0)
1494 0 0 if ($str =~ /\G(\w+)\(\s*/cg) { }
0 0 elsif ($str =~ /\G\[?(\w+)\]?\s*/cg) { }
0 0 elsif ($str =~ /\G$/cg) { }
0 0 elsif ($str =~ /\G\,\s*/cg) { }
1498 0 0 if ($str =~ /\G\)\s*/cg) { }
0 0 elsif ($str =~ /\G(\-?\d*\.\d+)\s*\,*\s*/cg or $str =~ /\G(\-?\d+)\s*\,*\s*/cg or $str =~ /\G\'([^\']*)\'\s*\,*\s*/cg or $str =~ /\G\"([^\"]*)\"\s*\,*\s*/cg or $str =~ /\G(\w+)\s*\,*\s*/cg) { }
1514 0 0 if (ref $s eq 'ARRAY') { }
0 0 elsif (ref $s eq 'HASH') { }
1518 0 0 unless ref $s->{'sql_generator'} eq 'CODE'
1520 0 0 if ref $sortSql eq 'ARRAY'
1534 0 0 unless $oq->{'select'}{$colAlias}
1537 0 0 if $opts->{'sort_sql'}
1538 0 0 if ref $sortSql eq 'ARRAY'
1541 0 0 if ($str =~ /\Gdesc\s*/cig)
1574 0 0 unless exists $oq->{'AutoSetLongReadLen'}
1591 0 0 if (ref $oq->{$key}{$alias} eq 'ARRAY' and defined $oq->{$key}{$alias}[$i] and ref $oq->{$key}{$alias}[$i] ne 'ARRAY')
1604 0 0 if exists $opts->{$opt} and ref $opts->{$opt} ne 'ARRAY'
1610 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1617 0 0 if (exists $opts->{'new_cursor'})
1618 0 0 if (ref $opts->{'new_cursor'} ne 'HASH') { }
1624 0 0 unless exists $opts->{'new_cursor'}{'keys'} and exists $opts->{'new_cursor'}{'join'} and exists $opts->{'new_cursor'}{'sql'}
1631 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1639 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1645 0 0 if (ref $oq->{'named_filters'}{$named_filter} eq 'ARRAY')
1648 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1681 0 0 if defined $oq->{'joins'}{$joinAlias}[2]
1684 0 0 if (defined $whereSql) { }
1686 0 0 if scalar @whereBinds
1700 0 0 if (/\G\s*\(/cgs) { }
0 0 elsif (/\G\s*(\w+)\b/cgs) { }
1706 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 ')') { }
1724 0 0 if (/\G\s*([\d\w\_]+)\s*/cgs and lc $1 ne 'on')
1730 0 0 if (/\G\s*\((.*)\)\s*$/cgs)
1741 0 0 if ($part =~ /\b([\w\d\_]+)\.([\w\d\_]+)\b/) { }
1744 0 0 if ($dep eq $joinAlias) { }
1788 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1790 0 0 unless $sql =~ /\b$joinAlias\s*$/
1809 0 0 if @whereSql
1821 0 0 if $@
1822 0 0 unless defined $drivingTableCount
1823 0 0 if $count != $drivingTableCount
1893 0 0 if defined $oq->{'col_types'}
1904 0 0 if (exists $s->[3]{'col_type'}) { }
1920 0 0 unless defined $type->[1]
1932 0 0 if ($oq->{'dbtype'} eq 'Oracle' and $#binds == -1)
1940 0 0 if (%deps)
1957 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1961 0 0 unless $sql =~ /\b$joinAlias\s*$/
1977 0 0 if $#where > -1
1985 0 0 if ($oq->{'dbtype'} eq 'Oracle' or $oq->{'dbtype'} eq 'Microsoft SQL Server') { }
0 0 elsif ($oq->{'dbtype'} eq 'mysql') { }
2002 0 0 if ($@)
2015 0 0 unless my $type = $type_map->{$type_code}
2021 0 0 if ($selectColTypeOrder[$i] eq 'default')
2055 0 0 if $oq->{'joins'}{$joinAlias}[3]{'always_join'}
2078 0 0 if $maxRecurse == 0
2081 0 0 if (defined $oq->{'joins'}{$dep}[0])
2083 0 0 unless exists $idx{$parent_dep}
2089 0 0 unless (exists $idx{$dep})
2092 0 0 if (not defined $oq->{'joins'}{$dep}[0] or exists $oq->{'joins'}{$dep}[3]{'new_cursor'}) { }