Branch Coverage

blib/lib/DBIx/DataModel/Statement.pm
Criterion Covered Total %
branch 142 196 72.4


line true false branch
58 0 170 unless $source and $source->isa("DBIx::DataModel::Source")
74 31 139 if %other_args
116 0 13 unless $self->status >= "sqlized"
120 12 1 wantarray ? :
128 149 22 if (@args == 1) { }
1 21 elsif (@args == 3) { }
0 21 elsif (@args % 2 == 1) { }
129 149 0 if (&does($args[0], 'HASH')) { }
0 0 elsif (&does($args[0], 'ARRAY')) { }
149 26 145 if ($self->status < 3) { }
156 19 30 unless my $indices = $self->{'param_indices'}{$k}
173 0 111 unless $self->status <= "refined"
185 60 117 if (/^-where$/)
192 7 110 if (/^-fetch$/)
194 5 2 ref $v ? :
197 0 7 unless @pk_columns
198 0 7 unless @pk_columns == @$primary_key
201 1 6 unless &List::MoreUtils::all(sub { defined $_; } , @$primary_key)
217 36 74 if (/^-columns$/)
218 25 11 &does($v, 'ARRAY') ? :
219 0 36 if (my $old_cols = $args->{'-columns'})
220 0 0 unless (@$old_cols == 1 and $old_cols->[0] eq "*")
222 0 0 unless &any(sub { $_ eq $col; } , @$old_cols)
241 74 0 if (/^-( order_by | group_by | having | for | union(?:_all)? | intersect | except | minus | result_as | post_SQL | pre_exec | post_exec | post_bless | limit | offset | page_size | page_index | column_types | prepare_attrs | dbi_prepare_method | _left_cols | where_on | join_with_USING )$/x)
260 0 142 unless $self->status < "sqlized"
264 0 142 if @args
274 2 140 if $source_where
283 1 141 if $result_as eq "firstrow" and $self->schema->autolimit_firstrow
287 139 3 if ($result_as ne "subquery")
288 2 137 if ($args->{'-for'}) { }
137 0 elsif (not exists $args->{'-for'}) { }
297 3 139 if (my $where_on = $args->{'-where_on'})
299 1 2 unless &does($sqla_args{'-from'}, "ARRAY")
304 0 2 unless $join_op eq "-join"
312 0 4 unless my $join_cond = $by_dest_table{$table}
326 43 98 if (&does($sqla_args{'-from'}, "ARRAY"))
327 0 43 unless $sqla_args{'-from'}[0] eq "-join"
331 2 41 exists $args->{'-join_with_USING'} ? :
334 4 68 if ($join_with_USING) { }
335 4 0 if $join_cond->{'using'}
347 0 141 if ($args->{'-post_SQL'})
358 141 0 if (my $regex = $self->{'placeholder_regex'})
361 30 128 if $self->{'bound_params'}[$i] =~ /$regex/
364 141 0 if $self->{'pre_bound_params'}
372 0 86 if $callback
385 135 0 if @args or $self->status < "sqlized"
387 0 134 unless $self->status == "sqlized"
394 0 134 unless my $dbh = $self->schema->dbh
398 0 134 if (my $prepare_attrs = $self->{'args'}{'-prepare_attrs'})
412 0 496 if $self->status < "prepared"
422 131 4 if $self->status < "prepared"
425 0 134 if $self->{'offset'}
427 4 130 if @bind_args
439 4 130 if $args->{'-pre_exec'}
443 104 60 unless $self->{'param_indices'}
444 0 30 unless exists $self->{'bound_params'}[$indices->[0]]
447 0 134 if @unbound
456 4 130 if $args->{'-post_exec'}
471 135 8 if @_
475 10 131 &does($arg_result_as, 'ARRAY') ? :
485 0 140 unless my $subclass = ($cache_result_class{$_} ||= $self->_find_result_class($_))
497 6 0 unless (exists $self->{'row_count'})
498 1 5 if $self->status < "sqlized"
507 2 4 if ($limit_sql =~ /ROWNUM/) { }
3 1 elsif ($sql =~ s/\b$limit_sql//i) { }
510 1 1 if ($sql =~ s/^$limit_sql/$1/)
528 2 4 if $should_wrap
535 0 6 unless my $dbh = $self->schema->dbh
555 108 70 if $self->status < "executed"
557 0 177 unless my $sth = $self->sth
558 0 177 unless my $callback = $self->{'row_callback'}
560 85 92 if (not defined $n_rows) { }
563 25 10 $sth->fetch ? :
35 50 $self->{'reuse_row'} ? :
564 51 34 if ($row)
571 0 92 unless $n_rows > 0
572 0 92 if $self->{'reuse_row'}
575 92 35 unless my $row = $sth->fetchrow_hashref
595 0 0 unless +(shift())->{'args'}{'-page_size'}
596 0 0 unless +(shift())->{'args'}{'-page_index'}
597 134 0 unless +(shift())->{'offset'}
603 0 0 unless my $row_count = $self->row_count
632 1 106 unless $schema->{'is_singleton'} and not $schema->{'db_schema'}
637 59 48 unless $self->{'from_DB_handlers'}
641 17 156 if exists $row->{$column_name}
651 0 22 unless $self->status == "executed"
668 0 11 unless $self->status == "executed"
687 0 5 if ($callbacks)
710 21 59 unless $self->{'aliased_columns'}
712 9 12 if $column =~ s/^([^()]+) # supposed table name (without parens) \. # followed by a dot (?=[^()]+$) # followed by supposed col name (without parens) //x
717 12 9 if (not $table_name) { }
727 0 9 unless my $table = $meta_schema->table($table_name) || &firstval(sub { ($_->{'db_name'} || '') eq $table_name; } , $meta_source, $meta_source->ancestors) || &firstval(sub { uc($_->{'db_name'} || '') eq uc $table_name; } , $meta_source, $meta_source->ancestors)
735 1 58 if (my $col_types = $self->{'args'}{'-column_types'})
737 0 1 unless &does($columns, "ARRAY")
738 0 1 unless my $type = $self->schema->metadm->type($type_name)
747 46 107 unless my $from_DB_handler = $col_handlers->{'from_DB'}
770 1 33 if not $_ =~ /^Can't locate(?! object method)/
772 34 33 if $is_loaded