in reply to Field names of database table from DBI
The short answer is, no, there's not a cleaner, portable
way to get a list of field names without doing some kind of
select statement. If you don't mind sacrificing a little
portability, you can use a driver-specific way to do it.
For example, in DBD::mysql, you could do
Check your appropriate DBD::driver manpage for more specific details if you choose to go this route.my $sth = $dbh->prepare("LISTFIELDS $table"); $sth->execute; my $names_aref = $sth->{NAME};
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: Re: Field names of database table from DBI
by jettero (Monsignor) on Aug 01, 2000 at 16:08 UTC | |
by Anonymous Monk on Aug 02, 2000 at 02:01 UTC | |
by gregorovius (Friar) on Aug 09, 2000 at 06:36 UTC |
In Section
Seekers of Perl Wisdom