Branch Coverage

blib/lib/DBIx/QuickORM/Handle.pm
Criterion Covered Total %
branch 219 484 45.2


line true false branch
63 0 252 if 1 < grep({$_;} @{$self;}{"async", "aside", "forked"})
65 0 252 unless my $con = $self->connection
66 0 252 unless builtin::blessed($con) and $con->isa("DBIx::QuickORM::Connection")
69 0 252 unless my $source = $self->{'source'}
70 0 252 unless builtin::blessed($source) and $source->DOES("DBIx::QuickORM::Role::Source")
75 0 252 if (my $builder = $self->{'sql_builder'})
76 0 0 unless builtin::blessed($builder) and $builder->DOES("DBIx::QuickORM::Role::SQLBuilder")
80 26 226 if (my $row = $self->{'row'})
81 0 26 if $row and not $row->DOES("DBIx::QuickORM::Role::Row")
83 0 26 if $self->{'where'}
85 22 4 if $self->_has_pk
88 142 110 if ($self->_has_pk and not $self->{'where'})
89 0 142 if $self->{'limit'}
90 0 142 if $self->{'order_by'}
95 0 252 if (my $omit = $self->{'omit'})
96 0 0 if ref $fields ne "ARRAY"
99 0 0 if ($omit = $self->_normalize_omit($self->{'omit'}, $pk_fields))
100 0 0 if ($pk_fields or $omit)
107 0 0 if ($omit) { }
117 0 0 unless defined $omit
121 0 0 if ($r eq 'HASH') { }
0 0 elsif ($r eq 'ARRAY') { }
0 0 elsif (not $r) { }
127 0 0 unless $pk_fields //= $self->{'source'}->primary_key
130 0 0 unless $omit->{$field}
140 55 111 if (my $where = $self->{'where'})
141 0 55 if builtin::blessed($where) and $where->can("sql_builder")
169 2 3 if not ref $link and $link =~ /^(.+)\:(.+)$/
176 3 2 if ($source->isa('DBIx::QuickORM::Join')) { }
208 173 79 if ($class = builtin::blessed($in)) { }
215 173 79 $self ? :
217 8 244 if $clone->{'row'}
225 0 0 builtin::blessed($_) && $_->can('display') ? :
0 0 defined $_ ? :
230 17 391 if (my $ref = ref $arg)
231 17 0 if (my $class = builtin::blessed($arg))
232 13 4 if ($arg->DOES("DBIx::QuickORM::Role::Source"))
233 0 13 if $clone->{'source'} and not $flags{'allow_override'}
235 0 13 if ($set{'row'}) { }
238 0 0 unless $s1 == $s2
249 0 4 if ($arg->DOES("DBIx::QuickORM::Role::SQLBuilder"))
250 0 0 if $clone->{'sql_builder'} and not $flags{'allow_override'}
256 0 4 if ($arg->isa("DBIx::QuickORM::Connection"))
257 0 0 if $clone->{'connection'} and not $flags{'allow_override'}
263 4 0 if ($arg->DOES("DBIx::QuickORM::Role::Row"))
264 0 4 if $clone->{'row'} and not $flags{'allow_override'}
265 0 4 if $set{'where'}
267 0 4 if ($set{'source'}) { }
270 0 0 unless $s1 == $s2
285 0 0 if ($ref eq "ARRAY")
286 0 0 if (my $cb = $flags{'array'})
287 0 0 if &$cb($clone, $arg)
290 0 0 if $clone->{'order_by'} and not $flags{'allow_override'}
295 0 0 if ($ref eq "HASH")
296 0 0 if (my $cb = $flags{'hash'})
297 0 0 if &$cb($clone, $arg)
300 0 0 if $clone->{'where'} and not $flags{'allow_override'}
301 0 0 if $set{'row'}
312 0 391 if ($arg =~ /^-(.+)$/)
316 0 0 if ($arg eq "unknown")
322 0 391 if ($arg =~ /^\d+$/)
323 0 0 if (my $cb = $flags{'integer'})
324 0 0 if &$cb($clone, $arg)
326 0 0 if defined $clone->{'limit'} and not $flags{'allow_override'}
331 0 391 if (my $cb = $flags{'scalar'})
332 0 0 if &$cb($clone, $arg, \@_)
335 335 56 if (my $const = $class->can(uc $arg))
339 0 335 if defined $clone->{$key} and not $flags{'allow_override'}
341 51 284 unless (defined $val)
348 0 18 if $set{'row'} and $set{'where'}
351 56 228 if ($key eq 'where') { }
18 210 elsif ($key eq 'row') { }
352 0 56 if $clone->{'row'} and not $flags{'allow_override'}
356 0 18 if $clone->{'where'} and not $flags{'allow_override'}
363 56 0 if (my $src = $clone->{'connection'}->source($arg, "no_fatal", 1))
364 0 56 if $clone->{'source'} and not $flags{'allow_override'}
379 0 1 unless defined wantarray
380 0 1 if $self->{'auto_refresh'}
386 0 0 unless defined wantarray
387 0 0 unless $self->{'auto_refresh'}
393 0 0 unless defined wantarray
394 0 0 unless $self->{'forked'} or $self->{'async'} or $self->{'aside'}
400 0 0 unless defined wantarray
401 0 0 if $self->{'async'}
407 0 0 unless defined wantarray
408 0 0 if $self->{'aside'}
414 0 5 unless defined wantarray
415 0 5 if $self->{'forked'}
421 0 6 unless defined wantarray
423 0 6 if (@_)
428 0 6 if $self->{'data_only'}
435 0 0 unless defined wantarray
442 0 0 $_[1] ? :
0 0 defined $_[1] ? :
443 0 0 $_[1] ? :
0 0 defined $_[1] ? :
469 0 184 unless defined wantarray
471 0 184 if @_
473 0 184 if $self->{'sql_builder'}
479 0 256 unless defined wantarray
480 256 0 unless @_
486 0 3 unless defined wantarray
487 3 0 unless @_
493 0 12 unless defined wantarray
494 0 12 unless @_
500 0 167 unless defined wantarray
501 160 7 unless @_
503 7 0 if @_ == 1 and ref $_[0] eq "ARRAY"
513 0 0 unless defined wantarray
514 0 0 unless @_
516 0 0 if @_ == 1 and ref $_[0] eq "ARRAY"
525 0 0 unless defined wantarray
526 0 0 unless @_
532 0 39 unless defined wantarray
533 0 39 unless @_
539 0 78 unless defined wantarray
540 0 78 unless @_
546 0 3 unless defined wantarray
547 0 3 unless @_
548 2 1 @_ > 1 ? :
563 0 0 $_[0]{'internal_transactions'} ? :
577 347 28 $has_pk ? :
584 0 0 unless $params{'on_ready'} or $params{'no_rows'}
588 0 160 if $self->{'async'} or $self->{'aside'}
589 5 155 if $self->{'forked'}
615 189 0 if ($type eq "field")
625 0 189 if (builtin::blessed($val) and $val->DOES('DBIx::QuickORM::Role::Type')) { }
22 167 elsif (my $type = $source->field_type($field)) { }
632 4 184 if ($quote_bin and $affinity eq "binary")
667 0 0 unless $dialect->async_supported
672 0 0 if ($self->{'aside'}) { }
706 0 5 unless pipe $rh, $wh
709 5 0 if ($pid)
740 0 0 unless eval {
741 0 0 if (my $on_ready = $params{'on_ready'})
742 0 0 if (my $fetch = &$on_ready($dbh, $sth, $res, $sql))
771 0 0 if $con->in_txn
774 0 0 if $self->{'internal_transactions'}
776 0 0 if $params{'warn'}
777 0 0 if $params{'die'}
789 0 2 if $con->in_txn
792 2 0 if $self->{'internal_transactions'}
794 0 0 if $params{'warn'}
795 0 0 if $params{'die'}
797 0 0 if $params{'noop'}
820 0 6 if $self->{'where'}
821 0 6 if $self->{'row'}
828 2 4 if ($ref eq 'HASH') { }
2 2 elsif ($ref eq 'ARRAY') { }
2 0 elsif (not $ref) { }
833 0 6 unless ref $id eq "ARRAY"
841 0 0 if $self->{'where'}
842 0 0 if $self->{'row'}
847 0 2 if @_ < 2
848 0 2 unless my $data = pop()
849 0 2 unless ref $data eq "HASH"
878 32 128 unless @_
880 118 10 if (@_ == 1)
883 118 0 if (my $r = ref $item)
884 12 106 if builtin::blessed($item) and $item->DOES("DBIx::QuickORM::Role::Row")
885 106 0 if $r eq "HASH"
896 0 2 if $self->{'auto_refresh'}
907 1 77 if $self->{'auto_refresh'}
920 0 1 unless $self->_has_pk
922 1 0 if $self->dialect->supports_returning_insert
926 0 0 if ($self->is_sync) { }
942 0 80 if $self->{'data_only'}
943 0 80 if defined $self->{'limit'}
944 0 80 if defined $self->{'order_by'}
947 78 2 if (my $in = $self->{'target'})
948 78 0 if ref $in eq "HASH"
949 0 78 unless $data
952 2 78 if (my $row = $self->{'row'})
953 0 2 if $data
954 0 2 if $row->in_storage
955 0 2 unless $data = $row->row_data_obj->pending_data
958 0 80 unless $data
959 0 80 unless keys %$data
968 215 2 unless my $def = $col->perl_default
971 1 1 unless exists $data->{$name}
977 0 77 if ($has_pk and @$has_pk > 1 and not $has_ret)
979 0 0 if grep {not $data->{$_};} @$has_pk
984 77 3 if ($has_ret and $has_pk)
987 1 76 $self->{'auto_refresh'} ? :
990 2 78 $upsert ? :
1001 76 3 if ($builder_args->{'returning'}) { }
0 3 elsif ($has_pk) { }
1019 79 79 $sent++ ? :
1023 0 79 if ($sth->DOES("DBIx::QuickORM::Role::Async"))
1041 0 4 if $self->{'data_only'}
1055 4 0 if $do_cache and $has_ret and $has_pk
1060 0 4 unless ($do_cache)
1062 0 0 if $row
1063 0 0 $sync ? :
1069 4 4 if $done++
1074 0 4 if ($rows)
1079 2 2 if ($row)
1084 2 0 if ($has_ret)
1096 4 0 if ($has_ret or $row) { }
1100 0 0 unless $sync
1113 0 4 unless $sync
1127 0 12 if $self->{'data_only'}
1128 0 12 if $self->{'limit'}
1129 0 12 if $self->{'order_by'}
1132 2 10 if ($changes) { }
10 0 elsif ($row) { }
1133 0 2 if ($row)
1134 0 0 if (my $pending = $row->pending_data)
1135 0 0 if $changes and $pending and keys %$changes and keys %$pending
1144 0 12 unless $changes
1145 0 12 unless ref $changes eq "HASH"
1146 0 12 unless keys %$changes
1154 12 0 $pk_fields ? :
1159 0 12 unless ($do_cache)
1161 0 0 unless $sync
1169 10 2 if (builtin::blessed($row)) { }
1170 0 10 $changes_pk_fields ? :
1174 1 1 $changes_pk_fields ? :
1178 1 11 $changes_pk_fields ? :
1186 12 12 if $done++
1191 2 10 if ($rows)
1196 10 0 if ($row)
1205 10 2 if ($row) { }
1209 0 2 unless $sync
1222 0 12 unless $sync
1255 0 40 if $self->{'data_only'} and not $self->is_sync
1259 2 37 if ($sth->DOES("DBIx::QuickORM::Role::Async"))
1267 7 30 unless my $fetched = $sth->next
1269 2 28 if $self->{'data_only'}
1281 0 6 if $self->{'data_only'} and not $self->is_sync
1285 2 4 if ($sth->DOES("DBIx::QuickORM::Role::Async"))
1293 0 4 unless my $fetched = $sth->next
1295 1 3 if $self->{'data_only'}
1307 0 7 unless $self->is_sync
1312 2 5 if $self->{'data_only'}
1334 1 3 if $self->{'data_only'}
1338 3 13 unless my $fetched = $sth->next
1352 0 7 unless $self->is_sync
1354 0 7 unless my $row = $sth->next
1360 0 0 unless $cb and ref $cb eq "CODE"
1362 0 0 unless $self->is_sync
1366 0 0 if ($self->{'data_only'}) { }