Branch Coverage

blib/lib/DBI.pm
Criterion Covered Total %
branch 365 552 66.1


line true false branch
271 90 90 if ($ENV{'DBI_PUREPERL'}) { }
272 0 90 if $ENV{'DBI_PUREPERL'} == 1
273 90 0 if $@ or $ENV{'DBI_PUREPERL'} >= 2
535 0 180 unless defined &trace_msg
540 128 52 if %DBI::installed_drh
545 0 0 unless $DBI::PurePerl
549 0 0 if defined &{"DBD::${driver}::CLONE";}
557 624 2 unless $dsn =~ s/^(dbi):(\w*?)(?:\((.*?)\))?://i
560 0 2 if $attr
566 0 8 unless defined $outer_info
569 0 12 unless my $child_info = &$code($h, $outer_info)
583 0 3146 $DBI::connect_via eq 'Apache::DBI::connect' ? :
585 3146 0 $attr ? :
597 0 5393 if ($attr and not ref $attr)
605 5393 0 unless $old_driver
607 29 5364 if ($DBI::dbi_debug)
609 0 29 if $connect_meth ne 'connect'
613 0 5393 if ref $old_driver or $attr and not ref $attr or ref $pass
617 0 5393 unless $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i
622 0 5393 unless $driver = $old_driver || $1 || $ENV{'DBI_DRIVER'}
629 184 34 if ($ENV{'DBI_AUTOPROXY'} and $driver ne 'Proxy' and $driver ne 'Sponge' and $driver ne 'Switch')
632 184 0 if ($dbi_autoproxy =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i)
634 6 178 $driver_attrib_spec ? :
0 184 $2 ? :
643 218 5175 if $ENV{'DBI_AUTOPROXY'}
646 0 5393 if ($old_driver) { }
647 0 0 if $attr
650 5393 0 ref $attr ? :
14 5379 $driver_attrib_spec ? :
660 0 5389 unless my $drh = $DBI::installed_drh{$driver} || $class->install_driver($driver)
664 3605 1784 if defined $$attr{'Username'}
665 3605 1784 if defined $$attr{'Password'}
667 1574 3815 unless (defined $user and defined $pass)
679 38 5331 unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr))
680 36 2 unless defined $user
681 0 38 unless defined $dsn
687 0 38 unless defined $errstr
691 38 0 unless ($$attr{'HandleError'} and $$attr{'HandleError'}($msg, $drh, $dbh))
692 14 24 if $$attr{'RaiseError'}
693 0 24 if $$attr{'PrintError'}
700 16 5315 $override_attr ? :
704 32 5299 if ($rebless_class)
706 24 8 if ($$apply{'RootClass'})
710 0 28 if (not @{"${rebless_class}::db::ISA";} && @{"${rebless_class}::st::ISA";}) { }
722 4751 576 if (%$apply)
724 0 4751 if ($$apply{'DbTypeSubclass'})
730 4846 14158 unless exists $$apply{$a}
735 0 22323 if $@
743 10 5317 if $DBI::dbi_debug & 15
750 5311 24 if $dbh
759 214 0 if ref $drh
777 8 218 if $driver =~ s/^DBI:(.*?)://i
779 0 226 unless $driver and @_ <= 3
783 8 218 if $drh = $DBI::installed_drh{$driver}
785 6 212 if $DBI::dbi_debug & 15
795 4 214 if ($@)
798 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/) { }
817 6 208 if ($DBI::dbi_debug & 15)
830 0 214 unless ($drh and ref $drh and not $@)
834 0 0 if $@ =~ /locate object method/
840 6 208 if $DBI::dbi_debug & 15
853 1206 276 unless UNIVERSAL::isa($h_class, "DBD::_::$h_type")
858 702 690 unless UNIVERSAL::isa("${h_class}_mem", $mem_class) or $DBI::PurePerl
884 56 0 if (@$sub_class_isa) { }
885 0 56 if $trace
889 0 0 unless @$sub_class_isa
890 0 0 if $trace
917 0 0 if ($DbTypeSubclass and $DbTypeSubclass ne '1' and ref $DbTypeSubclass ne 'CODE')
927 0 0 if ($driver eq 'Proxy')
929 0 0 unless ($driver) = $$dbh{'proxy_client'}{'application'} =~ /^DBI:(.+?):/i
934 0 0 if ($driver eq 'ODBC' or $driver eq 'ADO')
945 0 0 if $driver eq 'ODBC'
947 0 0 if $driver eq 'ADO'
949 0 0 unless $name
953 0 0 if ($_dbtype_name_map{$name}) { }
957 0 0 if ($name =~ /($_dbtype_name_regexp)/) { }
967 0 0 if $driver eq 'ADO'
971 0 0 if ref $DbTypeSubclass eq 'CODE'
981 20 4 if @{"${load_class}::ISA";}
985 0 4 unless $@
986 0 4 if $missing_ok and $@ =~ /^Can't locate \Q$module.pm\E/
1000 5288 0 if exists $dbd_class_registry{$driver}
1012 132 0 $haveFileSpec ? :
1014 96 36 unless -d $dbd_dir
1015 8 28 if $seen_dir{$d}
1019 0 28 unless opendir DIR, $dbd_dir
1021 112 196 unless $f =~ s/\.pm$//
1022 28 168 if $f eq 'NullP'
1023 96 72 if ($seen_dbd{$f}) { }
1024 0 96 unless $quiet
1035 8 4 wantarray ? :
1043 0 0 if $DBI::PurePerl and grep {-d "$_/auto/DBD/$driver";} @INC
1048 0 0 if $@
1053 0 0 if (wantarray)
1054 0 0 /^DBD::(\w+)/ ? :
1057 0 0 if $DBI::PurePerl
1058 0 0 unless (defined wantarray)
1081 4 124 unless defined $maxlen
1082 4 124 unless defined $sep
1089 0 4 unless $sth
1096 8 4 if $rows++ and $lsep
1100 0 4 $DBI::err ? :
1109 4 24 if $logical and not $diff
1113 12 12 if not $diff and $a_desc eq $b_desc
1115 8 4 if length $a
1117 12 0 if $diff
1127 16 44 unless (defined $a and defined $b)
1128 8 0 unless defined $a or defined $b
1130 0 8 unless defined $a
1132 8 0 unless defined $b
1138 0 44 unless defined &utf8::is_utf8
1140 0 44 utf8::is_utf8($a) ? :
1141 8 36 utf8::is_utf8($b) ? :
1144 60 12 if $a_chars[0] == $b_chars[0]
1146 0 24 chr($_) =~ /[[:cntrl:]]/ ? :
0 24 $_ > 255 ? :
1155 24 0 unless $c =~ /\\x\{08(..)}/
1160 4 28 if @b_chars
1161 4 24 if @a_chars
1172 0 72 unless defined &utf8::is_utf8
1173 0 72 unless defined &utf8::valid
1180 8 64 utf8::is_utf8($a) ? :
72 0 utf8::valid($a || '') ? :
1183 16 56 unless defined $a
1185 40 16 $is_ascii ? :
1193 0 0 unless ref $attr
1202 0 0 unless my $drh = $class->install_driver($dsn)
1204 0 0 unless $drh->connect($dsn, $dbuser, $dbpass)
1209 0 0 if $verb
1215 0 0 if $verb
1217 0 0 unless $_->disconnect
1265 3 215 if ($ENV{'DBI_PROFILE'} and not $DBI::PurePerl or $shared_profile)
1269 2 1 if (not $shared_profile) { }
1277 40 178 unless wantarray
1283 0 2280 unless my $imp_class = $$drh{'ImplementorClass'}
1296 0 6095 unless my $imp_class = $$dbh{'ImplementorClass'}
1321 0 4 if $drh
1329 0 4 unless $drh and $inner
1338 0 26 if $key eq 'DebugDispatch'
1339 0 26 if $key eq 'DebugLog'
1345 4 16 if ($key eq 'DebugDispatch') { }
0 16 elsif ($key eq 'DebugLog') { }
1388 0 532 unless $class =~ /^DBD::(\w+)::(dr|db|st)$/
1391 0 532 unless $method =~ /^([a-z]+_)\w+$/
1395 0 532 unless $reg_info
1402 272 260 unless $attr
1412 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)) { }
1424 8 0 ref $h ? :
8 0 if (@unknown and ref $h ? $h->FETCH('Warn') : 1)
1435 24 72 if $name eq 'SQL'
1436 14 58 if $name eq 'CON'
1437 14 44 if $name eq 'ENC'
1438 14 30 if $name eq 'DBD'
1439 14 16 if $name eq 'TXN'
1449 0 28 unless defined $info
1450 8 20 unless $$h{'ChildHandles'}
1451 368 16 unless $ch
1452 0 16 unless my $child_info = &$code($ch, $info)
1468 1574 4 unless defined $user
1469 1574 4 unless defined $pass
1495 0 3146 if ($DBI::dbi_debug & 15) >= 4
1499 3114 0 if ($dbh and $dbh->FETCH('Active') and eval { do { $dbh->ping } })
1501 2 3112 if ($cb and $cb = $$cb{'connect_cached.reused'})
1509 2 30 if ($cb and my $new_cb = $$cb{'connect_cached.new'})
1516 2 30 if ($cb and my $conn_cb = $$cb{'connect_cached.connected'})
1534 0 16 unless my $closure = $$old_dbh{'dbi_connect_closure'}
1537 8 8 unless ($attr)
1542 40 158 if ref $v and ref $v ne 'CODE'
1556 0 16 unless ($new_dbh)
1567 0 106 @id > 3 && ref $id[-1] ? :
1577 98 200 unless defined $_
1583 94 12 @id >= 3 ? :
1588 70 36 if ($catalog)
1589 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 1637 unless my $sth = $dbh->prepare($statement, $attr)
1631 1441 196 unless $sth->execute(@params)
1633 54 142 $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
1661 4 116 ref $stmt ? :
4 116 unless my $sth = ref $stmt ? $stmt : $dbh->prepare($stmt, $attr)
1663 0 116 unless $sth->execute(@bind)
1665 8 108 if (not $slice and $slice = $$attr{'Columns'})
1666 4 4 if (ref $slice eq 'ARRAY')
1672 0 116 if defined $MaxRows
1678 0 8 ref $stmt ? :
1679 0 8 unless $sth
1680 0 8 unless $sth->execute(@bind)
1686 0 8 ref $stmt ? :
1687 0 8 unless $sth
1688 0 8 unless $sth->execute(@bind)
1689 4 4 $$attr{'Columns'} ? :
1693 0 12 unless $sth->bind_col($_, \$values[$idx++])
1696 0 8 if (my $max = $$attr{'MaxRows'}) { }
1717 12 24 if ($sth)
1718 0 12 unless $sth->FETCH('Active')
1719 4 8 unless $if_active ||= 0
1721 8 4 if $if_active <= 1
1722 8 4 if $if_active <= 2
1726 28 0 if $sth
1735 8 4 $dbh->FETCH('Active') ? :
1740 0 4 unless $dbh->FETCH('AutoCommit')
1749 0 0 unless my $sth = $dbh->primary_key_info(@args)
1752 0 0 unless wantarray
1759 0 24 unless my $sth = $dbh->table_info(@args[0, 1, 2, 3, 4])
1760 0 24 unless my $tables = $sth->fetchall_arrayref
1762 12 12 if ($dbh->get_info(29)) { }
1768 16 0 if ($$_[1])
1771 0 16 $schema eq uc $schema ? :
1784 18 10 if ($tia) { }
1789 0 10 unless $temp and @$temp
1798 0 28 if $dt_idx and $dt_idx != 1
1803 0 28 ref $data_type ? :
1805 24 4 if (defined $data_type and $data_type != &DBI::SQL_ALL_TYPES()) { }
1811 28 0 if @ti
1819 0 28 if @ti and @{$ti[0];} != $idx_fields
1823 24 4 unless wantarray
1860 4 76 if defined $value_array and ref $value_array and ref $value_array ne 'ARRAY'
1863 4 76 unless DBI::looks_like_number($p_id)
1866 0 76 if $p_id <= 0
1880 0 76 if $attr
1897 0 116 if ($fields <= 0 and not $$sth{'Active'})
1904 12 104 if not defined $_[0] or ref $_[0] eq 'HASH'
1910 8 108 if @_ or $idx != $fields
1923 4 44 if $tuple_sts and ref $tuple_sts ne 'ARRAY'
1927 28 16 if (@array_of_arrays)
1929 4 24 if defined $NUM_OF_PARAMS and @array_of_arrays != $NUM_OF_PARAMS
1938 8 28 if ($fetch_tuple_sub = $$attr{'ArrayTupleFetch'}) { }
1940 0 8 if @array_of_arrays
1944 4 4 if (UNIVERSAL::isa($fetch_tuple_sub, 'DBI::st')) { }
0 4 elsif (not UNIVERSAL::isa($fetch_tuple_sub, 'CODE')) { }
1946 0 4 unless $$fetch_sth{'Active'}
1951 0 4 if defined $NUM_OF_FIELDS and defined $NUM_OF_PARAMS and $NUM_OF_FIELDS != $NUM_OF_PARAMS
1963 0 28 unless $$sth{'ParamArrays'}
1964 0 28 if defined $NUM_OF_PARAMS and $NUM_OF_PARAMS != $NUM_OF_PARAMS_given
1973 52 48 unless ref $ary eq 'ARRAY'
1974 36 12 if not $maxlen or @$ary > $maxlen
1977 4 24 unless defined $maxlen
1982 28 40 if $tuple_idx >= $maxlen
1985 72 88 ref $a ? :
1998 32 4 $tuple_status ? :
2003 56 4 if (my $rc = $sth->execute(@$tuple)) { }
2005 56 0 $rc >= 0 && $rc_total >= 0 ? :
2015 4 32 if $err_count
2018 28 4 unless wantarray
2029 4 820 if $max_rows and not $sth->FETCH('Active')
2034 788 32 if ($mode eq 'ARRAY')
2038 16 772 if ($slice and @$slice) { }
8 764 elsif (defined $max_rows) { }
2039 12 4 unless defined $max_rows
2054 12 20 if ($mode eq 'REF' and ref $$slice eq 'HASH') { }
16 4 elsif ($mode eq 'HASH') { }
2061 12 4 if (keys %$slice) { }
2066 4 16 unless defined $idx
2079 20 0 if (not defined $max_rows) { }
2094 8 88 ref $key_field ? :
2099 4 0 if not defined $index and DBI::looks_like_number($_) and $_ >= 1 and $_ <= $num_of_fields
2100 0 100 unless defined $index
2124 0 0 unless (ref $fh)
2125 0 0 unless open FH, ">$fh"