[Dbix-class] Complex query in custom resultsource file.
edwrb .
datecrepe at hotmail.com
Wed Feb 20 01:11:32 GMT 2008
Thanks Jon! I totally didn't even notice that.
I removed those brackets around the $rs, but I still seem to be getting thi=
s error:
Error: Can't locate object method "thumbnail"
When iterating through the resultset of a custom resultsource file, can you=
use
the columns as methods as you can with regular resultsource iterations?
Hope this makes sense.
Thanks again to Matt and Jonathon for their previous help on this thorny is=
sue.
Cheers,
-ed
> From: jon at jrock.us
> To: dbix-class at lists.scsys.co.uk
> Subject: Re: [Dbix-class] Complex query in custom resultsource file.
> Date: Tue, 12 Feb 2008 01:01:00 -0600
> =
> * On Tue, Feb 12 2008, edwrb . wrote:
> > Thanks Matt. That 'as' trick took care of the SQL parsing issue.
> >
> > On a related note, is there a best practice for iterating through the
> > result-set from these
> > custom resource files by chance? I thought something like the followin=
g would
> > work:
> >
> > my $rs =3D [ $schema->resultset( 'MainRecordQuery' )->search( {},
> > {
> > bind =3D> [ $category, 'Y', 'thumbnail', 'main']
> > }
> > ) ];
> >
> > while (my $data =3D $rs->next) {
> >
> > print $data->thumbnail . "\n";
> > }
> >
> > but it fails with the following error:
> >
> > 'Can't call method "next" on unblessed reference' (from the while loop)
> =
> Well yeah, you've made $rs an array. Omit the square brackets if you
> want a resultset instead of a reference to a list of row objects.
> =
> Regards,
> Jonathan Rockway
> =
> _______________________________________________
> 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.rawmod=
e.org
_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=3DTXT_TAGHM_Wave2_sharelife_0120=
08
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080220/538=
8a755/attachment.htm
More information about the DBIx-Class
mailing list