Branch Coverage

blib/lib/DBIx/Custom.pm
Criterion Covered Total %
branch 306 396 77.2


line true false branch
66 9 61 if ref $_[-1] eq "HASH"
72 30 40 if (not defined $columns or $columns eq "*")
96 3 510 if (ref $_[0]) { }
105 513 0 if (not ref $connector and $connector)
125 0 4070 if (@_) { }
134 4070 0 if (my $connector = $self->connector)
135 0 4070 unless ref $connector and $connector->can("dbh")
145 331 3733 unless (defined $self->quote)
147 0 331 $driver eq 'mysql' ? :
0 331 $driver eq 'ado' ? :
0 331 $driver eq 'odbc' ? :
163 3 27 unless $opt{'where'} or defined $opt{'id'} or $opt{'allow_delete_all'}
167 15 56 if (defined $opt{'id'}) { }
177 3 68 if defined $opt{'prefix'}
190 3 220 if (@_ % 2 != 0 and not ref $_[0]) { }
194 164 56 ref $_[0] eq 'HASH' ? :
208 187 36 unless $model->table
211 223 0 unless ($model->columns and @{$model->columns;})
227 1810 1389 if @_ % 2
232 26 3173 if defined $opt{'append'}
236 3199 0 $safe_char eq 'a-zA-Z0-9_' ? :
245 87 2506 defined $3 ? :
249 9 3190 if index($parsed_sql, "\\:") != -1
253 3 3196 if $after_build_sql
257 149 3050 if ($self->{'_type_rule_is_called'})
259 134 15 unless ($opt{'type_rule_off'})
261 123 11 unless ref $tables eq "ARRAY"
271 262 6 unless ($type_rule_off_parts->{$i})
277 6 6 unless $$self{"_into$i"}{'key'}{$table}
281 138 102 unless $$self{"_into$i"}{'key'}{$main_table}
240 22 if $main_table
290 42 3157 if (defined $filter)
291 0 42 if (ref $opt{'filter'} eq "ARRAY")
297 0 42 if (not defined $name) { }
21 21 elsif (ref $name ne 'CODE') { }
302 3 18 unless exists $self->filters->{$name}
310 2 3194 if ref $bind_type eq "ARRAY"
333 33 3163 if $opt{'reuse'}
334 18 3178 if ($reuse_sth) { }
340 582 2596 if ($@)
344 15 2581 if $opt{'reuse'}
351 4 2610 if ($bind_type) { }
355 4 4 $bind_value_types->[$_] ? :
364 2 2609 if ($ENV{'DBIX_CUSTOM_DEBUG'})
368 0 0 unless defined $value
369 0 0 if utf8::is_utf8($value)
377 3 2611 if $@
381 921 1690 if ($sth->{'NUM_OF_FIELDS'}) { }
388 94 827 if ($self->{'_type_rule_is_called'})
411 30 30 unless ($model_infos)
414 0 30 if $name_space =~ /[^\w:]/
417 0 30 if $@
425 0 30 unless opendir my $dh, $path
430 80 52 if (-d $file_abs) { }
52 0 elsif (-f $file_abs) { }
431 60 20 if $file eq "." or $file eq ".."
432 0 20 unless opendir my $fq_dh, $file_abs
436 52 40 if -f $fq_file_abs
446 104 496 if ($module =~ s/\.pm$//)
457 9 155 if (ref $model_info eq 'HASH') { }
474 0 164 if $mclass =~ /[^\w:]/
476 54 110 unless ($mclass->can("new"))
478 0 54 if $@
483 164 0 if $mclass
484 164 0 if $model_name
485 164 0 if $model_table
507 51 333 if (exists $merged_param->{$column}) { }
509 42 9 unless ref $merged_param->{$column} eq "ARRAY"
511 6 45 ref $param2->{$column} eq 'ARRAY' ? :
523 223 378 if ($model)
530 0 378 unless $self->models->{$name}
539 9 24 if (not $columns or $columns eq "*")
555 3 521 if (@_ > 0 and not ref $_[0] and $_[0] =~ /:/) { }
574 0 34 unless $self->can($attr)
579 524 0 unless exists $self->{'safety_character'}
600 927 1787 if (defined $quote and length $quote > 1) { }
605 0 2714 if ($quotemeta)
610 640 2074 if ($opt{'whole'}) { }
613 0 2074 unless @values
623 0 36 ref $_[0] eq 'HASH' ? :
631 31 711 if @_ % 2
633 31 711 if defined $column
640 735 7 if defined $table
648 3 739 if defined $opt{'prefix'}
651 176 566 if (defined $opt{'column'}) { }
653 94 82 ref $opt{'column'} eq 'ARRAY' ? :
655 52 181 if (ref $column eq "HASH")
660 9 43 if ($table eq $mytable_symbol) { }
667 226 7 if $table
675 7 735 unless $table
687 49 686 if (defined $opt{'id'}) { }
688 49 0 @$found_tables ? :
700 20 709 if (defined(my $append = $opt{'append'}))
706 133 596 if (defined $opt{'join'})
708 127 6 if (ref $opt_join eq 'ARRAY') { }
713 18 711 if (defined $w->{'join'})
715 18 0 if (ref $where_join eq 'ARRAY') { }
720 130 599 if @$join
741 824 0 @_ % 2 ? :
747 2 822 if defined $opt{'prefix'}
751 9 815 if (ref $params eq 'ARRAY') { }
755 33 791 if (defined $opt{'ctime'} or defined $opt{'mtime'})
761 21 12 if ref $now eq "CODE"
762 23 10 if (defined $opt{'ctime'})
765 27 6 if (defined $opt{'mtime'})
771 38 786 if (defined $opt{'id'} and not $multi)
780 0 38 unless $opt{'primary_key'}
781 17 21 unless ref $opt{'primary_key'} eq "ARRAY"
782 20 18 unless ref $opt{'id'} eq "ARRAY"
785 3 56 if exists $params->[0]{$key}
790 0 824 if ($opt{'bulk_insert'}) { }
804 9 812 if (@$params > 1) { }
818 86 3 @_ % 2 ? :
824 3 3 unless $opt{'where'} or defined $opt{'id'} or $opt{'allow_update_all'}
827 9 77 if (defined $opt{'mtime'})
830 9 0 if ref $now eq "CODE"
839 15 68 if (defined $opt{'id'}) { }
853 0 83 if defined $opt{'prefix'}
875 3 1946 unless $column =~ /^[$safety_character\.]+$/
880 3 1908 $wrap->{$column} ? :
35 1911 ref $param->{$column} eq 'SCALAR' ? :
899 3 110 unless $column =~ /^[$safety_character\.]+$/
903 3 104 $wrap->{$column} ? :
3 107 ref $param->{$column} eq 'SCALAR' ? :
919 74 188 if (@_)
920 0 74 ref $_[0] eq 'HASH' ? :
929 73 69 unless $type_rule->{$into}
930 3 75 if $type_name =~ /[A-Z]/
938 75 1834 if ($type_rule->{$into} and my $filter = $type_rule->{$into}{$type_name})
941 0 75 unless exists $type_rule->{$into}{$type_name}
942 9 66 if (defined $filter and ref $filter ne "CODE")
946 3 6 unless exists $self->filters->{$fname}
964 71 62 unless $$type_rule{"from$i"}
965 3 62 if $data_type =~ /[A-Z]/
968 3 59 if (defined $fname and ref $fname ne "CODE")
970 0 3 unless exists $self->filters->{$fname}
1011 0 54 unless $DBIx::Custom::a->{'table'} cmp $DBIx::Custom::b->{'table'}
1020 129 16 if ($user_column_info) { }
1040 0 53 if $@
1059 90 136 if ($schema_table =~ /^(.+)\.(.*)$/) { }
1070 0 226 if ($@)
1078 4 351 if ($column_name_lc)
1093 6 19 if ($user_table_infos) { }
1102 0 65 if defined $re and $table =~ /$re/
1116 0 0 if defined $data_type
1119 0 0 unless $data_types
1132 0 0 if $column_info->{'TYPE_NAME'}
1141 0 0 unless defined $table
1159 0 0 unless defined $t
1164 0 0 unless $table eq $t
1188 904 1731 if (defined $quote and length $quote > 1) { }
1193 1710 925 if ($opt{'quotemeta'})
1216 0 0 unless $column =~ /^[$safety_character\.]+$/
1230 0 0 $wrap->{$column} ? :
0 0 ref $param->{$column} eq 'SCALAR' ? :
1244 0 79 unless defined $primary_keys
1247 52 27 unless ref $primary_keys eq "ARRAY"
1253 79 0 if (defined $id)
1254 52 27 unless ref $id eq "ARRAY"
1257 106 0 if $table
1270 0 0 unless $dsn
1282 0 0 if $@
1294 6 579 if ($Carp::Verbose) { }
1313 245 564 if ($tree->{$table})
1330 6 151 if (ref $join->[$i] eq 'HASH') { }
1342 6 151 if (my $table = $option->{'table'}) { }
1357 151 16 if ($clause =~ /$join_re/)
1364 0 157 unless defined $table1 and defined $table2
1368 0 157 if exists $tree->{$table2}
1369 0 157 if $table1 eq $table2
1394 0 0 defined $_ ? :
1395 0 0 if $main_table
1397 0 0 $main_table ? :
1398 0 0 if (my $q = $self->_quote)
1428 766 123 if (ref $where eq 'HASH') { }
123 0 elsif (ref $where) { }
0 0 elsif ($where) { }
1435 3 290 unless $column =~ /^[$safety_character\.]+$/
1441 290 0 if ($column =~ /(?:(.*)\.)?(.*)/)
1447 171 119 if defined $table
1449 171 119 if defined $table_quote
1451 6 284 if (ref $where->{$column} eq 'ARRAY') { }
1453 3 3 if (@{$where->{$column};}) { }
1461 242 521 @$clause ? :
1467 84 39 if (ref $where eq 'DBIx::Custom::Where') { }
39 0 elsif (ref $where eq 'ARRAY') { }
1473 0 123 unless ref $obj eq "DBIx::Custom::Where"
1501 9 30 if (my $method = $self->{'_methods'}{$mname}) { }
27 3 elsif ($self->{'dbh'} and my $dbh_method = $self->dbh->can($mname)) { }
1521 3 6 ref $_[0] eq 'HASH' ? :
1522 3 6 unless $self->{'_methods'}
1534 3 15 unless defined $opt{'id'} and defined $opt{'primary_key'}
1537 15 0 unless $statement_opt->{'select'}
1538 6 9 if (@$rows == 0) { }
6 3 elsif (@$rows == 1) { }
1539 6 0 unless $statement_opt->{'insert'}
1542 3 3 unless keys %$param
1543 3 0 unless $statement_opt->{'update'}