[Dbix-class] Return column values not objects?
Oleg Kostyuk
cub.uanic at gmail.com
Tue Oct 5 10:43:09 GMT 2010
I think DBIx::Class::ResultClass::HashRefInflator also could be useful:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/ResultClass/HashRefInflator.pm
2010/10/5 Jason Galea <lists at eightdegrees.com.au>:
> On Tue, Oct 5, 2010 at 12:58 PM, <seasprocket at gmail.com> wrote:
>> The docs appear to say that DBIx can return column values (rather than
>> objects), but I can't get it to work. Have tried "select" attribute and also
>> "columns" attribute. In both cases, it inflates to objects. I have a simple
>> (left) join of two tables and want to retrieve all the id's of the "foo"
>> table.
>> $rs = $self->schema->resultset('My:Bar');
>> my @foo_ids = $rs->search(
>> {
>> bar => $bar->id,
>> },
>> {
>> join => 'foo',
>> select => [qw/foo.id/],
>> }
>> );
>
> I think you want the get_column method..
>
> my @foo_ids = $rs->search(
> {
> bar => $bar->id,
> },
> {
> join => 'foo',
> select => [qw/foo.id/],
> }
> )->get_column('foo.id');
>
> cheers,
>
> J
>
>> Sorry for this newbie question, but just can't get it to work.
>> Thanks!
>>
>>
>> --
>> Bikewise: http://www.bikewise.org
>>
>>
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Jason Galea
> Web Developer
>
> Ph 07 40556926
> Mob 04 12345 534
> www.eightdegrees.com.au
>
> _______________________________________________
> 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
>
--
Sincerely yours,
Oleg Kostyuk (CUB-UANIC)
More information about the DBIx-Class
mailing list