Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI assistance

Status
Not open for further replies.

pcorchary

MIS
Feb 23, 2002
60
US
(it shouldn't matter, but this is in relation to DBD:CSV)

I'm still very new to Perl, CGI and DBI - so don't assume that I know anything :)

Using DBI methods, is there a way to retrieve the column NAMES from a table? Further when I use bind_columns, is there a way to assign this with an array e.g.

@FIELD_NAMES=qw(name date city);

### open $dhb handle, etc.

my $sth->bind_columns(undef, @FIELD_NAMES)
or die "Bind column: ". $dbh->errstr();

$sth->excute() or die ..... etc.

can this be done? Better yet, can I SELECT the actual column names, parse them into an array in place of the =qw() above ...

Thanks in advance ...

 
In some databases you can use the describe feature, such as

$sql="DESCRIBE mytable";

where mytable can be any table in the current database.

HTH,
Barbie. Leader of Birmingham Perl Mongers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top