Branch Coverage

blib/lib/DBIx/Custom.pm
Criterion Covered Total %
branch 304 394 77.1


line true false branch
64 9 61 if ref $_[-1] eq 'HASH'
70 30 40 if (not defined $columns or $columns eq '*')
94 3 508 if (ref $_[0]) { }
103 511 0 if (not ref $connector and $connector)
123 0 4064 if (@_) { }
132 4064 0 if (my $connector = $self->connector)
133 0 4064 unless ref $connector and $connector->can('dbh')
143 330 3728 unless (defined $self->quote)
145 0 330 $driver eq 'mysql' ? :
0 330 $driver eq 'ado' ? :
0 330 $driver eq 'odbc' ? :
161 3 27 unless $opt{'where'} or defined $opt{'id'} or $opt{'allow_delete_all'}
165 15 56 if (defined $opt{'id'}) { }
175 3 68 if defined $opt{'prefix'}
188 3 218 if (@_ % 2 != 0 and not ref $_[0]) { }
192 164 54 ref $_[0] eq 'HASH' ? :
205 185 36 unless $model->table
208 221 0 unless ($model->columns and @{$model->columns;})
224 1810 1387 if @_ % 2
229 26 3171 if defined $opt{'append'}
233 3197 0 $safe_char eq 'a-zA-Z0-9_' ? :
242 87 2506 defined $3 ? :
246 9 3188 if index($parsed_sql, '\\:') != -1
250 3 3194 if $after_build_sql
254 149 3048 if ($self->{'_type_rule_is_called'})
256 134 15 unless ($opt{'type_rule_off'})
258 123 11 unless ref $tables eq 'ARRAY'
268 262 6 unless ($type_rule_off_parts->{$i})
274 6 6 unless $$self{"_into$i"}{'key'}{$table}
278 138 102 unless $$self{"_into$i"}{'key'}{$main_table}
240 22 if $main_table
287 42 3155 if (defined $filter)
288 0 42 if (ref $opt{'filter'} eq 'ARRAY')
294 0 42 if (not defined $name) { }
21 21 elsif (ref $name ne 'CODE') { }
299 3 18 unless exists $self->filters->{$name}
307 2 3192 if ref $bind_type eq 'ARRAY'
330 33 3161 if $opt{'reuse'}
331 18 3176 if ($reuse_sth) { }
337 582 2594 if ($@)
341 15 2579 if $opt{'reuse'}
348 4 2608 if ($bind_type) { }
352 4 4 $bind_value_types->[$_] ? :
361 2 2607 if ($ENV{'DBIX_CUSTOM_DEBUG'})
365 0 0 unless defined $value
366 0 0 if utf8::is_utf8($value)
374 3 2609 if $@
378 921 1688 if ($sth->{'NUM_OF_FIELDS'}) { }
385 94 827 if ($self->{'_type_rule_is_called'})
408 30 30 unless ($model_infos)
411 0 30 if $name_space =~ /[^\w:]/
414 0 30 if $@
422 0 30 unless opendir my $dh, $path
427 80 52 if (-d $file_abs) { }
52 0 elsif (-f $file_abs) { }
428 60 20 if $file eq '.' or $file eq '..'
429 0 20 unless opendir my $fq_dh, $file_abs
433 52 40 if -f $fq_file_abs
443 104 496 if ($module =~ s/\.pm$//)
454 9 155 if (ref $model_info eq 'HASH') { }
471 0 164 if $mclass =~ /[^\w:]/
473 54 110 unless ($mclass->can('new'))
475 0 54 if $@
480 164 0 if $mclass
481 164 0 if $model_name
482 164 0 if $model_table
504 51 333 if (exists $merged_param->{$column}) { }
506 42 9 unless ref $merged_param->{$column} eq 'ARRAY'
508 6 45 ref $param2->{$column} eq 'ARRAY' ? :
520 221 374 if ($model)
527 0 374 unless $self->models->{$name}
536 9 24 if (not $columns or $columns eq '*')
552 3 519 if (@_ > 0 and not ref $_[0] and $_[0] =~ /:/) { }
571 0 32 unless $self->can($attr)
576 522 0 unless exists $self->{'safety_character'}
597 927 1787 if (defined $quote and length $quote > 1) { }
602 0 2714 if ($quotemeta)
607 640 2074 if ($opt{'whole'}) { }
610 0 2074 unless @values
620 0 36 ref $_[0] eq 'HASH' ? :
628 31 711 if @_ % 2
630 31 711 if defined $column
637 735 7 if defined $table
645 3 739 if defined $opt{'prefix'}
648 176 566 if (defined $opt{'column'}) { }
650 94 82 ref $opt{'column'} eq 'ARRAY' ? :
652 52 181 if (ref $column eq 'HASH')
657 9 43 if ($table eq $mytable_symbol) { }
664 226 7 if $table
672 7 735 unless $table
684 49 686 if (defined $opt{'id'}) { }
685 49 0 @$found_tables ? :
697 20 709 if (defined(my $append = $opt{'append'}))
703 133 596 if (defined $opt{'join'})
705 127 6 if (ref $opt_join eq 'ARRAY') { }
710 18 711 if (defined $w->{'join'})
712 18 0 if (ref $where_join eq 'ARRAY') { }
717 130 599 if @$join
738 824 0 @_ % 2 ? :
744 2 822 if defined $opt{'prefix'}
748 9 815 if (ref $params eq 'ARRAY') { }
752 33 791 if (defined $opt{'ctime'} or defined $opt{'mtime'})
758 21 12 if ref $now eq 'CODE'
759 23 10 if (defined $opt{'ctime'})
762 27 6 if (defined $opt{'mtime'})
768 38 786 if (defined $opt{'id'} and not $multi)
777 0 38 unless $opt{'primary_key'}
778 17 21 unless ref $opt{'primary_key'} eq 'ARRAY'
779 20 18 unless ref $opt{'id'} eq 'ARRAY'
782 3 56 if exists $params->[0]{$key}
787 0 824 if ($opt{'bulk_insert'}) { }
801 9 812 if (@$params > 1) { }
815 86 3 @_ % 2 ? :
821 3 3 unless $opt{'where'} or defined $opt{'id'} or $opt{'allow_update_all'}
824 9 77 if (defined $opt{'mtime'})
827 9 0 if ref $now eq 'CODE'
836 15 68 if (defined $opt{'id'}) { }
850 0 83 if defined $opt{'prefix'}
872 3 1946 unless $column =~ /^[$safety_character\.]+$/
877 3 1908 $wrap->{$column} ? :
35 1911 ref $param->{$column} eq 'SCALAR' ? :
896 3 110 unless $column =~ /^[$safety_character\.]+$/
900 3 104 $wrap->{$column} ? :
3 107 ref $param->{$column} eq 'SCALAR' ? :
916 74 188 if (@_)
917 0 74 ref $_[0] eq 'HASH' ? :
926 73 69 unless $type_rule->{$into}
927 3 75 if $type_name =~ /[A-Z]/
935 75 1834 if ($type_rule->{$into} and my $filter = $type_rule->{$into}{$type_name})
938 0 75 unless exists $type_rule->{$into}{$type_name}
939 9 66 if (defined $filter and ref $filter ne 'CODE')
943 3 6 unless exists $self->filters->{$fname}
961 71 62 unless $$type_rule{"from$i"}
962 3 62 if $data_type =~ /[A-Z]/
965 3 59 if (defined $fname and ref $fname ne 'CODE')
967 0 3 unless exists $self->filters->{$fname}
1008 0 54 unless $DBIx::Custom::a->{'table'} cmp $DBIx::Custom::b->{'table'}
1017 129 16 if ($user_column_info) { }
1037 0 53 if $@
1052 90 134 if ($schema_table =~ /^(.+)\.(.*)$/) { }
1063 0 224 if ($@)
1083 6 19 if ($user_table_infos) { }
1092 0 65 if defined $re and $table =~ /$re/
1106 0 0 if defined $data_type
1109 0 0 unless $data_types
1122 0 0 if $column_info->{'TYPE_NAME'}
1131 0 0 unless defined $table
1149 0 0 unless defined $t
1154 0 0 unless $table eq $t
1178 904 1731 if (defined $quote and length $quote > 1) { }
1183 1710 925 if ($opt{'quotemeta'})
1206 0 0 unless $column =~ /^[$safety_character\.]+$/
1220 0 0 $wrap->{$column} ? :
0 0 ref $param->{$column} eq 'SCALAR' ? :
1234 0 79 unless defined $primary_keys
1237 52 27 unless ref $primary_keys eq 'ARRAY'
1243 79 0 if (defined $id)
1244 52 27 unless ref $id eq 'ARRAY'
1247 106 0 if $table
1260 0 0 unless $dsn
1272 0 0 if $@
1284 6 579 if ($Carp::Verbose) { }
1303 245 564 if ($tree->{$table})
1320 6 151 if (ref $join->[$i] eq 'HASH') { }
1332 6 151 if (my $table = $option->{'table'}) { }
1347 151 16 if ($clause =~ /$join_re/)
1354 0 157 unless defined $table1 and defined $table2
1358 0 157 if exists $tree->{$table2}
1359 0 157 if $table1 eq $table2
1384 0 0 defined $_ ? :
1385 0 0 if $main_table
1387 0 0 $main_table ? :
1388 0 0 if (my $q = $self->_quote)
1418 766 123 if (ref $where eq 'HASH') { }
123 0 elsif (ref $where) { }
0 0 elsif ($where) { }
1425 3 290 unless $column =~ /^[$safety_character\.]+$/
1431 290 0 if ($column =~ /(?:(.*)\.)?(.*)/)
1437 171 119 if defined $table
1439 171 119 if defined $table_quote
1441 6 284 if (ref $where->{$column} eq 'ARRAY') { }
1443 3 3 if (@{$where->{$column};}) { }
1451 242 521 @$clause ? :
1457 84 39 if (ref $where eq 'DBIx::Custom::Where') { }
39 0 elsif (ref $where eq 'ARRAY') { }
1463 0 123 unless ref $obj eq 'DBIx::Custom::Where'
1491 9 30 if (my $method = $self->{'_methods'}{$mname}) { }
27 3 elsif ($self->{'dbh'} and my $dbh_method = $self->dbh->can($mname)) { }
1511 3 6 ref $_[0] eq 'HASH' ? :
1512 3 6 unless $self->{'_methods'}
1524 3 15 unless defined $opt{'id'} and defined $opt{'primary_key'}
1527 15 0 unless $statement_opt->{'select'}
1528 6 9 if (@$rows == 0) { }
6 3 elsif (@$rows == 1) { }
1529 6 0 unless $statement_opt->{'insert'}
1532 3 3 unless keys %$param
1533 3 0 unless $statement_opt->{'update'}