Re: DBI::st=HASH(0x88f6520)
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 31 Aug 2006 10:06:25 -0700
lnatz wrote:
Hello,
I wrote a perl script that would return the table names in a sybase
database and the column names in a specific table specified. The
following is an excerpt from my script.
sub metadata {
my @table_names = $DBH->tables();
print "Table: \n";
print map {"$_.\n"} @table_names;
print "\n";
my $sth = $DBH->column_info(undef, undef, $table_name,undef);
foreach my $column ($sth) {
print "Column: $column \n";
}
$sth->finish;
}
It outputs the names of the tables in the database correctly, but I am
having a problem with the column names. For the printing of the column
names, the script outputs the following one line:
Column: DBI::st=HASH(0x88f6520)
If anyone can give me an explanation for this problem I would greatly
appreciate it.
The docs say that column_info returns an "active statement handler".
For any other statement handler, you have to go through the process of
fetching rows from it. Indeed, your output tells you that $sth is an
object, a member of the DBI::st class. I would suggest either trying
to use one of the fetchrow_* methods like you would for any other
handler, or at the very least dereferencing the object to see what's in
the hash. Either way, trying to use it like an array as you did in
your foreach loop clearly makes no sense.
Paul Lalli
.
- References:
- DBI::st=HASH(0x88f6520)
- From: lnatz
- DBI::st=HASH(0x88f6520)
- Prev by Date: Re: File locking issue
- Next by Date: RE: Totally lost - need a starting point
- Previous by thread: DBI::st=HASH(0x88f6520)
- Next by thread: what is wrong with my script
- Index(es):
Relevant Pages
|