Hello all:

I hope I am sending this to the correct recipients.  With the recent release
of DBD-DB2-0.76, I finally got tired of waiting for support of the
type_info_all
command.  To help move things along I offer the following hack. I wrote a
simple 
CLI program that produces a hard-coded type_info_all() subroutine.  Source
for this
CLI and its makefile are attached (it's a quickly butchered IBM sample
file).

By adding the output of this program (type_info_all.pl attached) to the 
DBD::DB2::db package of the DBD::DB2.pm file, I was able to get the
following methods 
to work correctly: 

     $dbh->type_info_all(), 
     $dbh->type_info, and 
     $dbh->$quote($value, $data_type)

It's true this is a bit of a kludge.  A better solution might be to call the
CLI 
SQLGetTypeInfo command at connect time and cache up the results someplace.
Then 
type_info_all could be written to return the cache. The problem with my
approach is 
that it may not work correctly for all versions of DB2 (I've only tried this
V6.1 and 
V7.2). My approach is not without precedence, though, as other DBD
implementations do 
similar things (specifically, the DBD::Oracle.pm from which I stole the
template for
this code).  

The bottom line is that I needed $dbh->$quote($value, $data_type) to work
and this
was the shortest path to get.  I'd really like prefer that the DBD::DB2.pm
module
support type_info out of the box in future releases.  In the mean time, I'm
hacking 
my installation.

Thanks,

Stephen Keller

Attachment: makefile
Description: Binary data

Attachment: getSqlTypeInfo.c
Description: Binary data

Attachment: type_info_all.pl
Description: Binary data

Reply via email to