Branch Coverage

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


line true false branch
64 9 61 if ref $_[-1] eq 'HASH'
70 30 40 if (not defined $columns or $columns eq '*')
94 3 510 if (ref $_[0]) { }
103 513 0 if (not ref $connector and $connector)
123 0 4070 if (@_) { }
132 4070 0 if (my $connector = $self->connector)
133 0 4070 unless ref $connector and $connector->can('dbh')
143 331 3733 unless (defined $self->quote)
145 0 331 $driver eq 'mysql' ? :
0 331 $driver eq 'ado' ? :
0 331 $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 220 if (@_ % 2 != 0 and not ref $_[0]) { }
192 164 56 ref $_[0] eq 'HASH' ? :
206 187 36 unless $model->table
209 223 0 unless ($model->columns and @{$model->columns;})
225 1810 1389 if @_ % 2
230 26 3173 if defined $opt{'append'}
234 3199 0 $safe_char eq 'a-zA-Z0-9_' ? :
243 87 2506 defined $3 ? :
247 9 3190 if index($parsed_sql, '\\:') != -1
251 3 3196 if $after_build_sql
255 149 3050 if ($self->{'_type_rule_is_called'})
257 134 15 unless ($opt{'type_rule_off'})
259 123 11 unless ref $tables eq 'ARRAY'
269 262 6 unless ($type_rule_off_parts->{$i})
275 6 6 unless $$self{"_into$i"}{'key'}{$table}
279 138 102 unless $$self{"_into$i"}{'key'}{$main_table}
240 22 if $main_table
288 42 3157 if (defined $filter)
289 0 42 if (ref $opt{'filter'} eq 'ARRAY')
295 0 42 if (not defined $name) { }
21 21 elsif (ref $name ne 'CODE') { }
300 3 18 unless exists $self->filters->{$name}
308 2 3194 if ref $bind_type eq 'ARRAY'
331 33 3163 if $opt{'reuse'}
332 18 3178 if ($reuse_sth) { }
338 582 2596 if ($@)
342 15 2581 if $opt{'reuse'}
349 4 2610 if ($bind_type) { }
353 4 4 $bind_value_types->[$_] ? :
362 2 2609 if ($ENV{'DBIX_CUSTOM_DEBUG'})
366 0 0 unless defined $value
367 0 0 if utf8::is_utf8($value)
375 3 2611 if $@
379 921 1690 if ($sth->{'NUM_OF_FIELDS'}) { }
386 94 827 if ($self->{'_type_rule_is_called'})
409 30 30 unless ($model_infos)
412 0 30 if $name_space =~ /[^\w:]/
415 0 30 if $@
423 0 30 unless opendir my $dh, $path
428 80 52 if (-d $file_abs) { }
52 0 elsif (-f $file_abs) { }
429 60 20 if $file eq '.' or $file eq '..'
430 0 20 unless opendir my $fq_dh, $file_abs
434 52 40 if -f $fq_file_abs
444 104 496 if ($module =~ s/\.pm$//)
455 9 155 if (ref $model_info eq 'HASH') { }
472 0 164 if $mclass =~ /[^\w:]/
474 54 110 unless ($mclass->can('new'))
476 0 54 if $@
481 164 0 if $mclass
482 164 0 if $model_name
483 164 0 if $model_table
505 51 333 if (exists $merged_param->{$column}) { }
507 42 9 unless ref $merged_param->{$column} eq 'ARRAY'
509 6 45 ref $param2->{$column} eq 'ARRAY' ? :
521 223 378 if ($model)
528 0 378 unless $self->models->{$name}
537 9 24 if (not $columns or $columns eq '*')
553 3 521 if (@_ > 0 and not ref $_[0] and $_[0] =~ /:/) { }
572 0 34 unless $self->can($attr)
577 524 0 unless exists $self->{'safety_character'}
598 927 1787 if (defined $quote and length $quote > 1) { }
603 0 2714 if ($quotemeta)
608 640 2074 if ($opt{'whole'}) { }
611 0 2074 unless @values
621 0 36 ref $_[0] eq 'HASH' ? :
629 31 711 if @_ % 2
631 31 711 if defined $column
638 735 7 if defined $table
646 3 739 if defined $opt{'prefix'}
649 176 566 if (defined $opt{'column'}) { }
651 94 82 ref $opt{'column'} eq 'ARRAY' ? :
653 52 181 if (ref $column eq 'HASH')
658 9 43 if ($table eq $mytable_symbol) { }
665 226 7 if $table
673 7 735 unless $table
685 49 686 if (defined $opt{'id'}) { }
686 49 0 @$found_tables ? :
698 20 709 if (defined(my $append = $opt{'append'}))
704 133 596 if (defined $opt{'join'})
706 127 6 if (ref $opt_join eq 'ARRAY') { }
711 18 711 if (defined $w->{'join'})
713 18 0 if (ref $where_join eq 'ARRAY') { }
718 130 599 if @$join
739 824 0 @_ % 2 ? :
745 2 822 if defined $opt{'prefix'}
749 9 815 if (ref $params eq 'ARRAY') { }
753 33 791 if (defined $opt{'ctime'} or defined $opt{'mtime'})
759 21 12 if ref $now eq 'CODE'
760 23 10 if (defined $opt{'ctime'})
763 27 6 if (defined $opt{'mtime'})
769 38 786 if (defined $opt{'id'} and not $multi)
778 0 38 unless $opt{'primary_key'}
779 17 21 unless ref $opt{'primary_key'} eq 'ARRAY'
780 20 18 unless ref $opt{'id'} eq 'ARRAY'
783 3 56 if exists $params->[0]{$key}
788 0 824 if ($opt{'bulk_insert'}) { }
802 9 812 if (@$params > 1) { }
816 86 3 @_ % 2 ? :
822 3 3 unless $opt{'where'} or defined $opt{'id'} or $opt{'allow_update_all'}
825 9 77 if (defined $opt{'mtime'})
828 9 0 if ref $now eq 'CODE'
837 15 68 if (defined $opt{'id'}) { }
851 0 83 if defined $opt{'prefix'}
873 3 1946 unless $column =~ /^[$safety_character\.]+$/
878 3 1908 $wrap->{$column} ? :
35 1911 ref $param->{$column} eq 'SCALAR' ? :
897 3 110 unless $column =~ /^[$safety_character\.]+$/
901 3 104 $wrap->{$column} ? :
3 107 ref $param->{$column} eq 'SCALAR' ? :
917 74 188 if (@_)
918 0 74 ref $_[0] eq 'HASH' ? :
927 73 69 unless $type_rule->{$into}
928 3 75 if $type_name =~ /[A-Z]/
936 75 1834 if ($type_rule->{$into} and my $filter = $type_rule->{$into}{$type_name})
939 0 75 unless exists $type_rule->{$into}{$type_name}
940 9 66 if (defined $filter and ref $filter ne 'CODE')
944 3 6 unless exists $self->filters->{$fname}
962 71 62 unless $$type_rule{"from$i"}
963 3 62 if $data_type =~ /[A-Z]/
966 3 59 if (defined $fname and ref $fname ne 'CODE')
968 0 3 unless exists $self->filters->{$fname}
1009 0 54 unless $DBIx::Custom::a->{'table'} cmp $DBIx::Custom::b->{'table'}
1018 129 16 if ($user_column_info) { }
1038 0 53 if $@
1057 90 136 if ($schema_table =~ /^(.+)\.(.*)$/) { }
1068 0 226 if ($@)
1076 4 351 if ($column_name_lc)
1091 6 19 if ($user_table_infos) { }
1100 0 65 if defined $re and $table =~ /$re/
1114 0 0 if defined $data_type
1117 0 0 unless $data_types
1130 0 0 if $column_info->{'TYPE_NAME'}
1139 0 0 unless defined $table
1157 0 0 unless defined $t
1162 0 0 unless $table eq $t
1186 904 1731 if (defined $quote and length $quote > 1) { }
1191 1710 925 if ($opt{'quotemeta'})
1214 0 0 unless $column =~ /^[$safety_character\.]+$/
1228 0 0 $wrap->{$column} ? :
0 0 ref $param->{$column} eq 'SCALAR' ? :
1242 0 79 unless defined $primary_keys
1245 52 27 unless ref $primary_keys eq 'ARRAY'
1251 79 0 if (defined $id)
1252 52 27 unless ref $id eq 'ARRAY'
1255 106 0 if $table
1268 0 0 unless $dsn
1280 0 0 if $@
1292 6 579 if ($Carp::Verbose) { }
1311 245 564 if ($tree->{$table})
1328 6 151 if (ref $join->[$i] eq 'HASH') { }
1340 6 151 if (my $table = $option->{'table'}) { }
1355 151 16 if ($clause =~ /$join_re/)
1362 0 157 unless defined $table1 and defined $table2
1366 0 157 if exists $tree->{$table2}
1367 0 157 if $table1 eq $table2
1392 0 0 defined $_ ? :
1393 0 0 if $main_table
1395 0 0 $main_table ? :
1396 0 0 if (my $q = $self->_quote)
1426 766 123 if (ref $where eq 'HASH') { }
123 0 elsif (ref $where) { }
0 0 elsif ($where) { }
1433 3 290 unless $column =~ /^[$safety_character\.]+$/
1439 290 0 if ($column =~ /(?:(.*)\.)?(.*)/)
1445 171 119 if defined $table
1447 171 119 if defined $table_quote
1449 6 284 if (ref $where->{$column} eq 'ARRAY') { }
1451 3 3 if (@{$where->{$column};}) { }
1459 242 521 @$clause ? :
1465 84 39 if (ref $where eq 'DBIx::Custom::Where') { }
39 0 elsif (ref $where eq 'ARRAY') { }
1471 0 123 unless ref $obj eq 'DBIx::Custom::Where'
1499 9 30 if (my $method = $self->{'_methods'}{$mname}) { }
27 3 elsif ($self->{'dbh'} and my $dbh_method = $self->dbh->can($mname)) { }
1519 3 6 ref $_[0] eq 'HASH' ? :
1520 3 6 unless $self->{'_methods'}
1532 3 15 unless defined $opt{'id'} and defined $opt{'primary_key'}
1535 15 0 unless $statement_opt->{'select'}
1536 6 9 if (@$rows == 0) { }
6 3 elsif (@$rows == 1) { }
1537 6 0 unless $statement_opt->{'insert'}
1540 3 3 unless keys %$param
1541 3 0 unless $statement_opt->{'update'}