Branch Coverage

blib/lib/DBI.pm
Criterion Covered Total %
branch 373 562 66.3


line true false branch
271 97 97 if ($ENV{'DBI_PUREPERL'}) { }
272 0 97 if $ENV{'DBI_PUREPERL'} == 1
273 97 0 if $@ or $ENV{'DBI_PUREPERL'} >= 2
532 0 194 unless defined &DBI::trace_msg
537 140 54 if %DBI::installed_drh
542 0 0 unless $DBI::PurePerl
546 0 0 if defined &{"DBD::${driver}::CLONE";}
554 628 2 unless $dsn =~ s/^(dbi):(\w*?)(?:\((.*?)\))?://i
557 0 2 if $attr
563 0 8 unless defined $outer_info
566 0 12 unless my $child_info = &$code($h, $outer_info)
580 0 3146 $DBI::connect_via eq 'Apache::DBI::connect' ? :
582 3146 0 $attr ? :
594 0 6973 if ($attr and not ref $attr)
602 6973 0 unless $old_driver
604 29 6944 if ($DBI::dbi_debug)
606 0 29 if $connect_meth ne 'connect'
610 4 6969 if ref $old_driver or $attr and not ref $attr or ref $pass and not defined &Scalar::Util::blessed($pass)
615 0 6969 unless $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i
621 0 6969 unless $driver = $old_driver || $1 || $ENV{'DBI_DRIVER'}
627 194 34 if ($ENV{'DBI_AUTOPROXY'} and $driver ne 'Proxy' and $driver ne 'Sponge' and $driver ne 'Switch')
630 194 0 if ($dbi_autoproxy =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i)
632 6 188 $driver_attrib_spec ? :
0 194 $2 ? :
641 228 6741 if $ENV{'DBI_AUTOPROXY'}
644 0 6969 if ($old_driver) { }
645 0 0 if $attr
648 6969 0 ref $attr ? :
14 6955 $driver_attrib_spec ? :
658 0 6965 unless my $drh = $DBI::installed_drh{$driver} || $class->install_driver($driver)
662 5141 1824 if defined $attr->{'Username'}
663 5141 1824 if defined $attr->{'Password'}
665 1606 5359 unless (defined $user and defined $pass)
677 38 6907 unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr))
678 36 2 unless defined $user
679 0 38 unless defined $dsn
685 0 38 unless defined $errstr
689 38 0 unless ($attr->{'HandleError'} and $attr->{'HandleError'}->($msg, $drh, $dbh))
690 14 24 if $attr->{'RaiseError'}
691 0 24 if $attr->{'PrintError'}
698 16 6891 $override_attr ? :
702 32 6875 if ($rebless_class)
704 24 8 if ($apply->{'RootClass'})
708 28 0 if (@{"${rebless_class}::db::ISA";} and @{"${rebless_class}::st::ISA";}) { }
720 6321 582 if (%$apply)
722 0 6321 if ($apply->{'DbTypeSubclass'})
728 6428 18856 unless exists $apply->{$a}
733 0 28547 if $@
741 10 6893 if $DBI::dbi_debug & 15
748 6887 24 if $dbh
757 236 0 if ref $drh
775 8 240 if $driver =~ s/^DBI:(.*?)://i
777 0 248 unless $driver and @_ <= 3
781 8 240 if $drh = $DBI::installed_drh{$driver}
783 6 234 if $DBI::dbi_debug & 15
793 4 236 if ($@)
796 0 4 if ($err =~ /Can't find loadable object/) { }
4 0 elsif ($err =~ m[Can't locate.*?DBD/$driver\.pm in \@INC]) { }
0 0 elsif ($err =~ /Can't load .*? for module DBD::/) { }
0 0 elsif ($err =~ /Can't locate .*? in \@INC/) { }
815 6 230 if ($DBI::dbi_debug & 15)
828 0 236 unless ($drh and ref $drh and not $@)
832 0 0 if $@ =~ /locate object method/
838 6 230 if $DBI::dbi_debug & 15
851 1314 306 unless UNIVERSAL::isa($h_class, "DBD::_::$h_type")
856 765 759 unless UNIVERSAL::isa("${h_class}_mem", $mem_class) or $DBI::PurePerl
882 56 0 if (@$sub_class_isa) { }
883 0 56 if $trace
887 0 0 unless @$sub_class_isa
888 0 0 if $trace
915 0 0 if ($DbTypeSubclass and $DbTypeSubclass ne '1' and ref $DbTypeSubclass ne 'CODE')
925 0 0 if ($driver eq 'Proxy')
927 0 0 unless ($driver) = $dbh->{'proxy_client'}{'application'} =~ /^DBI:(.+?):/i
932 0 0 if ($driver eq 'ODBC' or $driver eq 'ADO')
943 0 0 if $driver eq 'ODBC'
945 0 0 if $driver eq 'ADO'
947 0 0 unless $name
951 0 0 if ($_dbtype_name_map{$name}) { }
955 0 0 if ($name =~ /($_dbtype_name_regexp)/) { }
965 0 0 if $driver eq 'ADO'
969 0 0 if ref $DbTypeSubclass eq 'CODE'
979 20 4 if @{"${load_class}::ISA";}
983 0 4 unless $@
984 0 4 if $missing_ok and $@ =~ /^Can't locate \Q$module.pm\E/
998 5324 0 if exists $dbd_class_registry{$driver}
1010 132 0 $haveFileSpec ? :
1012 96 36 unless -d $dbd_dir
1013 8 28 if $seen_dir{$d}
1017 0 28 unless opendir DIR, $dbd_dir
1019 112 224 unless $f =~ s/\.pm$//
1020 28 196 if $f eq 'NullP'
1021 112 84 if ($seen_dbd{$f}) { }
1022 0 112 unless $quiet
1033 8 4 wantarray ? :
1041 0 0 if $DBI::PurePerl and grep {-d "$_/auto/DBD/$driver";} @INC
1046 0 0 if $@
1051 0 0 if (wantarray)
1052 0 0 /^DBD::(\w+)/ ? :
1055 0 0 if $DBI::PurePerl
1056 0 0 unless (defined wantarray)
1079 4 128 unless defined $maxlen
1080 4 128 unless defined $sep
1087 0 4 unless $sth
1094 12 4 if $rows++ and $lsep
1098 0 4 $DBI::err ? :
1107 4 24 if $logical and not $diff
1111 12 12 if not $diff and $a_desc eq $b_desc
1113 8 4 if length $a
1115 12 0 if $diff
1125 16 44 unless (defined $a and defined $b)
1126 8 0 unless defined $a or defined $b
1128 0 8 unless defined $a
1130 8 0 unless defined $b
1136 0 44 unless defined &utf8::is_utf8
1138 0 44 utf8::is_utf8($a) ? :
1139 8 36 utf8::is_utf8($b) ? :
1142 60 12 if $a_chars[0] == $b_chars[0]
1145 0 24 chr($_) =~ /[[:cntrl:]]/ ? :
0 24 $_ > 255 ? :
1153 24 0 unless $c =~ /\\x\{08(..)}/
1158 4 28 if @b_chars
1159 4 24 if @a_chars
1170 0 72 unless defined &utf8::is_utf8
1171 0 72 unless defined &utf8::valid
1178 8 64 utf8::is_utf8($a) ? :
72 0 utf8::valid($a || '') ? :
1181 16 56 unless defined $a
1183 40 16 $is_ascii ? :
1191 0 0 unless ref $attr
1200 0 0 unless my $drh = $class->install_driver($dsn)
1202 0 0 unless $drh->connect($dsn, $dbuser, $dbpass)
1207 0 0 if $verb
1213 0 0 if $verb
1215 0 0 unless $_->disconnect
1263 3 237 if ($ENV{'DBI_PROFILE'} and not $DBI::PurePerl or $shared_profile)
1267 2 1 if (not $shared_profile) { }
1275 46 194 unless wantarray
1282 0 3856 unless my $imp_class = $drh->{'ImplementorClass'}
1295 0 7719 unless my $imp_class = $dbh->{'ImplementorClass'}
1319 0 4 if $drh
1327 0 4 unless $drh and $inner
1336 0 26 if $key eq 'DebugDispatch'
1337 0 26 if $key eq 'DebugLog'
1343 4 16 if ($key eq 'DebugDispatch') { }
0 16 elsif ($key eq 'DebugLog') { }
1386 0 628 unless $class =~ /^DBD::(\w+)::(dr|db|st)$/
1389 0 628 unless $method =~ /^([a-z][a-z0-9]*_)\w+$/
1393 0 628 unless $reg_info
1400 348 280 unless $attr
1410 0 124 if (DBI::looks_like_number($word) and $word <= 15 and $word >= 0) { }
4 120 elsif ($word eq 'ALL') { }
108 12 elsif (my $flag = $h->parse_trace_flag($word)) { }
1422 8 0 ref $h ? :
8 0 if (@unknown and ref $h ? $h->FETCH('Warn') : 1)
1433 24 72 if $name eq 'SQL'
1434 14 58 if $name eq 'CON'
1435 14 44 if $name eq 'ENC'
1436 14 30 if $name eq 'DBD'
1437 14 16 if $name eq 'TXN'
1447 0 28 unless defined $info
1448 8 20 unless $h->{'ChildHandles'}
1449 368 16 unless $ch
1450 0 16 unless my $child_info = &$code($ch, $info)
1466 1606 4 unless defined $user
1467 1606 4 unless defined $pass
1493 0 3146 if ($DBI::dbi_debug & 15) >= 4
1497 3114 0 if ($dbh and $dbh->FETCH('Active') and eval { do { $dbh->ping } })
1499 2 3112 if ($cb and $cb = $cb->{'connect_cached.reused'})
1507 2 30 if ($cb and my $new_cb = $cb->{'connect_cached.new'})
1514 2 30 if ($cb and my $conn_cb = $cb->{'connect_cached.connected'})
1533 0 16 unless my $closure = $old_dbh->{'dbi_connect_closure'}
1535 8 8 unless ($attr)
1540 40 158 if ref $v and ref $v ne 'CODE'
1554 0 16 unless ($new_dbh)
1565 0 114 @id > 3 && ref $id[-1] ? :
1575 114 208 unless defined $_
1581 102 12 @id >= 3 ? :
1586 78 36 if ($catalog)
1587 70 8 if ($quoted_id) { }
1588 2 68 $info->[2] == 2 ? :
1601 4 12 unless defined $str
1602 4 8 unless ($data_type)
1613 8 0 unless (defined $lp and defined $ls)
1615 8 0 $ti ? :
1616 8 0 $ti ? :
1618 4 4 unless $lp or $ls
1623 4 0 if $lp and $lp eq $ls and $lp eq q['] || $lp eq '"'
1632 4 1689 unless my $sth = $dbh->prepare($statement, $attr)
1633 1469 220 unless $sth->execute(@params)
1635 60 160 $rows == 0 ? :
1640 0 16 ref $stmt ? :
0 16 unless my $sth = ref $stmt ? $stmt : $dbh->prepare($stmt, $attr)
1642 8 8 unless $sth->execute(@bind)
1644 8 0 if my $row = $sth->$method
1654 0 4 unless my $row = _do_selectrow('fetchrow_arrayref', @_)
1655 0 4 unless wantarray
1660 0 4 unless (shift())->selectall_arrayref(@_)
1667 4 122 ref $stmt ? :
4 122 unless my $sth = ref $stmt ? $stmt : $dbh->prepare($stmt, $attr)
1669 0 122 unless $sth->execute(@bind)
1671 8 114 if (not $slice and $slice = $attr->{'Columns'})
1672 4 4 if (ref $slice eq 'ARRAY')
1678 0 122 if defined $MaxRows
1684 0 8 ref $stmt ? :
1685 0 8 unless $sth
1686 0 8 unless $sth->execute(@bind)
1692 0 8 ref $stmt ? :
1693 0 8 unless $sth
1694 0 8 unless $sth->execute(@bind)
1695 4 4 $attr->{'Columns'} ? :
1699 0 12 unless $sth->bind_col($_, \$values[$idx++])
1702 0 8 if (my $max = $attr->{'MaxRows'}) { }
1723 12 36 if ($sth)
1724 0 12 unless $sth->FETCH('Active')
1725 4 8 unless $if_active ||= 0
1727 8 4 if $if_active <= 1
1728 8 4 if $if_active <= 2
1732 40 0 if $sth
1741 8 4 $dbh->FETCH('Active') ? :
1746 0 4 unless $dbh->FETCH('AutoCommit')
1755 0 0 unless my $sth = $dbh->primary_key_info(@args)
1758 0 0 unless wantarray
1765 0 32 unless my $sth = $dbh->table_info(@args[0, 1, 2, 3, 4])
1766 0 32 unless my $tables = $sth->fetchall_arrayref
1768 4 28 if (defined $args[3] and $args[3] eq '%' and grep {$_ eq '' if defined $_;} @args[0, 1, 2]) { }
16 12 elsif ($dbh->get_info(29)) { }
1769 12 0 if defined $_
1778 16 0 if ($_->[1])
1781 0 16 $schema eq uc $schema ? :
1794 18 10 if ($tia) { }
1799 0 10 unless $temp and @$temp
1808 0 28 if $dt_idx and $dt_idx != 1
1813 0 28 ref $data_type ? :
1815 24 4 if (defined $data_type and $data_type != &DBI::SQL_ALL_TYPES()) { }
1821 28 0 if @ti
1829 0 28 if @ti and @{$ti[0];} != $idx_fields
1833 24 4 unless wantarray
1870 4 76 if defined $value_array and ref $value_array and ref $value_array ne 'ARRAY'
1873 4 76 unless DBI::looks_like_number($p_id)
1876 0 76 if $p_id <= 0
1890 0 76 if $attr
1907 0 116 if ($fields <= 0 and not $sth->{'Active'})
1914 12 104 if not defined $_[0] or ref $_[0] eq 'HASH'
1920 8 108 if @_ or $idx != $fields
1933 4 44 if $tuple_sts and ref $tuple_sts ne 'ARRAY'
1937 28 16 if (@array_of_arrays)
1939 4 24 if defined $NUM_OF_PARAMS and @array_of_arrays != $NUM_OF_PARAMS
1948 8 28 if ($fetch_tuple_sub = $attr->{'ArrayTupleFetch'}) { }
1950 0 8 if @array_of_arrays
1954 4 4 if (UNIVERSAL::isa($fetch_tuple_sub, 'DBI::st')) { }
0 4 elsif (not UNIVERSAL::isa($fetch_tuple_sub, 'CODE')) { }
1958 0 4 unless $fetch_sth->{'Active'}
1961 0 4 if defined $NUM_OF_FIELDS and defined $NUM_OF_PARAMS and $NUM_OF_FIELDS != $NUM_OF_PARAMS
1973 0 28 unless $sth->{'ParamArrays'}
1974 0 28 if defined $NUM_OF_PARAMS and $NUM_OF_PARAMS != $NUM_OF_PARAMS_given
1983 52 48 unless ref $ary eq 'ARRAY'
1984 36 12 if not $maxlen or @$ary > $maxlen
1987 4 24 unless defined $maxlen
1992 28 40 if $tuple_idx >= $maxlen
1995 72 88 ref $a ? :
2008 32 4 $tuple_status ? :
2013 56 4 if (my $rc = $sth->execute(@$tuple)) { }
2015 56 0 $rc >= 0 && $rc_total >= 0 ? :
2025 4 32 if $err_count
2028 28 4 unless wantarray
2039 4 2354 if $max_rows and not $sth->FETCH('Active')
2044 2322 32 if ($mode eq 'ARRAY')
2048 16 2306 if ($slice and @$slice) { }
8 2298 elsif (defined $max_rows) { }
2049 12 4 unless defined $max_rows
2064 12 20 if ($mode eq 'REF' and ref $$slice eq 'HASH') { }
16 4 elsif ($mode eq 'HASH') { }
2071 12 4 if (keys %$slice) { }
2075 4 16 unless defined $idx
2082 0 4 unless @column_names
2091 20 0 if (not defined $max_rows) { }
2106 8 88 ref $key_field ? :
2111 4 0 if not defined $index and DBI::looks_like_number($_) and $_ >= 1 and $_ <= $num_of_fields
2112 0 100 unless defined $index
2136 0 0 unless (ref $fh)
2137 0 0 unless open FH, ">$fh"