[Dbix-class] What should DBIC objects stringify to?

Justin Guenther jguenther at gmail.com
Thu May 4 00:00:06 CEST 2006


> -----Original Message-----
> From: dbix-class-bounces at lists.rawmode.org 
> [mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of 
> John Napiorkowski
> Sent: May 3, 2006 2:48 PM
> To: dbix-class at lists.rawmode.org
> Subject: Re: [Dbix-class] What should DBIC objects stringify to?
> 
> Yes this should work but ->find implictly calls ->all 
> afterward I believe, which returns an array of objects 
> instead of a resultset, which might not be what you are looking for.

You're thinking of search(), which returns a ResultSet in scalar context and
a list of objects in list context. The find() method will only ever return
one object, as find() takes primary key(s)/UNIQUE-constrained columns as
parameters. So you'll never get a ResultSet back from a find() operation.


   Justin


> --john
>
> --- phaylon <phaylon at dunkelheit.at> wrote:
> 
> > Alan Humphrey said:
> > >
> > > Ah.  Thanks for setting me straight.  And, in
> > terms of the original query
> > >
> > > ->find( {pk1 => 'someval', pk2 => 'someotherval'})
> > >
> > > should work for finding a row with a multi-part
> > key.  Yes?
> > 
> > Haven't used that one in a while, but the docs seem to say you're 
> > right :)
> > 
> > 
> > p
> > 
> > 
> > _______________________________________________
> > List:
> >
> http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> > Wiki: http://dbix-class.shadowcatsystems.co.uk/
> > IRC: irc.perl.org#dbix-class
> > SVN:
> >
> http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/




More information about the Dbix-class mailing list