blib/lib/DBI/Const/GetInfoReturn.pm

filter: Statementstmt 61.4% 35 / 57 Branchbran 33.3% 8 / 24 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 49.4% 49 / 99 CC 12 SCAR 38.5
CC
12
Cov
50%
Explain
90.0
Format
20.0
BEGIN
1.0
CRAP 47.2
« blib/lib/DBI/Gofer/Execute.pm ↑ Summary blib/lib/DBI.pm »
1 # $Id: GetInfoReturn.pm 8696 2007-01-24 23:12:38Z Tim $
2 #
3 # Copyright (c) 2002 Tim Bunce Ireland
4 #
5 # Constant data describing return values from the DBI getinfo function.
6 #
7 # You may distribute under the terms of either the GNU General Public
8 # License or the Artistic License, as specified in the Perl README file.
9  
10 package DBI::Const::GetInfoReturn;
11  
12 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 our @ISA = qw(Exporter);
18 4 our @EXPORT = qw(%GetInfoReturnTypes %GetInfoReturnValues);
19  
20 my
21 4 $VERSION = "2.008697";
22  
23 =head1 NAME
24  
25 DBI::Const::GetInfoReturn - Data and functions for describing GetInfo results
26  
27 =head1 SYNOPSIS
28  
29 The interface to this module is undocumented and liable to change.
30  
31 =head1 DESCRIPTION
32  
33 Data and functions for describing GetInfo results
34  
35 =cut
36  
37 4 ▶use DBI::Const::GetInfoType;
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 4 ▶use DBI::Const::GetInfo::ANSI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
40 4 ▶use DBI::Const::GetInfo::ODBC ();
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 4 our %GetInfoReturnTypes =
43 (
44 %DBI::Const::GetInfo::ANSI::ReturnTypes
45 , %DBI::Const::GetInfo::ODBC::ReturnTypes
46 );
47  
48 4 our %GetInfoReturnValues = ();
49 {
50 4 my $A = \%DBI::Const::GetInfo::ANSI::ReturnValues;
51 4 my $O = \%DBI::Const::GetInfo::ODBC::ReturnValues;
52 4 ▶ while ( my ($k, $v) = each %$A ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$A) 44 4 48
53 44 ▶ my %h = ( exists $O->{$k} ) ? ( %$v, %{$O->{$k}} ) : %$v;
Branch: 1 branch
BranchTrueFalseTotal
exists $O->{$k} ? : 28 16 44
54 44 $GetInfoReturnValues{$k} = \%h;
55 }
56 4 ▶ while ( my ($k, $v) = each %$O ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$O) 508 4 512
57 508 ▶ next if exists $A->{$k};
Branch: 1 branch
BranchTrueFalseTotal
if exists $A->{$k} 28 480 508
58 480 my %h = %$v;
59 480 $GetInfoReturnValues{$k} = \%h;
60 }
61 }
62  
63 # -----------------------------------------------------------------------------
64  
65 0 ▶sub Format {
Subroutine Format: not called CC=4 SCAR=30.0
Pod undocumented
66 0 my $InfoType = shift;
67 0 my $Value = shift;
68  
69 0 ▶ return '' unless defined $Value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Value 0 0 0
70  
71 0 my $ReturnType = $GetInfoReturnTypes{$InfoType};
72  
73 0 ▶ return sprintf '0x%08X', $Value if $ReturnType eq 'SQLUINTEGER bitmask';
Branch: 1 branch
BranchTrueFalseTotal
if $ReturnType eq "SQLUINTEGER bitmask" 0 0 0
74 0 ▶ return sprintf '0x%08X', $Value if $ReturnType eq 'SQLINTEGER bitmask';
Branch: 1 branch
BranchTrueFalseTotal
if $ReturnType eq "SQLINTEGER bitmask" 0 0 0
75 # return '"' . $Value . '"' if $ReturnType eq 'SQLCHAR';
76 0 return $Value;
77 }
78  
79  
80 0 ▶sub Explain {
Subroutine Explain: not called CC=9 SCAR=45.0
Pod undocumented
81 0 my $InfoType = shift;
82 0 my $Value = shift;
83  
84 0 ▶ return '' unless defined $Value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Value 0 0 0
85 0 ▶ return '' unless exists $GetInfoReturnValues{$InfoType};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $DBI::Const::GetInfoReturn::GetInfoReturnValues{$InfoType} 0 0 0
86  
87 0 $Value = int $Value;
88 0 my $ReturnType = $GetInfoReturnTypes{$InfoType};
89 0 my %h = reverse %{$GetInfoReturnValues{$InfoType}};
90  
91 0 ▶ if ( $ReturnType eq 'SQLUINTEGER bitmask'|| $ReturnType eq 'SQLINTEGER bitmask') {
Branch: 1 branch
BranchTrueFalseTotal
if ($ReturnType eq 'SQLUINTEGER bitmask' or $ReturnType eq 'SQLINTEGER bitmask') { } 0 0 0
Condition0%0/3
$ReturnType eq "SQLUINTEGER bitmask" or $ReturnType eq "SQLINTEGER bitmask"
l!l&&r!l&&!r
000
MC/DC0%0/2
$ReturnType eq "SQLUINTEGER bitmask" or $ReturnType eq "SQLINTEGER bitmask"
$ReturnType eq "SQLUINTEGER bitmask" $ReturnType eq "SQLINTEGER bitmask"
Truth table0%0/3
A or B
A= $ReturnType eq "SQLUINTEGER bitmask"B= $ReturnType eq "SQLINTEGER bitmask"
ABresult
1X1
011
000
92 0 my @a = ();
93 0 for my $k ( sort { $a <=> $b } keys %h ) {
94 0 ▶ push @a, $h{$k} if $Value & $k;
Branch: 1 branch
BranchTrueFalseTotal
if $Value & $k 0 0 0
95 }
96 0 ▶ return wantarray ? @a : join(' ', @a );
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
97 }
98 else {
99 0 ▶ return $h{$Value} ||'?';
Condition0%0/2
$h{$Value} || '?'
l!l
00
MC/DC0%0/1
$h{$Value} || '?'
$h{$Value}
Truth table0%0/2
A
A= $h{$Value}
Aresult
11
00
100 }
101 }
102  
103 4 1;
« blib/lib/DBI/Gofer/Execute.pm ↑ Summary blib/lib/DBI.pm »