[Dbix-class] Ok, let's begin

Matt S Trout dbix-class at trout.me.uk
Tue Sep 20 22:55:42 CEST 2005


On Tue, Sep 20, 2005 at 11:45:11PM +0200, Krzysztof Krzyzaniak wrote:
> Bill Moseley wrote:
> >On Tue, Sep 20, 2005 at 11:08:32PM +0200, Krzysztof Krzyzaniak wrote:
> >
> >>>$rs->next will return an object
> >>>$rs->all will return all objects in the resultset
> >>>$rs->reset does what you expect
> >>>$rs->count will count rows (via COUNT(*) without fetching data)
> >>>$rs->delete deletes all records in the resultset
> >>
> >>
> >>[% WHILE (record = records.next) %]
> >>
> >>... do the Bartman
> >>
> >>[% END %]
> >
> >
> >Is there much advantage of doing the above vs. this when the record
> >set isn't too large (e.g. when displaying a page of items)?
> >
> >    $c->stash->{records} = [ $rs->all ];
> 
> I think this should have advantage when results are cached. When results 
> are not
> cached it probably doesn't matter. But this demand some tests.

The advantage of $rs->next is it does the $sth->fetchrow at the time, so
you aren't pulling data until you need it. The distadvantage is that doing
it this way is a little less efficient than ->all in terms of DBI and perl
time.

There's no caching at all so far; I was thinking about something along the
lines of the Sweet object cache, but it's not really my area.

Siracusa? Given you're current maintainer of the speed demon among the perl
ORMs, do you have any suggestions?

Anybody else?

-- 
     Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list