Branch Coverage

blib/lib/DBIx/Class/Storage/DBI.pm
Criterion Covered Total %
branch 210 366 57.3


line true false branch
256 0 455 if &detected_reinvoked_destructor
275 24 67672 if (defined $pid and $pid != $$ and my $dbh = $_[0]->_dbh)
620 4 449 unless $info
624 449 0 if ref $info eq 'ARRAY'
628 0 449 unless $self->_default_dbi_connect_attributes
629 33 416 unless $info->{'attributes'}
634 442 7 if (keys %attrs and ref $args[0] ne 'CODE')
641 1 0 unless $attrs{'AutoCommit'} or $ENV{'DBIC_UNSAFE_AUTOCOMMIT_OK'}
643 442 0 if keys %attrs
681 449 786 if @_
687 168 6 if (not defined $conninfo->[0] and $ENV{'DBI_DSN'})
706 6 443 if (ref $args[0] eq 'CODE') { }
2 441 elsif (ref $args[0] eq 'HASH') { }
707 3 3 unless $args[1]
713 1 1 if (my $code = delete $attrs{'dbh_maker'}) { }
717 1 0 if (@ignored)
732 26 415 unless $args[3]
733 432 9 unless $args[4]
744 418 31 if @storage_opts
750 11 438 if @sql_maker_opts
752 416 33 if %attrs
782 37 451 unless defined $val
786 7 444 if (not ref $val) { }
442 2 elsif (ref $val eq 'CODE') { }
2 0 elsif (ref $val eq 'ARRAY') { }
840 3005 44299 if $self->{'_in_do_block'} or $self->transaction_depth
845 7071 37228 @_ ? :
851 23 0 if $_[0]->failed_attempt_count == 1
874 20 17 if (my $dbh = $_[0]->_dbh)
882 0 20 unless $_[0]->_dbh_autocommit
928 114 149 unless $_[0]->_seems_connected
947 67 106 unless $_[0]->connected
962 99 10 $_[0]->_dbh ? :
971 556 57255 unless $_[0]->_dbh
1056 463 2 $_[0]->_dbh_autocommit ? :
1058 461 4 unless $_[0]{'_in_determine_driver'}
1168 173 0 if ($info =~ /[^0-9]/)
1171 0 173 unless defined $info
1189 4 2 if $drv
1199 4 2 $drv ? :
1240 168 0 unless defined $v
1244 0 0 $expl ? :
1253 438 66 if (not $self->_driver_determined || $self->{'_in_determine_driver'})
1257 429 9 if (ref $self eq 'DBIx::Class::Storage::DBI')
1259 396 33 if ($self->_dbh) { }
1267 427 2 if ($driver) { }
1269 423 4 if ($self->load_optional_class($storage_class)) { }
1293 1 437 if ($self->can('source_bind_attributes'))
1304 7 430 if not $started_connected and defined $self->_dbh
1315 3 36 if (ref $self->_dbi_connect_info->[0] and &reftype($self->_dbi_connect_info->[0]) eq 'CODE') { }
1348 0 0 unless ($dbtype)
1359 0 0 if $self->isa($subclass)
1361 0 0 if ($self->load_optional_class($subclass)) { }
1389 25 1811 if (not ref $call) { }
900 911 elsif (ref $call eq 'CODE') { }
911 0 elsif (ref $call eq 'ARRAY') { }
1397 447 464 if (ref $call->[0] ne 'ARRAY') { }
1409 26 3 if ($method_prefix =~ /^connect/) { }
1452 4 16 if (ref $action eq 'CODE') { }
1461 3 13 ref $action eq 'ARRAY' ? :
1481 3 646 unless defined $info->[0]
1486 0 0 if $INC{'Apache/DBI.pm'} and $ENV{'MOD_PERL'}
1500 43 1 if ($weak_self) { }
1512 5 641 if (ref $info->[0] eq 'CODE') { }
1520 0 466 unless $dbh
1522 0 0 ref $info->[0] eq 'CODE' ? :
0 466 unless $dbh->FETCH('Active')
1531 466 0 unless ($self->unsafe)
1536 0 466 if $dbh->{'HandleError'} and ref $dbh->{'HandleError'} ne '__DBIC__DBH__ERROR__HANDLER__'
1540 2 464 unless ($dbh->{'RaiseError'})
1541 2 0 ref $info->[0] eq 'CODE' ? :
1587 293 8400 if ($self->{'_in_do_block'}) { }
1597 0 9127 unless $self->_seems_connected
1601 0 0 unless ($self->transaction_depth or $self->_dbh->FETCH('AutoCommit'))
1611 0 8527 if not $self->transaction_depth and defined $self->_dbh_autocommit and not $self->_dbh_autocommit
1627 0 244 unless $self->_seems_connected
1631 0 0 unless ($self->transaction_depth or $self->_dbh->FETCH('AutoCommit'))
1641 0 130 if not $self->transaction_depth and defined $self->_dbh_autocommit and not $self->_dbh_autocommit
1673 10636 7842 if (&blessed($ident))
1682 10855 7619 unless $args->[2]{'bind'}
1685 0 18474 if (not $ENV{'DBIC_DT_SEARCH_OK'} and $op eq 'select' and &first(sub { $_->[1]->isa('DateTime') if length ref $_->[1] and &blessed($_->[1]); } , @$bind))
1691 4 13901 if length ref $_->[1] and &blessed($_->[1])
1717 40726 9 if (my $col = $_[0]{'dbic_colname'})
1721 40619 107 if $colinfos->{$col}{'data_type'}
1724 10453 30273 if $colinfos->{$col}{'size'}
1727 9 40726 unless $ret
1743 2303 21927 !keys(%{$$_[0];}) || exists $_->[0]{'dbd_attrs'} || $_->[0]{'sqlt_datatype'} ? :
123 18808 ref $_->[0] eq 'SCALAR' ? :
24230 18931 ref $_->[0] eq 'HASH' ? :
36 43161 !defined($_->[0]) ? :
200 43197 ref $_ ne 'ARRAY' || @$_ != 2 ? :
1759 140 4 defined($_ && $_->[1]) ? :
1762 0 141 unless $_[1]
1768 146 17590 if $self->debug
1775 140 17566 if $self->debug
1786 0 41997 if (exists $_->{'dbd_attrs'}) { }
41842 155 elsif ($_->{'sqlt_datatype'}) { }
1793 2383 39459 unless (exists $$cache{$_->{'sqlt_datatype'}})
1815 14 10064 unless $self->_dbh
1837 0 10051 unless $rv
1843 8565 1486 wantarray ? :
1850 10 17712 $self->disable_sth_caching ? :
1867 0 17710 unless $sth
1876 0 20074 if (ref $bind->[$i][1] eq 'SCALAR') { }
1886 224 19850 length ref $bind->[$i][1] && &is_plain_value($bind->[$i][1]) ? :
1908 0 0 if ($colinfo->{$col}{'auto_nextval'} and !exists $to_insert->{$col} || &is_literal_value($to_insert->{$col}))
2054 0 0 unless $_[3]
0 0 unless @{[] unless $_[3];}
2280 13914 7997 if defined $bind_attrs->[$i]
2297 7644 36865 if ++$fetch_row_idx > $#$data
2309 103098 54 !defined($_->{'_literal_bind_subindex'}) ? :
2316 50 103102 length ref $v && &is_plain_value($v) ? :
2337 0 7642 if not defined $err and !defined($rv) || $sth->err
2348 0 0 unless defined $err
2351 2 7642 if (defined $err)
2355 0 2 if $i > $#$tuple_status
2388 0 0 unless defined $err
2391 0 2 if defined $err
2417 1 0 if $_[3]{'software_limit'} and $_[3]{'offset'} || $_[3]{'rows'}
2457 207 7636 if (defined $attrs->{'offset'})
2459 0 207 if $attrs->{'offset'} =~ /\D/ or $attrs->{'offset'} < 0
2462 1741 6102 if (defined $attrs->{'rows'}) { }
12 6090 elsif ($attrs->{'offset'}) { }
2464 0 1741 if $attrs->{'rows'} =~ /\D/ or $attrs->{'rows'} <= 0
2476 11 7832 if ($attrs->{'_grouped_by_distinct'} and $attrs->{'collapse'}) { }
47 7785 elsif ($prefetch_needs_subquery || !$attrs->{'_simple_passthrough_construction'} and $attrs->{'group_by'} and @{$attrs->{'group_by'};} and my $grp_aliases = &try(sub { $self->_resolve_aliastypes_from_select_args({'from', $attrs->{'from'}, 'group_by', $attrs->{'group_by'}}); } )) { }
61 7724 elsif ($attrs->{'rows'} and $attrs->{'collapse'}) { }
2501 0 47 unless $grp_aliases->{'grouping'}
2509 87 7756 if ($prefetch_needs_subquery) { }
7750 6 elsif (not $attrs->{'software_limit'}) { }
2520 844 6912 if (not $prefetch_needs_subquery and ref $attrs->{'from'} and &reftype($attrs->{'from'}) eq 'ARRAY' and @{$attrs->{'from'};} != 1)
2609 4 0 if ($dbh->can('column_info'))
2613 0 4 $table =~ /^(.+?)\.(.+)$/ ? :
2620 6 8 $info->{'NULLABLE'} ? :
2630 4 0 if not $caught and scalar keys %result
2641 0 0 $sth->{'NULLABLE'}[$i] ? :
2643 0 0 if ($column_info{'data_type'} =~ /^(.*?)\((.*?)\)$/)
2656 0 0 if (defined $type_num and $dbh->can('type_info'))
2658 0 0 if $type_info
2659 0 0 if $type_name
2682 1227 0 if defined $id
2800 0 46 unless $_[1]
2867 0 0 if ($dir) { }
2871 0 0 unless -d $dir or require File::Path and File::Path::mkpath(["$dir"])
2880 0 0 unless -d $dir
2883 0 0 if ref $databases ne 'ARRAY'
2893 0 0 unless $sqltargs
2896 0 0 unless ('DBIx::Class::Optional::Dependencies'->req_ok_for('deploy'))
2903 0 0 unless my $sqlt_schema = $sqlt->translate({'data', $schema})
2913 0 0 if (-e $filename and $version eq $schema_version)
2920 0 0 unless ($output)
2924 0 0 unless (open $file, ">$filename")
2931 0 0 unless $preversion
2936 0 0 unless (-e $prefilename)
2942 0 0 if (-e $difffile)
2953 0 0 unless $t->parser($db)
2956 0 0 unless my $out = $t->translate($prefilename)
2961 0 0 unless $source_schema->name
2970 0 0 unless ("SQL::Translator::Producer::$db"->can('preprocess_schema'))
2975 0 0 unless $t->parser($db)
2978 0 0 unless my $out = $t->translate($filename)
2983 0 0 unless $dest_schema->name
2993 0 0 if $SQL::Translator::Producer::SQLite::NO_QUOTES
3002 0 0 unless (open $file, ">$difffile")
3086 0 0 unless $line
3087 0 0 if $line =~ /^--/
3089 0 0 if $line =~ /^BEGIN TRANSACTION/m
3090 0 0 if $line =~ /^COMMIT/m
3091 0 0 if $line =~ /^\s+$/
3102 0 0 unless $sqltargs
3103 0 0 if (@statements > 1) { }
0 0 elsif (@statements == 1) { }
3195 69 1580 $join_count && $join_count > 1 ? :
3209 0 0 if ($attr->{'sqlt_datatype'})
3212 0 0 if ($attr->{'sqlt_size'})
3215 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) { }
3240 0 0 unless ($max_size or $self->_is_lob_type($data_type))
3245 0 0 unless $max_size or $self->_dbic_connect_attributes->{'LongReadLen'} or $self->_get_dbh->{'LongReadLen'}
3251 0 0 if $data_type
3259 0 0 if $data_type
3265 0 0 if $data_type
3273 0 0 if $data_type