[Dbix-class] Resultset chaining

Benjamin Hitz hitz at genome.stanford.edu
Wed Oct 14 22:21:54 GMT 2009


Genius!  Thanks.   Sorry for the trivial question.

Ben

On Oct 14, 2009, at 2:01 PM, John Romkey wrote:

>
>
> On Wed, Oct 14, 2009 at 4:53 PM, Benjamin Hitz <hitz at genome.stanford.edu 
> > wrote:
>
>
> 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=DB::Mod->schema->resultset("Feature");  
> $r->search({gene_name=>"ACT1"});$r->all' ;
> |
> |
> | Ben
>
> That's because you're not chaining. $r->search({gene_name =>  
> "ACT1" }) does not change $r - it returns a new resultset. What you  
> want is
>
> my $r2 = $r->search({gene_name => "ACT1" });
> $r2->all;
>
> - john romkey
> http://www.romkey.com/
>
> _______________________________________________
> 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

--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO  
Consortium
Stanford University ** hitz at genome.stanford.edu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091014/508d787c/attachment.htm


More information about the DBIx-Class mailing list