Branch Coverage

lib/DBIx/OptimalQuery.pm
Criterion Covered Total %
branch 0 512 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\'([^\']*)\'\s*\,?\s*/cg or $f =~ /\G\"([^\"]*)\"\s*\,?\s*/cg or $f =~ /\G([^\)\,]*)\s*\,?\s*/cg) { }
887 0 0 if $error
891 0 0 if ($parenthesis > 0)
907 0 0 if ($f =~ /\G\[([^\]]+)\]\s*/cg) { }
0 0 elsif ($f =~ /\G(\w+)\s*/cg) { }
914 0 0 unless ($oq->{'select'}{$lexp})
921 0 0 if ($f =~ /\G(\!\=|\=|\<\=|\>\=|\<|\>|like|not\ ?like|contains|not\ ?contains)\s*/cig) { }
930 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) { }
946 0 0 if ($oq->{'select'}{$rexp})
958 0 0 if ($parenthesis > 0)
968 0 0 if ($f =~ /(AND|OR)\s*/cig) { }
976 0 0 if ($error)
1000 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) { }
1019 0 0 if $leftOpts->{'filter_sql'}
1020 0 0 if ref $leftSql eq 'ARRAY'
1028 0 0 if ($rightName eq '') { }
0 0 elsif ($rightName =~ /\s/) { }
1034 0 0 if $leftOpts->{'db_formatter'}
1037 0 0 if ($rval eq '') { }
1038 0 0 if ($leftType eq 'char' or $leftType eq 'clob') { }
1039 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
1046 0 0 $operator =~ /\!|NOT/i ? :
1048 0 0 $operator =~ /\!|NOT/i ? :
1055 0 0 if ($operator =~ /\=|\<|\>/) { }
1058 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') { }
1061 0 0 if ($rval =~ /today\s*([\+\-])\s*(\d+)\s*(minute|hour|day|week|month|year|)s?/i) { }
0 0 elsif ($rval =~ /today\s*/i) { }
1066 0 0 if $num != 1
1067 0 0 if $sign eq '-'
1069 0 0 if ($oq->{'dbtype'} eq 'Oracle') { }
1070 0 0 $leftType eq 'datetime' ? :
1071 0 0 if ($unit eq 'MINUTE') { }
0 0 elsif ($unit eq 'HOUR') { }
0 0 elsif ($unit eq 'DAY') { }
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'
1397 0 0 if (ref $filterDeps eq 'ARRAY') { }
0 0 elsif ($filterDeps) { }
1416 0 0 if $leftOpts->{'filter_sql'}
1417 0 0 if ref $leftSql eq 'ARRAY'
1424 0 0 if $rightOpts->{'filter_sql'}
1425 0 0 if ref $rightSql eq 'ARRAY'
1430 0 0 if ($leftType ne $rightType)
1431 0 0 if ($oq->{'dbtype'} eq 'mysql') { }
1432 0 0 unless $leftType eq 'char'
1433 0 0 unless $rightType eq 'char'
1435 0 0 unless $leftType eq 'char'
1436 0 0 unless $rightType eq 'char'
1441 0 0 if ($leftType eq 'char')
1442 0 0 $oq->{'dbtype'} eq 'Oracle' ? :
1448 0 0 if ($operatorName =~ /contains/i)
1449 0 0 $operatorName =~ /not/i ? :
1452 0 0 $oq->{'dbtype'} eq 'Oracle' || $oq->{'dbtype'} eq 'SQLite' ? :
1475 0 0 if ($parenthesis > 0)
1495 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) { }
1499 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) { }
1515 0 0 if (ref $s eq 'ARRAY') { }
0 0 elsif (ref $s eq 'HASH') { }
1519 0 0 unless ref $s->{'sql_generator'} eq 'CODE'
1521 0 0 if ref $sortSql eq 'ARRAY'
1535 0 0 unless $oq->{'select'}{$colAlias}
1538 0 0 if $opts->{'sort_sql'}
1539 0 0 if ref $sortSql eq 'ARRAY'
1542 0 0 if ($str =~ /\Gdesc\s*/cig)
1575 0 0 unless exists $oq->{'AutoSetLongReadLen'}
1592 0 0 if (ref $oq->{$key}{$alias} eq 'ARRAY' and defined $oq->{$key}{$alias}[$i] and ref $oq->{$key}{$alias}[$i] ne 'ARRAY')
1605 0 0 if exists $opts->{$opt} and ref $opts->{$opt} ne 'ARRAY'
1611 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1618 0 0 if (exists $opts->{'new_cursor'})
1619 0 0 if (ref $opts->{'new_cursor'} ne 'HASH') { }
1625 0 0 unless exists $opts->{'new_cursor'}{'keys'} and exists $opts->{'new_cursor'}{'join'} and exists $opts->{'new_cursor'}{'sql'}
1632 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1640 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1646 0 0 if (ref $oq->{'named_filters'}{$named_filter} eq 'ARRAY')
1649 0 0 if defined $dep and not exists $oq->{'joins'}{$dep}
1682 0 0 if defined $oq->{'joins'}{$joinAlias}[2]
1685 0 0 if (defined $whereSql) { }
1687 0 0 if scalar @whereBinds
1701 0 0 if (/\G\s*\(/cgs) { }
0 0 elsif (/\G\s*(\w+)\b/cgs) { }
1707 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 ')') { }
1725 0 0 if (/\G\s*([\d\w\_]+)\s*/cgs and lc $1 ne 'on')
1731 0 0 if (/\G\s*\((.*)\)\s*$/cgs)
1742 0 0 if ($part =~ /\b([\w\d\_]+)\.([\w\d\_]+)\b/) { }
1745 0 0 if ($dep eq $joinAlias) { }
1789 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1791 0 0 unless $sql =~ /\b$joinAlias\s*$/
1810 0 0 if @whereSql
1822 0 0 if $@
1823 0 0 unless defined $drivingTableCount
1824 0 0 if $count != $drivingTableCount
1894 0 0 if defined $oq->{'col_types'}
1905 0 0 if (exists $s->[3]{'col_type'}) { }
1921 0 0 unless defined $type->[1]
1933 0 0 if ($oq->{'dbtype'} eq 'Oracle' and $#binds == -1)
1941 0 0 if (%deps)
1958 0 0 if (not $oq->{'joins'}{$joinAlias}[0]) { }
0 0 elsif (defined $oq->{'joins'}{$joinAlias}[2]) { }
1962 0 0 unless $sql =~ /\b$joinAlias\s*$/
1978 0 0 if $#where > -1
1986 0 0 if ($oq->{'dbtype'} eq 'Oracle' or $oq->{'dbtype'} eq 'Microsoft SQL Server') { }
0 0 elsif ($oq->{'dbtype'} eq 'mysql') { }
2003 0 0 if ($@)
2016 0 0 unless my $type = $type_map->{$type_code}
2022 0 0 if ($selectColTypeOrder[$i] eq 'default')
2056 0 0 if $oq->{'joins'}{$joinAlias}[3]{'always_join'}
2079 0 0 if $maxRecurse == 0
2082 0 0 if (defined $oq->{'joins'}{$dep}[0])
2084 0 0 unless exists $idx{$parent_dep}
2090 0 0 unless (exists $idx{$dep})
2093 0 0 if (not defined $oq->{'joins'}{$dep}[0] or exists $oq->{'joins'}{$dep}[3]{'new_cursor'}) { }