line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
4
|
|
3212
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
114
|
|
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
14
|
use Exporter (); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
62
|
|
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
|
12
|
use vars qw(@ISA @EXPORT @EXPORT_OK %GetInfoReturnTypes %GetInfoReturnValues); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
310
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
19
|
|
|
|
|
|
|
@EXPORT = qw(%GetInfoReturnTypes %GetInfoReturnValues); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my |
22
|
|
|
|
|
|
|
$VERSION = "2.008697"; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
DBI::Const::GetInfoReturn - Data and functions for describing GetInfo results |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The interface to this module is undocumented and liable to change. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Data and functions for describing GetInfo results |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
4
|
|
18
|
use DBI::Const::GetInfoType; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
288
|
|
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
4
|
|
20
|
use DBI::Const::GetInfo::ANSI (); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
42
|
|
41
|
4
|
|
|
4
|
|
10
|
use DBI::Const::GetInfo::ODBC (); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
1249
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
%GetInfoReturnTypes = |
44
|
|
|
|
|
|
|
( |
45
|
|
|
|
|
|
|
%DBI::Const::GetInfo::ANSI::ReturnTypes |
46
|
|
|
|
|
|
|
, %DBI::Const::GetInfo::ODBC::ReturnTypes |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
%GetInfoReturnValues = (); |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
my $A = \%DBI::Const::GetInfo::ANSI::ReturnValues; |
52
|
|
|
|
|
|
|
my $O = \%DBI::Const::GetInfo::ODBC::ReturnValues; |
53
|
|
|
|
|
|
|
while ( my ($k, $v) = each %$A ) { |
54
|
|
|
|
|
|
|
my %h = ( exists $O->{$k} ) ? ( %$v, %{$O->{$k}} ) : %$v; |
55
|
|
|
|
|
|
|
$GetInfoReturnValues{$k} = \%h; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
while ( my ($k, $v) = each %$O ) { |
58
|
|
|
|
|
|
|
next if exists $A->{$k}; |
59
|
|
|
|
|
|
|
my %h = %$v; |
60
|
|
|
|
|
|
|
$GetInfoReturnValues{$k} = \%h; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub Format { |
67
|
0
|
|
|
0
|
0
|
|
my $InfoType = shift; |
68
|
0
|
|
|
|
|
|
my $Value = shift; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
return '' unless defined $Value; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $ReturnType = $GetInfoReturnTypes{$InfoType}; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
return sprintf '0x%08X', $Value if $ReturnType eq 'SQLUINTEGER bitmask'; |
75
|
0
|
0
|
|
|
|
|
return sprintf '0x%08X', $Value if $ReturnType eq 'SQLINTEGER bitmask'; |
76
|
|
|
|
|
|
|
# return '"' . $Value . '"' if $ReturnType eq 'SQLCHAR'; |
77
|
0
|
|
|
|
|
|
return $Value; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub Explain { |
82
|
0
|
|
|
0
|
0
|
|
my $InfoType = shift; |
83
|
0
|
|
|
|
|
|
my $Value = shift; |
84
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
return '' unless defined $Value; |
86
|
0
|
0
|
|
|
|
|
return '' unless exists $GetInfoReturnValues{$InfoType}; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$Value = int $Value; |
89
|
0
|
|
|
|
|
|
my $ReturnType = $GetInfoReturnTypes{$InfoType}; |
90
|
0
|
|
|
|
|
|
my %h = reverse %{$GetInfoReturnValues{$InfoType}}; |
|
0
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
0
|
0
|
0
|
|
|
|
if ( $ReturnType eq 'SQLUINTEGER bitmask'|| $ReturnType eq 'SQLINTEGER bitmask') { |
93
|
0
|
|
|
|
|
|
my @a = (); |
94
|
0
|
|
|
|
|
|
for my $k ( sort { $a <=> $b } keys %h ) { |
|
0
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
push @a, $h{$k} if $Value & $k; |
96
|
|
|
|
|
|
|
} |
97
|
0
|
0
|
|
|
|
|
return wantarray ? @a : join(' ', @a ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else { |
100
|
0
|
|
0
|
|
|
|
return $h{$Value} ||'?'; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |