Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Column names

Quote Reply
Column names
Hi,

I'm trying to find a way to read the column names from a table into a list - so that I can input the name of any table and a list of the columns is returned. Any ideas?

Thanks,

Laura.
The UK High Street
Quote Reply
Re: [afinlr] Column names In reply to
Code:
$DB->table('table_name')->{schema}->{cols}

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Column names In reply to
Thanks a lot Ivan - I knew it would be a simple command, I just couldn't find it.
Quote Reply
Re: [afinlr] Column names In reply to
This may be useful to you:

Code:
require GT::Dumper;

print $IN->header();
print GT::Dumper::Dumper($DB->table('Links'));

...that will show you everything the table object contains. You can substitute "Links" for any table.
Quote Reply
Re: [yogi] Column names In reply to
Quote:
$DB->table('table_name')->{schema}->{cols}
or
$DB->table('table_name')->cols

It returns a hashref.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Paul] Column names In reply to
Very useful. Thanks Paul.