table_info not working, am I doing something wrong?
- From: "TonyV" <kingskippus@xxxxxxxxx>
- Date: 28 Feb 2007 11:06:54 -0800
Hey all,
I'm trying to write a simple Perl program to read and display the
schema of a database. I have a DBI->connect call that looks like
this:
my $dbh = DBI->connect("DBI:Oracle:".$dbservice, $dbuser, $dbpass) or
die "Cannot connect: ". DBI->errstr;
It works great, and I can run selects, inserts, and so on to my
heart's content. But my call to table_info is rather hosed up, and I
don't know if I'm doing something wrong or if it's a problem with my
Perl installation. The documentation of table_info is here:
http://search.cpan.org/~timb/DBI/DBI.pm#table_info
This code, for the most part, works:
my $sth = $dbh->table_info() or die "Could not fetch tables: " . DBI-
errstr;
I can iterate using fetchrow_array and get a list of my tables. But
let's say that I just want a list of views. According to the
documentation, something like this should do the trick:
my $sth = $dbh->table_info('%', '%', '%', 'VIEW') or die "Could not
fetch views: " . DBI->errstr;
But if I run that, nothing is returned. If I feed anything to it to
try to narrow down the table list, I get back bupkiss. For example, I
know there's a table in it called FOO. If I run this, the table
information isn't fetched:
my $sth = $dbh->table_info('%', '%', 'FOO', 'TABLE') or die "Could not
fetch views: " . DBI->errstr;
I found out that I can specify anything as the database catalog.
Here's the Oracle-specific documentation:
http://search.cpan.org/~pythian/DBD-Oracle-1.19/Oracle.pm#table_info()
But if I specify anything, or even nothing at all, for any of the
other parameters, I get back nothing.
Am I doing something wrong, or should I be investigating my Perl
installation? Or is there a better standard way to get database
schema information? Any help would be appreciated!
.
- Follow-Ups:
- Prev by Date: Re: Perl-Postgres connection: 'Commit' method not found in DBI. Advice?
- Next by Date: Re: table_info not working, am I doing something wrong?
- Previous by thread: Perl-Postgres connection: 'Commit' method not found in DBI. Advice?
- Next by thread: Re: table_info not working, am I doing something wrong?
- Index(es):
Relevant Pages
|
|