[Dbix-class] Resultset chaining

John Romkey romkey at apocalypse.org
Wed Oct 14 21:01:42 GMT 2009


On Wed, Oct 14, 2009 at 4:53 PM, Benjamin Hitz <hitz at genome.stanford.edu>wr=
ote:

>
>
> On Oct 14, 2009, at 1:46 PM, Rob Kinyon wrote:
>
>  On Wed, Oct 14, 2009 at 16:39, Benjamin Hitz <hitz at genome.stanford.edu>
>> wrote:
>>
>>>
>>> I am having trouble chaining result sets; that is running ->search
>>> subsequently.
>>> So then I tried this:
>>>
>>
>> [snip] Neither will work because you aren't passing hashrefs.
>>
>>
| Oooh... nice catch but the second one succeeds; that is the correct SQL.
|
| And this still fails to add the where clause
|
| perl -I./ -MDB::Mod -e '$r=3DDB::Mod->schema->resultset("Feature");
$r->search({gene_name=3D>"ACT1"});$r->all' ;
|
|
| Ben
That's because you're not chaining. $r->search({gene_name =3D> "ACT1" }) do=
es
not change $r - it returns a new resultset. What you want is

my $r2 =3D $r->search({gene_name =3D> "ACT1" });
$r2->all;

- john romkey
http://www.romkey.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091014/f7b=
e665e/attachment-0001.htm


More information about the DBIx-Class mailing list