[Dbix-class] select specific columns on resultset

max maxti83 at gmail.com
Tue Apr 9 13:58:53 GMT 2013


Thanks for the answer, this piece of code is inside a perl sub, I tried to
extract the array elements as:

foreach my $row (@recs)
{
my $id=3D$row->id;
my $name=3D$row->Name;
print MYFILE "recs name: $name, id: $id\n\n";
}

and I can see the Name element for example. I tried to insert the DBIC_TRACE
in the sub ouputting it to a file but it's always empty (
$self->db->storage->debugfh(IO::File->new('file','w'));), is there another
way to use it ?

2013/4/9 Peter Rabbitson <rabbit+dbic at rabbit.us>

> On Tue, Apr 09, 2013 at 03:19:07PM +0200, max wrote:
> > Hi all,
> > I'm new to DBIx, I'm trying to retrieve only a subset of columns from a
> > result set:
> >
> > my @recs=3D$self->db->resultset($self->table)->search({},{columns =3D> =
[qw/
> id
> > Name OperationId Name /],},)->all;
> >
>
> The above looks correct
>
> > but the result contains all the columns,
>
> How did you determine this?
>
> Also what does the DBIC_TRACE=3D1 look like?
>
> Cheers
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130409/1ac=
64289/attachment-0001.htm


More information about the DBIx-Class mailing list