| 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
| |||||||||||||||||||||||||||||
| 53 | 44 | ▶ | my %h = ( exists $O->{$k} ) ? ( %$v, %{$O->{$k}} ) : %$v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 44 | $GetInfoReturnValues{$k} = \%h; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 4 | ▶ | while ( my ($k, $v) = each %$O ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 508 | ▶ | next if exists $A->{$k}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | my $ReturnType = $GetInfoReturnTypes{$InfoType}; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | ▶ | return sprintf '0x%08X', $Value if $ReturnType eq 'SQLUINTEGER bitmask'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | return sprintf '0x%08X', $Value if $ReturnType eq 'SQLINTEGER bitmask'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return '' unless exists $GetInfoReturnValues{$InfoType}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$ReturnType eq "SQLUINTEGER bitmask" or $ReturnType eq "SQLINTEGER bitmask"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | 0 | ▶ | return wantarray ? @a : join(' ', @a ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | else { | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return $h{$Value} ||'?'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$h{$Value} || '?'
MC/DC0%0/1
$h{$Value} || '?'
$h{$Value}
Truth table0%0/2
A
A= $h{$Value}
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 4 | 1; | |||||||||||||||||||||||||||