[Dbix-class] DBIx::Class - Trying to get column names from a $rs or $row

Howe, Tom (IT) Tom.Howe at MorganStanley.com
Tue Oct 14 19:59:44 BST 2008


Hi, first post here

I have a question regarding  getting column names from a DBIx ::Class $resultset or $row.

I have a DBIx::Class resultset which I'll call $rset

I need to get the column names of the resultset in the correct order.

I was advised  by a coleague  to use $rset->result_source->columns;

This have me the column names of the table that was the original source of the resultset which initially worked ok.

However, now that I am doing some selects on the table the resultset only contains a subset of the table columns

I tried doing

my $row = $rset->first;
%row = $row->get_columns;
my @cols = keys %row;

But now I dont have them in the correct order.

Is there anyway to get an (ordered)  list of the column names from the $resultset or the $row

Thanks

Tom
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20081014/c1c90728/attachment-0001.htm


More information about the DBIx-Class mailing list