Tim Bunce wrote:
[...]On Mon, Nov 08, 2004 at 10:14:52AM +0100, Steffen Goeldner wrote:
Attached is a small patch for DBI::DBD::Metadata. $VERSION is a lexical (why?), thus I dropped the package names. I added a special handler for the SQL_DRIVER_NAME case, because the file name of the ODBC library isn't what we want here.
Thanks. The $VERSION probably shouldn't be lexical.
O.k., attached is a revised patch with a global $VERSION.
I prepared another patch for write_typeinfo_pm. I think it's legitimate for an ODBC driver to return the column names of the SQLGetTypeInfo result set in lower case if it returns SQL_IDENTIFIER_CASE = SQL_IC_LOWER from SQLGetInfo.
Steffen
--- Metadata.orig Sun Feb 01 11:16:26 2004
+++ Metadata.pm Wed Nov 10 19:52:24 2004
@@ -18,11 +18,10 @@
@ISA = qw(Exporter);
@EXPORT = qw(write_getinfo_pm write_typeinfo_pm);
-use strict;
-
-my
$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/);
+use strict;
+
=head1 NAME
DBI::DBD::Metadata - Generate the code and data for some DBI metadata methods
@@ -186,6 +185,9 @@
elsif ($key eq 'SQL_KEYWORDS') {
$val = ($kw_map) ? '\&sql_keywords' : 'undef';
}
+ elsif ($key eq 'SQL_DRIVER_NAME') {
+ $val = "\$INC{'DBD/$driver.pm'}";
+ }
elsif ($key eq 'SQL_DRIVER_VER') {
$val = '$sql_driver_ver';
}
@@ -484,7 +486,7 @@
Jonathan Leffler <[EMAIL PROTECTED]> (previously <[EMAIL PROTECTED]>),
Jochen Wiedmann <[EMAIL PROTECTED]>,
-Steffen Goeldner <[EMAIL PROTECTED]>,
+Steffen Goeldner <[EMAIL PROTECTED]>,
and Tim Bunce <[EMAIL PROTECTED]>.
=cut
--- Metadata.002 Wed Nov 10 19:52:24 2004
+++ Metadata.pm Wed Nov 10 21:26:55 2004
@@ -342,7 +342,7 @@
require DynaLoader;
[EMAIL PROTECTED] = qw(Exporter DynaLoader);
[EMAIL PROTECTED] = qw(type_info_all);
- use DBI (:sql_types);
+ use DBI qw(:sql_types);
PERL
@@ -411,7 +411,7 @@
my $h = $dbh->type_info_all;
my @tia = @$h;
- my %odbc_map = %{$tia[0]};
+ my %odbc_map = map { uc $_ => $tia[0]->{$_} } keys %{$tia[0]};
shift @tia; # Remove the mapping reference.
my $numtyp = $#tia;
