Branch Coverage

blib/lib/DBIx/DataModel/Statement.pm
Criterion Covered Total %
branch 150 200 75.0


line true false branch
57 0 172 unless $source and $source->isa("DBIx::DataModel::Source")
73 31 141 if %other_args
115 0 13 unless $self->status >= "sqlized"
119 12 1 wantarray ? :
127 151 22 if (@args == 1) { }
1 21 elsif (@args == 3) { }
0 21 elsif (@args % 2 == 1) { }
128 151 0 if (&does($args[0], 'HASH')) { }
0 0 elsif (&does($args[0], 'ARRAY')) { }
148 26 147 if ($self->status < 3) { }
155 19 30 unless my $indices = $self->{'param_indices'}{$k}
172 0 113 unless $self->status <= "refined"
184 60 121 if (/^-where$/)
191 7 114 if (/^-fetch$/)
193 5 2 ref $v ? :
196 0 7 unless @pk_columns
197 0 7 unless @pk_columns == @$primary_key
200 1 6 unless &List::MoreUtils::all(sub { defined $_; } , @$primary_key)
216 36 78 if (/^-columns$/)
217 25 11 &does($v, 'ARRAY') ? :
218 0 36 if (my $old_cols = $args->{'-columns'})
219 0 0 unless (@$old_cols == 1 and $old_cols->[0] eq "*")
221 0 0 unless &any(sub { $_ eq $col; } , @$old_cols)
240 78 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)
259 0 144 unless $self->status < "sqlized"
263 0 144 if @args
273 2 142 if $source_where
282 1 143 if $result_as eq "firstrow" and $self->schema->autolimit_firstrow
286 141 3 if ($result_as ne "subquery")
287 2 139 if ($args->{'-for'}) { }
139 0 elsif (not exists $args->{'-for'}) { }
296 3 141 if (my $where_on = $args->{'-where_on'})
298 1 2 unless &does($sqla_args{'-from'}, "ARRAY")
303 0 2 unless $join_op eq "-join"
311 0 4 unless my $join_cond = $by_dest_table{$table}
325 43 100 if (&does($sqla_args{'-from'}, "ARRAY"))
326 0 43 unless $sqla_args{'-from'}[0] eq "-join"
330 2 41 exists $args->{'-join_with_USING'} ? :
333 4 68 if ($join_with_USING) { }
334 4 0 if $join_cond->{'using'}
346 0 143 if ($args->{'-post_SQL'})
357 143 0 if (my $regex = $self->{'placeholder_regex'})
360 30 130 if $self->{'bound_params'}[$i] =~ /$regex/
363 143 0 if $self->{'pre_bound_params'}
371 0 114 if $callback
384 137 0 if @args or $self->status < "sqlized"
386 0 136 unless $self->status == "sqlized"
393 0 136 unless my $dbh = $self->schema->dbh
397 0 136 if (my $prepare_attrs = $self->{'args'}{'-prepare_attrs'})
411 0 502 if $self->status < "prepared"
421 133 4 if $self->status < "prepared"
424 0 136 if $self->{'offset'}
426 4 132 if @bind_args
438 4 132 if $args->{'-pre_exec'}
442 106 60 unless $self->{'param_indices'}
443 0 30 unless exists $self->{'bound_params'}[$indices->[0]]
446 0 136 if @unbound
455 4 132 if $args->{'-post_exec'}
470 137 8 if @_
474 10 133 &does($arg_result_as, 'ARRAY') ? :
484 0 142 unless my $subclass = ($cache_result_class{$_} ||= $self->_find_result_class($_))
496 6 0 unless (exists $self->{'row_count'})
497 1 5 if $self->status < "sqlized"
506 2 4 if ($limit_sql =~ /ROWNUM/) { }
3 1 elsif ($sql =~ s/\b$limit_sql//i) { }
509 1 1 if ($sql =~ s/^$limit_sql/$1/)
527 2 4 if $should_wrap
534 0 6 unless my $dbh = $self->schema->dbh
555 110 70 if $self->status < "executed"
557 0 179 unless my $sth = $self->sth
558 0 179 unless my $callback = $self->{'row_callback'}
560 85 94 if (not defined $n_rows) { }
563 25 10 $sth->fetch ? :
35 50 $self->{'reuse_row'} ? :
564 51 34 if ($row)
571 0 94 unless $n_rows > 0
572 0 94 if $self->{'reuse_row'}
575 94 63 unless my $row = $sth->fetchrow_hashref
595 133 2 unless +(shift())->{'args'}{'-page_size'}
596 133 2 unless +(shift())->{'args'}{'-page_index'}
601 136 133 unless (exists $self->{'offset'})
604 1 135 exists $self->{'args'}{'-offset'} ? :
615 0 0 unless my $row_count = $self->row_count
645 1 134 unless $schema->{'is_singleton'} and not $schema->{'db_schema'}
650 61 74 unless $self->{'from_DB_handlers'}
654 17 240 if exists $row->{$column_name}
664 0 22 unless $self->status == "executed"
684 0 2 unless exists $self->{'nb_fetched_rows'}
695 0 11 unless $self->status == "executed"
714 0 5 if ($callbacks)
737 21 61 unless $self->{'aliased_columns'}
739 9 12 if $column =~ s/^([^()]+) # supposed table name (without parens) \. # followed by a dot (?=[^()]+$) # followed by supposed col name (without parens) //x
744 12 9 if (not $table_name) { }
754 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)
762 1 60 if (my $col_types = $self->{'args'}{'-column_types'})
764 0 1 unless &does($columns, "ARRAY")
765 0 1 unless my $type = $self->schema->metadm->type($type_name)
774 48 113 unless my $from_DB_handler = $col_handlers->{'from_DB'}
797 1 33 if not $_ =~ /^Can't locate(?! object method)/
799 34 33 if $is_loaded