Re: [Dbix-class] select specific columns on resultset

2013-04-11 Thread Jess Robinson
Can you show us the complete piece of code for the search/output, and the class definitions? That trace looks like you first asked for "Id" only, and then later did another query, or called a relation method on the result . This code: my @recs=$self->db->resultset($self->table)->search({

Re: [Dbix-class] select specific columns on resultset

2013-04-10 Thread max
Ok, sorry, I copied the wrong example, I tried with: my @recs=$self->db->resultset($self->table)->search({},{columns => [qw/ id /],},)->all; but I can see the Name column for example in the foreach loop. After some debugging on mysql I found some stranges: 67 Query SELECT me.id FROM ReportTe

Re: [Dbix-class] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 03:58:53PM +0200, max wrote: > 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=$row->id; > my $name=$row->Name; > print MYFILE "recs name: $name, id: $id\n\n"; > } > > and

Re: [Dbix-class] select specific columns on resultset

2013-04-09 Thread max
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=$row->id; my $name=$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

Re: [Dbix-class] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 03:19:07PM +0200, max wrote: > I'm new to DBIx, It is DBIx::Class (or DBIC for short). There are hundreds of unrelated modules in the DBIx:: namespace. Cheers ___ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-cl

Re: [Dbix-class] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
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=$self->db->resultset($self->table)->search({},{columns => [qw/ id > Name OperationId Name /],},)->all; > The above looks correct >