I'm having a little trouble using the DBI functions table_info(),
column_info(), and primary_key_info() functions which I've never tried
using before now. I'm not certain what sort of values I should specify
as arguments. For table_info(), it returns a valid statement handle
from which I can 'fetch' the records, but it fetches records for every
table in the database REGARDLESS of what my arguments are. I guess
DBD::Informix doesn't support the filters (as suggested in the DBI
documentation). I can live with that. But for column_info() and
primary_key_info(), I have NEVER been successful at getting a valid
(defined) statement handle back from the function call REGARDLESS of
what my arguments are.
Can someone provide sample code or otherwise explain what I am doing
wrong? Here is the pertinent code I have...
use DBI;
use strict;
my $dbh ->connect( ... );
my $sth = $dbh->primary_key_info('%','oper','crest'); # this returns
undef regardless of what my arguments are...
my $data = $sth->fetchall_arrayref; # error: $sth is null (not
defined)...
Any ideas?
Mark
↪ replying to Mark J Fenbers
Ah. I found in this document
http://search.cpan.org/~johnl/DBD-Informix-2003.04/lib/DBD/Informix/Summary.pm
where these functions are not implemented. :((
This is unforntunate because our agency uses 3 different databases, and
making this app portable among all three will be very difficult at best.
But it does say that "The keys/indexes of a table be fetched by querying on
the system catalog.", but it gives no further details. What is the logical
way to determine the primary keys of a given table using a system catalog?
(I'm not sure I even understand what a system catalog is...)
Mark