[Dbix-class] search vs. find

Brandon Black blblack at gmail.com
Wed Jun 6 23:38:02 GMT 2007


On 6/6/07, John Goulah <jgoulah at gmail.com> wrote:
>
> > > Anyway I found the
> > > answer myself, for anyone interested:
> > >
> > > From DBIx::Class::Manual::Cookbook
> > >
> (http://search.cpan.org/~mstrout/DBIx-Class-0.07000/lib/DBIx/Class/Manual/Cookbook.pod#Retrieving_a_row_object
> > > )
> > >  my $schema = $cd->result_source->schema;
> > >  my $artist_rs = $schema->resultset('Artist');
> >
> > I don't see how this has anything to do with your question, are you
> > sure it does what you think it does?  The snippet you posted is for
> > getting a $schema object from a row object.  Your question was how to
> > obtain a resultset object which represents a single row.
>
>
> Actually this gets the schema, and the resultset object out of that.  The
> object that comes out of this is the same object that is returned from
> search. The only reason I posted back is b/c I thought someone else may
> benefit from the fact that you can get this out of there if you need to for
> some reason, in my case, I'll just use search.
>
>

But it doesn't do what you think it does.  Those two lines of code get
you the resultset object for the entire "Artist" table, not for your
one row.

-- Brandon



More information about the Dbix-class mailing list