Branch Coverage

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


line true false branch
271 96 96 if ($ENV{'DBI_PUREPERL'}) { }
272 0 96 if $ENV{'DBI_PUREPERL'} == 1
273 96 0 if $@ or $ENV{'DBI_PUREPERL'} >= 2
530 0 192 unless defined &DBI::trace_msg
535 138 54 if %DBI::installed_drh
540 0 0 unless $DBI::PurePerl
544 0 0 if defined &{"DBD::${driver}::CLONE";}
552 628 2 unless $dsn =~ s/^(dbi):(\w*?)(?:\((.*?)\))?://i
555 0 2 if $attr
561 0 8 unless defined $outer_info
564 0 12 unless my $child_info = &$code($h, $outer_info)
578 0 3146 $DBI::connect_via eq 'Apache::DBI::connect' ? :
580 3146 0 $attr ? :
592 0 6971 if ($attr and not ref $attr)
600 6971 0 unless $old_driver
602 29 6942 if ($DBI::dbi_debug)
604 0 29 if $connect_meth ne 'connect'
608 4 6967 if ref $old_driver or $attr and not ref $attr or ref $pass and not defined &Scalar::Util::blessed($pass)
613 0 6967 unless $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i
619 0 6967 unless $driver = $old_driver || $1 || $ENV{'DBI_DRIVER'}
625 194 34 if ($ENV{'DBI_AUTOPROXY'} and $driver ne 'Proxy' and $driver ne 'Sponge' and $driver ne 'Switch')
628 194 0 if ($dbi_autoproxy =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i)
630 6 188 $driver_attrib_spec ? :
0 194 $2 ? :
639 228 6739 if $ENV{'DBI_AUTOPROXY'}
642 0 6967 if ($old_driver) { }
643 0 0 if $attr
646 6967 0 ref $attr ? :
14 6953 $driver_attrib_spec ? :
656 0 6963 unless my $drh = $DBI::installed_drh{$driver} || $class->install_driver($driver)
660 5141 1822 if defined $attr->{'Username'}
661 5141 1822 if defined $attr->{'Password'}
663 1604 5359 unless (defined $user and defined $pass)
675 38 6905 unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr))
676 36 2 unless defined $user
677 0 38 unless defined $dsn
683 0 38 unless defined $errstr
687 38 0 unless ($attr->{'HandleError'} and $attr->{'HandleError'}->($msg, $drh, $dbh))
688 14 24 if $attr->{'RaiseError'}
689 0 24 if $attr->{'PrintError'}
696 16 6889 $override_attr ? :
700 32 6873 if ($rebless_class)
702 24 8 if ($apply->{'RootClass'})
706 28 0 if (@{"${rebless_class}::db::ISA";} and @{"${rebless_class}::st::ISA";}) { }
718 6321 580 if (%$apply)
720 0 6321 if ($apply->{'DbTypeSubclass'})
726 6428 18856 unless exists $apply->{$a}
731 0 28547 if $@
739 10 6891 if $DBI::dbi_debug & 15
746 6885 24 if $dbh
755 234 0 if ref $drh
773 8 238 if $driver =~ s/^DBI:(.*?)://i
775 0 246 unless $driver and @_ <= 3
779 8 238 if $drh = $DBI::installed_drh{$driver}
781 6 232 if $DBI::dbi_debug & 15
791 4 234 if ($@)
794 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/) { }
813 6 228 if ($DBI::dbi_debug & 15)
826 0 234 unless ($drh and ref $drh and not $@)
830 0 0 if $@ =~ /locate object method/
836 6 228 if $DBI::dbi_debug & 15
849 1302 300 unless UNIVERSAL::isa($h_class, "DBD::_::$h_type")
854 756 750 unless UNIVERSAL::isa("${h_class}_mem", $mem_class) or $DBI::PurePerl
880 56 0 if (@$sub_class_isa) { }
881 0 56 if $trace
885 0 0 unless @$sub_class_isa
886 0 0 if $trace
913 0 0 if ($DbTypeSubclass and $DbTypeSubclass ne '1' and ref $DbTypeSubclass ne 'CODE')
923 0 0 if ($driver eq 'Proxy')
925 0 0 unless ($driver) = $dbh->{'proxy_client'}{'application'} =~ /^DBI:(.+?):/i
930 0 0 if ($driver eq 'ODBC' or $driver eq 'ADO')
941 0 0 if $driver eq 'ODBC'
943 0 0 if $driver eq 'ADO'
945 0 0 unless $name
949 0 0 if ($_dbtype_name_map{$name}) { }
953 0 0 if ($name =~ /($_dbtype_name_regexp)/) { }
963 0 0 if $driver eq 'ADO'
967 0 0 if ref $DbTypeSubclass eq 'CODE'
977 20 4 if @{"${load_class}::ISA";}
981 0 4 unless $@
982 0 4 if $missing_ok and $@ =~ /^Can't locate \Q$module.pm\E/
996 5316 0 if exists $dbd_class_registry{$driver}
1008 132 0 $haveFileSpec ? :
1010 96 36 unless -d $dbd_dir
1011 8 28 if $seen_dir{$d}
1015 0 28 unless opendir DIR, $dbd_dir
1017 112 196 unless $f =~ s/\.pm$//
1018 28 168 if $f eq 'NullP'
1019 96 72 if ($seen_dbd{$f}) { }
1020 0 96 unless $quiet
1031 8 4 wantarray ? :
1039 0 0 if $DBI::PurePerl and grep {-d "$_/auto/DBD/$driver";} @INC
1044 0 0 if $@
1049 0 0 if (wantarray)
1050 0 0 /^DBD::(\w+)/ ? :
1053 0 0 if $DBI::PurePerl
1054 0 0 unless (defined wantarray)
1077 4 124 unless defined $maxlen
1078 4 124 unless defined $sep
1085 0 4 unless $sth
1092 8 4 if $rows++ and $lsep
1096 0 4 $DBI::err ? :
1105 4 24 if $logical and not $diff
1109 12 12 if not $diff and $a_desc eq $b_desc
1111 8 4 if length $a
1113 12 0 if $diff
1123 16 44 unless (defined $a and defined $b)
1124 8 0 unless defined $a or defined $b
1126 0 8 unless defined $a
1128 8 0 unless defined $b
1134 0 44 unless defined &utf8::is_utf8
1136 0 44 utf8::is_utf8($a) ? :
1137 8 36 utf8::is_utf8($b) ? :
1140 60 12 if $a_chars[0] == $b_chars[0]
1143 0 24 chr($_) =~ /[[:cntrl:]]/ ? :
0 24 $_ > 255 ? :
1151 24 0 unless $c =~ /\\x\{08(..)}/
1156 4 28 if @b_chars
1157 4 24 if @a_chars
1168 0 72 unless defined &utf8::is_utf8
1169 0 72 unless defined &utf8::valid
1176 8 64 utf8::is_utf8($a) ? :
72 0 utf8::valid($a || '') ? :
1179 16 56 unless defined $a
1181 40 16 $is_ascii ? :
1189 0 0 unless ref $attr
1198 0 0 unless my $drh = $class->install_driver($dsn)
1200 0 0 unless $drh->connect($dsn, $dbuser, $dbpass)
1205 0 0 if $verb
1211 0 0 if $verb
1213 0 0 unless $_->disconnect
1261 3 235 if ($ENV{'DBI_PROFILE'} and not $DBI::PurePerl or $shared_profile)
1265 2 1 if (not $shared_profile) { }
1273 44 194 unless wantarray
1280 0 3854 unless my $imp_class = $drh->{'ImplementorClass'}
1293 0 7701 unless my $imp_class = $dbh->{'ImplementorClass'}
1317 0 4 if $drh
1325 0 4 unless $drh and $inner
1334 0 26 if $key eq 'DebugDispatch'
1335 0 26 if $key eq 'DebugLog'
1341 4 16 if ($key eq 'DebugDispatch') { }
0 16 elsif ($key eq 'DebugLog') { }
1384 0 616 unless $class =~ /^DBD::(\w+)::(dr|db|st)$/
1387 0 616 unless $method =~ /^([a-z][a-z0-9]*_)\w+$/
1391 0 616 unless $reg_info
1398 336 280 unless $attr
1408 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)) { }
1420 8 0 ref $h ? :
8 0 if (@unknown and ref $h ? $h->FETCH('Warn') : 1)
1431 24 72 if $name eq 'SQL'
1432 14 58 if $name eq 'CON'
1433 14 44 if $name eq 'ENC'
1434 14 30 if $name eq 'DBD'
1435 14 16 if $name eq 'TXN'
1445 0 28 unless defined $info
1446 8 20 unless $h->{'ChildHandles'}
1447 368 16 unless $ch
1448 0 16 unless my $child_info = &$code($ch, $info)
1464 1604 4 unless defined $user
1465 1604 4 unless defined $pass
1491 0 3146 if ($DBI::dbi_debug & 15) >= 4
1495 3114 0 if ($dbh and $dbh->FETCH('Active') and eval { do { $dbh->ping } })
1497 2 3112 if ($cb and $cb = $cb->{'connect_cached.reused'})
1505 2 30 if ($cb and my $new_cb = $cb->{'connect_cached.new'})
1512 2 30 if ($cb and my $conn_cb = $cb->{'connect_cached.connected'})
1531 0 16 unless my $closure = $old_dbh->{'dbi_connect_closure'}
1533 8 8 unless ($attr)
1538 40 158 if ref $v and ref $v ne 'CODE'
1552 0 16 unless ($new_dbh)
1563 0 114 @id > 3 && ref $id[-1] ? :
1573 114 208 unless defined $_
1579 102 12 @id >= 3 ? :
1584 78 36 if ($catalog)
1585 70 8 if ($quoted_id) { }
1586 2 68 $info->[2] == 2 ? :
1599 4 12 unless defined $str
1600 4 8 unless ($data_type)
1611 8 0 unless (defined $lp and defined $ls)
1613 8 0 $ti ? :
1614 8 0 $ti ? :
1616 4 4 unless $lp or $ls
1621 4 0 if $lp and $lp eq $ls and $lp eq q['] || $lp eq '"'
1630 4 1671 unless my $sth = $dbh->prepare($statement, $attr)
1631 1469 202 unless $sth->execute(@params)
1633 56 146 $rows == 0 ? :
1638 0 16 ref $stmt ? :
0 16 unless my $sth = ref $stmt ? $stmt : $dbh->prepare($stmt, $attr)
1640 8 8 unless $sth->execute(@bind)
1642 8 0 if my $row = $sth->$method
1652 0 4 unless my $row = _do_selectrow('fetchrow_arrayref', @_)
1653 0 4 unless wantarray
1658 0 4 unless (shift())->selectall_arrayref(@_)
1665 4 122 ref $stmt ? :
4 122 unless my $sth = ref $stmt ? $stmt : $dbh->prepare($stmt, $attr)
1667 0 122 unless $sth->execute(@bind)
1669 8 114 if (not $slice and $slice = $attr->{'Columns'})
1670 4 4 if (ref $slice eq 'ARRAY')
1676 0 122 if defined $MaxRows
1682 0 8 ref $stmt ? :
1683 0 8 unless $sth
1684 0 8 unless $sth->execute(@bind)
1690 0 8 ref $stmt ? :
1691 0 8 unless $sth
1692 0 8 unless $sth->execute(@bind)
1693 4 4 $attr->{'Columns'} ? :
1697 0 12 unless $sth->bind_col($_, \$values[$idx++])
1700 0 8 if (my $max = $attr->{'MaxRows'}) { }
1721 12 36 if ($sth)
1722 0 12 unless $sth->FETCH('Active')
1723 4 8 unless $if_active ||= 0
1725 8 4 if $if_active <= 1
1726 8 4 if $if_active <= 2
1730 40 0 if $sth
1739 8 4 $dbh->FETCH('Active') ? :
1744 0 4 unless $dbh->FETCH('AutoCommit')
1753 0 0 unless my $sth = $dbh->primary_key_info(@args)
1756 0 0 unless wantarray
1763 0 32 unless my $sth = $dbh->table_info(@args[0, 1, 2, 3, 4])
1764 0 32 unless my $tables = $sth->fetchall_arrayref
1766 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)) { }
1767 12 0 if defined $_
1776 16 0 if ($_->[1])
1779 0 16 $schema eq uc $schema ? :
1792 18 10 if ($tia) { }
1797 0 10 unless $temp and @$temp
1806 0 28 if $dt_idx and $dt_idx != 1
1811 0 28 ref $data_type ? :
1813 24 4 if (defined $data_type and $data_type != &DBI::SQL_ALL_TYPES()) { }
1819 28 0 if @ti
1827 0 28 if @ti and @{$ti[0];} != $idx_fields
1831 24 4 unless wantarray
1868 4 76 if defined $value_array and ref $value_array and ref $value_array ne 'ARRAY'
1871 4 76 unless DBI::looks_like_number($p_id)
1874 0 76 if $p_id <= 0
1888 0 76 if $attr
1905 0 116 if ($fields <= 0 and not $sth->{'Active'})
1912 12 104 if not defined $_[0] or ref $_[0] eq 'HASH'
1918 8 108 if @_ or $idx != $fields
1931 4 44 if $tuple_sts and ref $tuple_sts ne 'ARRAY'
1935 28 16 if (@array_of_arrays)
1937 4 24 if defined $NUM_OF_PARAMS and @array_of_arrays != $NUM_OF_PARAMS
1946 8 28 if ($fetch_tuple_sub = $attr->{'ArrayTupleFetch'}) { }
1948 0 8 if @array_of_arrays
1952 4 4 if (UNIVERSAL::isa($fetch_tuple_sub, 'DBI::st')) { }
0 4 elsif (not UNIVERSAL::isa($fetch_tuple_sub, 'CODE')) { }
1956 0 4 unless $fetch_sth->{'Active'}
1959 0 4 if defined $NUM_OF_FIELDS and defined $NUM_OF_PARAMS and $NUM_OF_FIELDS != $NUM_OF_PARAMS
1971 0 28 unless $sth->{'ParamArrays'}
1972 0 28 if defined $NUM_OF_PARAMS and $NUM_OF_PARAMS != $NUM_OF_PARAMS_given
1981 52 48 unless ref $ary eq 'ARRAY'
1982 36 12 if not $maxlen or @$ary > $maxlen
1985 4 24 unless defined $maxlen
1990 28 40 if $tuple_idx >= $maxlen
1993 72 88 ref $a ? :
2006 32 4 $tuple_status ? :
2011 56 4 if (my $rc = $sth->execute(@$tuple)) { }
2013 56 0 $rc >= 0 && $rc_total >= 0 ? :
2023 4 32 if $err_count
2026 28 4 unless wantarray
2037 4 2354 if $max_rows and not $sth->FETCH('Active')
2042 2322 32 if ($mode eq 'ARRAY')
2046 16 2306 if ($slice and @$slice) { }
8 2298 elsif (defined $max_rows) { }
2047 12 4 unless defined $max_rows
2062 12 20 if ($mode eq 'REF' and ref $$slice eq 'HASH') { }
16 4 elsif ($mode eq 'HASH') { }
2069 12 4 if (keys %$slice) { }
2073 4 16 unless defined $idx
2080 0 4 unless @column_names
2089 20 0 if (not defined $max_rows) { }
2104 8 88 ref $key_field ? :
2109 4 0 if not defined $index and DBI::looks_like_number($_) and $_ >= 1 and $_ <= $num_of_fields
2110 0 100 unless defined $index
2134 0 0 unless (ref $fh)
2135 0 0 unless open FH, ">$fh"