[Dbix-class] Constructing a resultset()->search() with variable number of ORs?

Chris Cole chris at compbio.dundee.ac.uk
Tue Oct 27 14:09:31 GMT 2009


On Tue, 2009-10-27 at 13:40 +0100, Moritz Onken wrote:
> Am 26.10.2009 um 17:36 schrieb Chris Cole:
> >
> > I've gotten this far:
> > my @ors;
> > foreach my $data (qw/data1 data2/) {
> >   push @ors, { name => $data, abundance => { '>' => $abund } };
> > }
> > my @rows = $schema->resultset('Reads2expt')->search(
> >   @ors,
> >   {
> >      join => [qw/ read_id expt_id /],
> >      order_by => 'me.read_id',
> >      group_by => 'me.read_id',
> >      prefetch => 'read_id',
> >      cache => 1
> >   }
> > );
> 
> The first parameter needs to be an array ref:
> 
> > $schema->resultset('Reads2expt')->search(
> >   \@ors,
> >   {
> >      join => [qw/ read_id expt_id /],
> >      order_by => 'me.read_id',
> >      group_by => 'me.read_id',
> >      prefetch => 'read_id',
> >      cache => 1
> >   }
> > );

Ah, perfect. I knew it had to be something simple.
Thanks for your help.




More information about the DBIx-Class mailing list