On Wed, Oct 16, 2002 at 03:10:14PM -0600, Brady Fausett wrote: > I recently was reading a posting regarding getting table names and then > retrieving colmn names from another post. I have been trying to make a > perl program that I have written (with DBI) to be more object oriented. > To be able to get column names would be a great help. I have the Perl DBI > book from OReilly, but it only makes a small mention of something that > seems to do this:
You don't mention why you need to retrieve the column names. Howevever, the fetchrow_hashref statement method returns a hash reference where the keys are the column names used in the select, the values their corresponding values for that row. The method provides for more readable code when manipulating the data, and could be used as a poor man's method for retrieving column names portably. Of course, the hash construction is naturally going to be slower than simply returning a list of values. I'm not aware of a single method for retrieving the column names of a given table, and only the column names (other than the table_info method you mention). Most databases have queries that you can use to retrieve table information, but that's not going to be very portable. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]