Branch Coverage

blib/lib/Jifty/DBI/Collection.pm
Criterion Covered Total %
branch 223 330 67.5


line true false branch
98 2 228 if ref $proto
118 230 0 if $args{'handle'}
119 4 226 if $args{'derived'}
201 0 48 unless $records
205 45 3 unless $self->prefetch_related
207 45 3 unless (@tables)
215 0 45 if ($records->err)
226 0 18 if $$self{'group_by'}
227 10 8 unless $order[0] and $order[-1] eq $main_pkey
236 36 0 if keys %tmp
253 0 10 unless $class
258 4 6 if ($class->isa('Jifty::DBI::Collection')) { }
6 0 elsif ($class->isa('Jifty::DBI::Record')) { }
269 0 6 if @rows > 1
272 6 0 if @rows
283 0 3 if ($records->err)
327 20 220 unless defined $$self{'items'}
344 0 78 unless $records
347 0 78 if $records->err
349 0 78 $all ? :
410 19 314 if ($$self{'joins'} and keys %{$$self{'joins'};}) { }
428 18 0 if ($$self{'joins'})
430 14 4 unless $$_{'is_distinct'}
458 0 246 if $self->derived
464 246 0 if ($self->_is_limited)
467 5 241 if ($self->distinct_required) { }
495 3 243 if ($$self{'columns'} and @{$$self{'columns'};}) { }
500 243 3 unless $self->prefetch_related
505 2 1 if ($class->isa('Jifty::DBI::Collection')) { }
1 0 elsif ($class->isa('Jifty::DBI::Record')) { }
529 0 10 unless $self->prefetch_related
531 0 10 unless $related
542 0 246 if ($only_cols)
602 1 2 if (@_ and $$self{'joins'}{$_[0]})
617 0 3 unless $args{'name'}
624 2 1 unless ($args{'alias'})
631 1 2 unless ($args{'class'})
635 1 0 if $column
637 0 1 unless $args{'class'}
641 0 3 unless (UNIVERSAL::isa($args{'class'}, 'Jifty::DBI::Record') or UNIVERSAL::isa($args{'class'}, 'Jifty::DBI::Collection'))
649 3 0 unless $self->prefetch_related
673 0 0 if UNIVERSAL::isa($class, 'Jifty::DBI::Collection')
676 0 0 unless $column
698 0 2 unless $column
703 0 2 unless ($classname)
707 1 1 if (UNIVERSAL::isa($classname, 'Jifty::DBI::Collection')) { }
1 0 elsif (UNIVERSAL::isa($classname, 'Jifty::DBI::Record')) { }
740 0 2 unless ($classname)
744 1 1 if (UNIVERSAL::isa($classname, 'Jifty::DBI::Collection')) { }
1 0 elsif (UNIVERSAL::isa($classname, 'Jifty::DBI::Record')) { }
791 18 306 $self->_is_joined ? :
804 0 78 if $self->derived
808 78 0 if ($self->_is_limited)
813 11 67 if ($self->distinct_required or $self->prefetch_related) { }
835 0 0 if $self->derived
836 0 0 if $$self{'must_redo_search'}
862 65 18 if ($$self{'itemscount'} < $self->_record_count) { }
880 8 83 unless $self->_is_limited
882 46 37 if $$self{'must_redo_search'}
884 67 16 if ($$self{'itemscount'} < $self->_record_count) { }
961 4 0 @_ % 2 ? :
968 0 4 if $self->derived
971 0 4 if ($self->_is_limited)
978 3 1 if ($args{'sort'})
979 2 1 $args{'sort'} =~ /^des/i ? :
983 0 4 unless my $sth = $self->_handle->simple_query($query_string)
985 0 4 unless $sth->bind_col(1, \$value)
987 1 3 if ($args{'max'}) { }
1013 2 6 unless $self->_is_limited
1016 2 4 if $$self{'must_redo_search'}
1040 0 185 unless $class
1043 9 176 unless (exists $cache{$class})
1069 2 946 if (@_) { }
231 715 elsif (not ref $self && $$self{'record_class'}) { }
1070 2 0 if @_
1071 0 2 if ref $$self{'record_class'}
1075 0 231 unless $class =~ s/(?
1077 3 228 unless ref $self
1232 0 279 if $self->derived
1237 0 279 if (defined $args{'leftjoin'} and not defined $args{'alias'})
1245 271 8 unless (defined $args{'alias'})
1248 271 0 if (not defined $args{'table'} or $args{'table'} eq $self->table) { }
1267 0 279 $$self{'joins'}{$args{'alias'}} && $$self{'joins'}{$args{'alias'}}{'class'} ? :
1275 12 260 if $column_obj and $column_obj->encode_on_select and not $args{'operator'} =~ /IS/
1283 0 279 if ($args{'column'} =~ /\W/)
1292 0 279 unless ($args{'operator'} =~ /^(=|<|>|!=|<>|<=|>= |(NOT\s*)?LIKE |(NOT\s*)?(STARTS|ENDS)_?WITH |(NOT\s*)?MATCHES |IS(\s*NOT)? |IN)$/xi)
1310 279 0 $args{'alias'} ? :
1319 31 248 if ($value_ref)
1320 2 29 if ($value_ref ne 'ARRAY' and $args{'value'}->isa('Jifty::DBI::Record')) { }
29 0 elsif ($value_ref eq 'ARRAY') { }
1323 2 0 defined $column_obj && defined $column_obj->by ? :
1331 2 60 defined $column_obj && defined $column_obj->by ? :
1335 1 61 ref $_ && $_->isa('Jifty::DBI::Record') ? :
1348 25 254 if ($args{'operator'} =~ /MATCHES/i) { }
17 237 elsif ($args{'operator'} =~ /STARTS_?WITH/i) { }
17 220 elsif ($args{'operator'} =~ /ENDS_?WITH/i) { }
1358 54 225 if ($args{'operator'} =~ /^IS(\s*NOT)?$/i)
1364 223 56 if ($args{'quote_value'})
1365 29 194 if ($value_ref eq 'ARRAY') { }
1372 4 275 if ($args{'escape'})
1380 0 279 if ($args{'leftjoin'}) { }
1390 223 56 if (defined $args{'value'} and $args{'quote_value'})
1392 114 109 if (defined $args{'case_sensitive'}) { }
103 6 elsif ($column_obj) { }
1400 68 149 if ($column_obj and not $case_sensitive and not $column_obj->is_string)
1404 67 156 if (not $case_sensitive and $self->_handle->case_sensitive)
1411 29 250 if ($value_ref eq 'ARRAY')
1412 0 29 unless $args{'operator'} =~ /^(IN|=)$/i
1428 1 278 if ($$self{'_open_parens'}{$clause_id})
1432 274 5 if (lc($args{'entry_aggregator'} || '') eq 'none' or not @$restriction) { }
1442 279 0 if (defined $args{'alias'}) { }
1535 308 16 if @subclauses
1554 4 308 if $result
1557 10 318 if (not ref $entry) { }
1576 0 0 if (($$self{$type} || '') ne ($value || ''))
1632 0 7 if $self->derived
1633 6 1 if (@_)
1648 0 8 if $self->derived
1649 8 0 if (@_)
1652 7 1 unless (UNIVERSAL::isa($args[0], 'HASH'))
1682 243 13 unless $$self{'order_by'}
1693 12 17 if ($rowhash{'order'} =~ /^des/i) { }
1699 6 23 if ($rowhash{'function'} and not defined $rowhash{'column'}) { }
23 0 elsif (defined $rowhash{'alias'} and $rowhash{'column'}) { }
1700 5 1 $clause ? :
1707 0 23 if ($rowhash{'column'} =~ /\W/)
1712 12 11 $clause ? :
1713 1 22 if $rowhash{'function'}
1714 18 5 if $rowhash{'alias'}
1716 1 22 if $rowhash{'function'}
1720 12 1 if $clause
1758 0 2 if $self->derived
1761 2 0 unless (UNIVERSAL::isa($args[0], 'HASH'))
1776 244 3 unless $$self{'group_by'}
1788 0 3 if ($rowhash{'function'}) { }
3 0 elsif ($rowhash{'alias'} and $rowhash{'column'}) { }
1789 0 0 $clause ? :
1795 0 3 if ($rowhash{'column'} =~ /\W/)
1800 0 3 $clause ? :
1805 3 0 if ($clause) { }
1826 2 3 if ($refers_to->can('table')) { }
1835 2 3 $class ? :
1898 0 12 if $self->derived
1924 0 0 if $self->derived
1931 0 0 if ($args{'current_page'} eq 'all')
1968 0 246 if (@_)
2001 13 106 unless $self->_is_limited
2005 82 24 if ($$self{'must_redo_search'}) { }
2008 78 4 unless $$self{'raw_rows'}
2052 0 0 unless $self->_is_limited
2056 0 0 if ($$self{'must_redo_search'} or not $$self{'count_all'}) { }
2059 0 0 unless $$self{'count_all'}
2081 8 10 unless $self->count
2083 6 4 if ($self->_items_counter == $self->count) { }
2098 0 0 if (@_)
2159 0 3 if (my $func = $args{'function'})
2160 0 0 if ($func =~ /^DISTINCT\s*COUNT$/i) { }
0 0 elsif ($func =~ /\?/) { }
0 0 elsif (not $func =~ /\(/) { }
2179 3 0 if $table eq $self->table and not $args{'alias'}
2214 0 0 unless eval { do { $dbh->column_info('', '', $table, '')->fetchall_arrayref([3]) } } or $dbh->selectall_arrayref("DESCRIBE $table;") or $dbh->selectall_arrayref("DESCRIBE \u$table;")
2238 0 0 unless my $table = $args{'table'}
2239 0 0 unless my $column = $args{'column'}
2253 240 319 if @_
2313 0 0 if defined $ret and not $ret