[Dbix-class] Problem getting data from resultset

Rob Kinyon rob.kinyon at gmail.com
Thu Jul 5 18:00:04 GMT 2012


You will need to have a separate list of columns that you feed to both
the resultset and the thing that consumes the resultset. At that
point, you can write a generic consumer of resultsets.

On Thu, Jul 5, 2012 at 10:53 AM, Kenneth S Mclane <ksmclane at us.ibm.com> wrote:
> Yes, I can get the data that way, but I have to specify each column by name
> that way and I am trying to get this to be a bit more re-usable. I need to
> be able to use this on many different pages, supplying a function that
> doesn't need to be embedded and custom hard coded for each query. I am
> looking to be able to first, grab the names of the columns so I can write
> the header row, then write the data, save the file and offer it up to the
> browser to be saved. I can't find a way to get a list of the field names
> from the result set, that would work as I could then store them in vars and
> then loop through using the column names to get the values for each cell.
>
> Rob Kinyon <rob.kinyon at gmail.com> wrote on 07/05/2012 12:35:42 PM:
>
>> From:
>>
>> Rob Kinyon <rob.kinyon at gmail.com>
>>
>> To:
>>
>> "DBIx::Class user and developer list" <dbix-class at lists.scsys.co.uk>
>>
>> Date:
>>
>> 07/05/2012 12:39 PM
>>
>> Subject:
>>
>> Re: [Dbix-class] Problem getting data from resultset
>>
>> On Thu, Jul 5, 2012 at 10:21 AM, Kenneth S Mclane <ksmclane at us.ibm.com>
>> wrote:
>> > Well, I cannot seem to get anything out of the resulset, so I'm grasping
>> > at
>> > whatever I can find. Perhaps you have something constructive to add?
>>
>> How are you trying to get stuff out of the resultset? Have you tried:
>> foreach my $row ( $rs->all ) {
>>     # Do something with $row->col1, $row->col2, etc
>> }
>>
>> Rob
>>
>> _______________________________________________
>> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>
>> IRC: irc.perl.org#dbix-class
>> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>> Searchable Archive:
>> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk



-- 
Thanks,
Rob Kinyon



More information about the DBIx-Class mailing list