Branch Coverage

blib/lib/DBIx/QuickORM.pm
Criterion Covered Total %
branch 326 416 78.3


line true false branch
90 16 379 if $only
100 393 2 if ($type eq "orm")
106 0 491 if @_ and $_[0] and "$_[0]" eq $caller
112 0 20143 if $skip->{$name} or $skip->{$sym}
113 754 19389 if $only and not $only->{$name} || $only->{$sym}
114 1 19388 if $seen{$name}++
125 0 2224 unless @caller
126 1774 450 if eval {
147 0 98 unless my $export = $class->can($item)
148 0 98 unless my $sub = $caller->can($item)
150 98 0 unless $export == $sub
159 0 0 unless defined *{$glob;}{$type}
170 0 395 unless $params{'package'}
186 0 18 unless $caller
187 0 18 if @extra
193 1 11 unless @_
197 7 4 if ($type =~ /^(orm|db|schema)$/)
198 1 6 if @extra
214 1 8 if $top->{'base'}
230 3 8 if (builtin::blessed($proto))
231 1 2 if @proto_params
232 1 1 if ($proto->isa("DBIx::QuickORM::Plugin"))
239 1 7 unless my $class = load_class($proto, "DBIx::QuickORM::Plugin")
240 1 6 unless $class->isa("DBIx::QuickORM::Plugin")
242 2 4 @proto_params == 1 ? :
253 173 1 unless @_
259 2 2 if (@_ and ref $_[0] eq 'HASH') { }
274 1 11 unless @{$self->{'stack'};} > 1
277 10 1 unless @_
287 1 4 unless @_
291 1 3 unless $proto
293 1 2 unless my $class = load_class($proto)
295 1 1 unless @{$self->{'stack'};} > 1
316 24 44 if ($top->{'building'} eq "ORM")
317 0 24 if $top->{'meta'}{'db'}
321 8 60 if (@_ == 1 and $_[0] =~ /^(\S+)\.([^:\s]+)(?::(\S+))?$/)
324 0 8 unless my $server = $self->{'servers'}{$server_name}
325 0 8 unless my $db = $server->{'meta'}{'dbs'}{$db_name}
327 1 7 if $bld_orm
334 23 37 if $bld_orm
338 3 34 if ($top->{'building'} eq "SERVER")
352 3 0 unless defined $frame->{'prefix'}
366 0 2 unless $top->{'meta'}{'default_handle_class'} = load_class($proto, "DBIx::QuickORM::Handle")
378 0 37 if (@_ and not ref $_[0])
380 0 0 unless $frame->{'class'} = load_class($proto, "DBIx::QuickORM::Schema::Autofill")
383 29 8 unless (@_)
397 0 5 unless my $class = load_class($type, "DBIx::QuickORM::Type")
409 0 2 if $top->{'autorow'}
422 0 2 unless my $parent = load_class($base) // load_class("DBIx::QuickORM::Row")
435 5 0 unless @$isa
455 0 4 if $top->{'autoname'}{$type}
458 1 3 if ($type eq 'field_accessor') { }
1 2 elsif ($type eq 'link_accessor') { }
0 2 elsif ($type eq 'table') { }
2 0 elsif ($type eq 'link') { }
482 2 3 unless @$links
488 4 0 unless @$a > 2
491 4 0 unless @$b > 2
508 0 6 unless $top->{'class'}->is_valid_hook($hook)
510 0 6 unless $cb and ref $cb eq "CODE"
527 0 0 unless my $cnt = $SKIP_TYPES{$type}
528 0 0 unless @args == $cnt
546 0 1 unless my $class = load_class($proto, "DBD")
557 0 33 unless my $class = load_class($dialect, "DBIx::QuickORM::Dialect")
568 1 22 unless ref $cb eq "CODE"
575 2 1 @_ == 1 ? :
579 1 2 unless ref $attrs eq "HASH"
589 0 1 unless $in and ref $in eq "CODE"
594 0 1 unless $data and ref $data eq "HASH"
598 0 1 unless $creds{'user'} = $data->{'user'}
599 0 1 unless $creds{'pass'} = $data->{'pass'}
600 1 0 if $data->{'socket'}
601 0 1 if $data->{'host'}
602 0 1 if $data->{'port'}
604 0 1 unless $creds{'host'} or $creds{'socket'}
630 6 28 if ($top->{'building'} eq "ORM")
631 0 6 if $top->{'meta'}{'schema'}
646 1 2 if (ref $arg eq "CODE")
647 0 1 if $cb
660 1 3 unless $name and $data
671 0 7 unless load_class($class)
672 0 7 unless $class->can("qorm_table")
673 0 7 unless my $table = $class->qorm_table
692 2 21 if (@{$self->{'stack'};} == 1 and $self->{'type'} eq "table")
702 0 2 unless my $loaded_class = load_class($row_class, "DBIx::QuickORM::Row")
723 3 18 if ($_[0] =~ /::/ or $_[1] and $_[1] =~ /::/)
728 3 3 if ($arg =~ /::/) { }
1 2 elsif (my $ref = ref $arg) { }
730 1 0 if ($ref eq 'CODE') { }
736 3 0 if ($class and not $no_match)
741 1 2 if $cb
760 2 4 if (not $ref) { }
1 3 elsif ($ref eq 'HASH') { }
3 0 elsif ($ref eq 'ARRAY') { }
768 0 3 if defined wantarray
800 2 37 if (builtin::blessed($arg)) { }
3 34 elsif (my $ref = ref $arg) { }
5 29 elsif ($arg eq 'id' or $arg eq 'identity') { }
2 27 elsif ($arg eq 'not_null') { }
4 23 elsif ($arg eq 'nullable') { }
5 18 elsif ($arg eq 'omit') { }
2 16 elsif ($arg eq 'sql_default' or $arg eq 'perl_default') { }
7 9 elsif (validate_affinity($arg)) { }
7 2 elsif (my $class = load_class($arg, 'DBIx::QuickORM::Type')) { }
801 1 1 if ($arg->DOES('DBIx::QuickORM::Role::Type')) { }
809 2 1 if ($ref eq 'SCALAR') { }
835 1 6 unless $class->DOES("DBIx::QuickORM::Role::Type")
839 1 1 unless $@ =~ /^Can't locate .+ in \@INC/
855 8 5 if (not $ref) { }
4 1 elsif ($ref eq 'HASH') { }
856 1 3 if $other
860 0 2 if defined wantarray
870 0 23 unless @_
871 0 23 if @_ > 2
876 0 23 unless $affix =~ /^(pre|post|in)fix$/
880 7 16 if ($affix eq 'infix') { }
881 1 6 if $top->{'building'} eq "SCHEMA"
882 2 4 if $top->{'meta'}{'sql'}{$affix}
892 0 24 unless @_
895 1 23 unless validate_affinity($affinity)
897 10 13 if defined wantarray
907 2 9 if ref $type eq "SCALAR"
908 0 9 if ref $type
909 3 6 if $type->DOES("DBIx::QuickORM::Role::Type")
911 1 5 unless my $class = load_class($type, "DBIx::QuickORM::Type")
917 1 12 unless @_
920 1 11 if @args
921 0 11 if builtin::blessed($type)
925 1 10 unless ($use_type)
927 1 0 if $@ =~ /^Can't locate .+ in \@INC/
931 2 8 if defined wantarray
937 5 2 $_[1] // 1 ? :
7 7 defined wantarray ? :
938 5 2 $_[1] // 1 ? :
7 5 defined wantarray ? :
939 4 2 $_[1] // 1 ? :
6 5 defined wantarray ? :
940 2 1 $_[1] // 1 ? :
1 2 $_[1] ? :
3 3 defined wantarray ? :
949 3 4 if ($r eq 'SCALAR') { }
4 0 elsif ($r eq 'CODE') { }
953 4 3 if defined wantarray
963 324 5 if (@{$self->{'stack'};} > 1)
967 324 0 if $builders{$bld}
971 5 0 if $name =~ /_in_builder/
991 1 4 unless my $class = load_class($proto, "DBIx::QuickORM::Row")
1003 3 2 if ($top->{'building'} eq 'COLUMN') { }
1006 1 2 if @list
1009 0 2 unless $frame->{'building'} eq "TABLE"
1015 1 1 unless @list
1029 2 2 if ($top->{'building'} eq 'COLUMN') { }
1032 1 1 if @list
1035 0 1 unless $frame->{'building'} eq "TABLE"
1041 1 1 unless @list
1058 1 4 if ($top->{'building'} eq "COLUMN")
1059 1 0 @args && !ref($args[0]) ? :
1060 0 1 unless ref $args[0] eq "ARRAY"
1065 0 1 unless $self->{'stack'}[-2]{'building'} eq "TABLE"
1071 1 0 if $alias
1077 7 2 unless ($fref)
1081 0 7 unless $sref and $sref eq "ARRAY"
1083 3 4 if ($eref and $eref eq 'ARRAY') { }
1093 2 0 if ($fref eq "HASH")
1102 1 4 if ($local) { }
1103 0 1 if @nodes > 1
1104 0 1 unless @nodes
1146 16 189 if $frame->{'__COMPILED__'}{$alt}
1148 0 189 unless my $bld = $frame->{'building'}
1149 0 189 unless my $recurse = $RECURSE{$bld}
1152 10 179 $alt_arg && $frame->{'alt'}{$alt_arg} ? :
1158 20 779 if $seen{$field}++
1162 662 103 unless ($recurse->{$field})
1167 46 57 if ($recurse->{$field} > 1) { }
1175 0 189 unless my $proto = $frame->{'class'}
1176 0 189 unless my $class = load_class($proto)
1183 0 189 unless my $out = eval {
1193 26 753 unless defined $b
1194 733 20 unless defined $a
1198 0 20 unless $ref_a eq $ref_b
1201 16 4 unless $ref_a
1203 4 0 if $ref_a eq "HASH"
1218 0 254 unless $args and @$args
1225 35 244 if ($name) { }
279 165 if (not $ref) { }
152 13 elsif ($ref eq 'CODE') { }
8 5 elsif ($ref eq 'HASH') { }
1226 0 152 if $builder
1227 0 8 if $meta_arg
1231 15 239 if @extra
1232 8 246 $name && $name =~ s/:(\S+)$// ? :
1233 0 254 if defined $name and not length $name
1236 49 205 if $extra_cb
1237 0 249 if @extra
1240 78 19 if ($name and not $builder and not $meta_arg and not $force_build)
1241 1 77 unless $into->{$name}
1242 54 23 unless $params{'no_compile'}
1257 153 18 if $name and $type ne "Alt"
1264 152 19 if $builder
1272 0 171 unless $ok
1274 162 9 if ($into)
1276 160 2 if ($ref eq 'HASH') { }
2 0 elsif ($ref eq 'SCALAR') { }
1277 159 1 if $name
1287 1 170 if $params{'void'}
1289 16 154 if (defined wantarray)
1290 2 14 unless $params{'no_compile'}
1294 154 0 if $name