Branch Coverage

blib/lib/DBIx/Class/Storage/DBI.pm
Criterion Covered Total %
branch 218 374 58.2


line true false branch
237 4 229 if (my(@instances) = grep({defined $_;} values %seek_and_destroy))
277 0 473 if &detected_reinvoked_destructor
282 65 408 unless defined $_[0]->_dbh
299 24 69198 if (defined $pid and $pid != $$ and my $dbh = $_[0]->_dbh)
646 4 468 unless $info
650 468 0 if ref $info eq 'ARRAY'
654 0 468 unless $self->_default_dbi_connect_attributes
655 32 436 unless $info->{'attributes'}
660 460 8 if (keys %attrs and ref $args[0] ne 'CODE')
667 1 0 unless $attrs{'AutoCommit'} or $ENV{'DBIC_UNSAFE_AUTOCOMMIT_OK'}
669 460 0 if keys %attrs
707 468 815 if @_
713 168 6 if (not defined $conninfo->[0] and $ENV{'DBI_DSN'})
732 7 461 if (ref $args[0] eq 'CODE') { }
2 459 elsif (ref $args[0] eq 'HASH') { }
733 4 3 unless $args[1]
739 1 1 if (my $code = delete $attrs{'dbh_maker'}) { }
743 1 0 if (@ignored)
758 24 435 unless $args[3]
759 450 9 unless $args[4]
770 438 30 if @storage_opts
776 11 457 if @sql_maker_opts
778 436 32 if %attrs
808 62 477 unless defined $val
812 7 470 if (not ref $val) { }
468 2 elsif (ref $val eq 'CODE') { }
2 0 elsif (ref $val eq 'ARRAY') { }
866 3104 45638 if $self->{'_in_do_block'} or $self->transaction_depth
871 7056 38582 @_ ? :
877 25 1 if $_[0]->failed_attempt_count == 1
907 45 881 if defined $self->_dbh
919 45 881 if ($self->_dbh)
927 0 45 unless $self->_dbh_autocommit
974 133 149 unless $_[0]->_seems_connected
985 9676 156 if $_[0]->_dbh and $_[0]->_dbh->FETCH('Active')
1001 75 101 unless $_[0]->connected
1016 95 10 $_[0]->_dbh ? :
1025 575 58846 unless $_[0]->_dbh
1107 489 2 $_[0]->_dbh_autocommit ? :
1109 487 4 unless $_[0]{'_in_determine_driver'}
1220 173 0 if ($info =~ /[^0-9]/)
1223 0 173 unless defined $info
1241 4 2 if $drv
1251 4 2 $drv ? :
1292 168 0 unless defined $v
1296 0 0 $expl ? :
1305 454 77 if (not $self->_driver_determined || $self->{'_in_determine_driver'})
1309 454 0 unless $self->{'_in_determine_driver'}
1311 445 9 if (ref $self eq 'DBIx::Class::Storage::DBI')
1313 411 34 if ($self->_dbh) { }
1321 443 2 if ($driver) { }
1323 439 4 if ($self->load_optional_class($storage_class)) { }
1328 0 439 if (${"${storage_class}::__INITIAL_MRO_UPON_DBIC_LOAD__";} ||= &mro::get_mro($storage_class)) ne 'c3'
1357 1 453 if ($self->can('source_bind_attributes'))
1368 7 446 if not $started_connected and defined $self->_dbh
1379 3 37 if (ref $self->_dbi_connect_info->[0] and &reftype($self->_dbi_connect_info->[0]) eq 'CODE') { }
1412 0 0 unless ($dbtype)
1423 0 0 if $self->isa($subclass)
1425 0 0 if ($self->load_optional_class($subclass)) { }
1453 25 1915 if (not ref $call) { }
952 963 elsif (ref $call eq 'CODE') { }
963 0 elsif (ref $call eq 'ARRAY') { }
1461 473 490 if (ref $call->[0] ne 'ARRAY') { }
1473 26 3 if ($method_prefix =~ /^connect/) { }
1517 4 16 if (ref $action eq 'CODE') { }
1526 3 13 ref $action eq 'ARRAY' ? :
1546 3 672 unless defined $info->[0]
1551 0 0 if $INC{'Apache/DBI.pm'} and $ENV{'MOD_PERL'}
1565 48 1 if ($weak_self) { }
1577 5 667 if (ref $info->[0] eq 'CODE') { }
1585 0 492 unless $dbh
1587 0 0 ref $info->[0] eq 'CODE' ? :
0 492 unless $dbh->FETCH('Active')
1596 492 0 unless ($self->unsafe)
1601 0 492 if $dbh->{'HandleError'} and ref $dbh->{'HandleError'} ne '__DBIC__DBH__ERROR__HANDLER__'
1605 2 490 unless ($dbh->{'RaiseError'})
1606 2 0 ref $info->[0] eq 'CODE' ? :
1652 309 8508 if ($self->{'_in_do_block'}) { }
1662 2 9231 unless $self->_seems_connected
1666 0 0 unless ($self->transaction_depth or $self->_dbh->FETCH('AutoCommit'))
1676 0 8621 if not $self->transaction_depth and defined $self->_dbh_autocommit and not $self->_dbh_autocommit
1694 19 140 unless $self->_seems_connected
1698 0 0 unless ($self->transaction_depth or $self->_dbh->FETCH('AutoCommit'))
1708 0 137 if not $self->transaction_depth and defined $self->_dbh_autocommit and not $self->_dbh_autocommit
1740 10737 7934 if (&blessed($ident))
1749 10961 7706 unless $args->[2]{'bind'}
1752 0 18667 if (not $ENV{'DBIC_DT_SEARCH_OK'} and $op eq 'select' and grep {$_->[1]->isa('DateTime') if defined &blessed($_->[1]);} @$bind)
1758 5 14012 if defined &blessed($_->[1])
1783 41046 9 if (my $col = $_[0]{'dbic_colname'})
1787 40941 105 if $colinfos->{$col}{'data_type'}
1790 10546 30500 if $colinfos->{$col}{'size'}
1793 9 41046 unless $ret
1809 2347 22125 !keys(%{$$_[0];}) || exists $_->[0]{'dbd_attrs'} || $_->[0]{'sqlt_datatype'} ? :
123 18930 ref $_->[0] eq 'SCALAR' ? :
24472 19053 ref $_->[0] eq 'HASH' ? :
36 43525 !defined($_->[0]) ? :
199 43561 ref $_ ne 'ARRAY' || @$_ != 2 ? :
1825 140 4 defined($_ && $_->[1]) ? :
1828 0 141 unless $_[1]
1834 147 17741 if $self->debug
1841 141 17715 if $self->debug
1854 152 42169 !$_->{'sqlt_datatype'} ? :
0 42321 exists $_->{'dbd_attrs'} ? :
1863 2416 39753 unless exists $$cache{$_->{'sqlt_datatype'}}
1878 13 10148 unless $self->_dbh
1900 0 10132 unless $rv
1906 8636 1496 wantarray ? :
1913 10 17864 $self->disable_sth_caching ? :
1930 0 17859 unless $sth
1939 0 20199 if (ref $bind->[$i][1] eq 'SCALAR') { }
1949 226 19973 length ref $bind->[$i][1] && &is_plain_value($bind->[$i][1]) ? :
1971 0 0 if ($colinfo->{$col}{'auto_nextval'} and !exists $to_insert->{$col} || &is_literal_value($to_insert->{$col}))
2170 0 0 unless $_[3]
0 0 unless @{[] unless $_[3];}
2395 14040 8069 if defined $bind_attrs->[$i]
2412 7713 37108 if ++$fetch_row_idx > $#$data
2424 103851 54 !defined($_->{'_literal_bind_subindex'}) ? :
2433 50 0 defined &blessed($$vref) ? :
103855 50 !(length ref $v && ($vref = &is_plain_value($v))) ? :
2454 0 7711 if not defined $err and !defined($rv) || $sth->err
2465 0 0 unless defined $err
2468 2 7711 if (defined $err)
2472 0 2 if $i > $#$tuple_status
2504 0 0 unless defined $err
2507 0 2 if defined $err
2533 1 0 if $_[3]{'software_limit'} and $_[3]{'offset'} || $_[3]{'rows'}
2573 179 7756 if $attrs->{'offset'}
2580 11 7924 if ($attrs->{'_grouped_by_distinct'} and $attrs->{'collapse'}) { }
47 7877 elsif ($prefetch_needs_subquery || !$attrs->{'_simple_passthrough_construction'} and $attrs->{'group_by'} and @{$attrs->{'group_by'};} and my $grp_aliases = &dbic_internal_try(sub { $self->_resolve_aliastypes_from_select_args({'from', $attrs->{'from'}, 'group_by', $attrs->{'group_by'}}); } )) { }
61 7816 elsif ($attrs->{'rows'} and $attrs->{'collapse'}) { }
2605 0 47 unless $grp_aliases->{'grouping'}
2613 87 7848 if ($prefetch_needs_subquery) { }
7842 6 elsif (not $attrs->{'software_limit'}) { }
2624 875 6973 if (not $prefetch_needs_subquery and ref $attrs->{'from'} and &reftype($attrs->{'from'}) eq 'ARRAY' and @{$attrs->{'from'};} != 1)
2713 4 0 if ($dbh->can('column_info'))
2715 0 4 $table =~ /^(.+?)\.(.+)$/ ? :
2722 6 8 $info->{'NULLABLE'} ? :
2733 4 0 if keys %result
2762 0 0 $sth->{'NULLABLE'}[$_->{'idx'}] ? :
2765 0 0 if ($inf->{'data_type'} =~ /^(.*?)\((.*?)\)$/)
2774 0 0 if ($dbh->can('type_info'))
2776 0 0 unless defined $inf->{'data_type'}
2797 0 0 if $inf->{'size'} || !1 and $inf->{'data_type'} =~ qr/^text$/i
2822 1242 0 if defined $id
2877 0 0 &dbic_internal_try(sub { local $dbh->{'PrintError'} = 0; local $dbh->{'RaiseError'} = 1; $dbh->do('select ?', {}, 1); 1; } ) ? :
2895 0 0 &dbic_internal_try(sub { local $dbh->{'PrintError'} = 0; local $dbh->{'RaiseError'} = 1; $dbh->do('select 1 where 1 = ?', {}, 1); 1; } ) ? :
2940 0 43 unless $_[1]
3008 0 0 if (my $missing = 'DBIx::Class::Optional::Dependencies'->req_missing_for('deploy'))
3012 0 0 if (not $dir) { }
3017 0 0 unless -d $dir
3021 0 0 if ref $databases ne 'ARRAY'
3031 0 0 unless $sqltargs
3037 0 0 unless my $sqlt_schema = $sqlt->translate({'data', $schema})
3047 0 0 if (-e $filename and $version eq $schema_version)
3054 0 0 unless ($output)
3058 0 0 unless (open $file, ">$filename")
3065 0 0 unless $preversion
3070 0 0 unless (-e $prefilename)
3076 0 0 if (-e $difffile)
3087 0 0 unless $t->parser($db)
3090 0 0 unless my $out = $t->translate($prefilename)
3095 0 0 unless $source_schema->name
3104 0 0 unless ("SQL::Translator::Producer::$db"->can('preprocess_schema'))
3109 0 0 unless $t->parser($db)
3112 0 0 unless my $out = $t->translate($filename)
3117 0 0 unless $dest_schema->name
3127 0 0 if $SQL::Translator::Producer::SQLite::NO_QUOTES
3136 0 0 unless (open $file, ">$difffile")
3226 0 0 unless $line
3227 0 0 if $line =~ /^--/
3229 0 0 if $line =~ /^BEGIN TRANSACTION/m
3230 0 0 if $line =~ /^COMMIT/m
3231 0 0 if $line =~ /^\s+$/
3242 0 0 unless $sqltargs
3243 0 0 if (@statements > 1) { }
0 0 elsif (@statements == 1) { }
3335 74 1619 $join_count && $join_count > 1 ? :
3349 0 0 if ($attr->{'sqlt_datatype'})
3352 0 0 if ($attr->{'sqlt_size'})
3355 0 0 if ($data_type =~ /^(?: l? (?:var)? char(?:acter)? (?:\s*varying)? | (?:var)? binary (?:\s*varying)? | raw )\b/x) { }
0 0 elsif ($data_type =~ /^(?: national \s* character (?:\s*varying)? | nchar | univarchar | nvarchar )\b/x) { }
3380 0 0 unless ($max_size or $self->_is_lob_type($data_type))
3385 0 0 unless $max_size or $self->_dbic_connect_attributes->{'LongReadLen'} or $self->_get_dbh->{'LongReadLen'}
3391 0 0 if $data_type
3399 0 0 if $data_type
3405 0 0 if $data_type
3413 0 0 if $data_type