db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: How to get specified number of entries?
Date Wed, 19 Mar 2003 12:38:38 GMT
On 19/03/2003 11:19 PM, "Dan Allen" <dan@mojavelinux.com> wrote:

> I would really like to branch off a very key idea relating to this
> intial question.  I am running a site with a directory that you can
> browse.  Right now, I just select all records an allow the jsptags
> pager library cut out the needed portion.  However, I fear that if
> we go to a larger membership, this will start to slow things down.
> From an OOD perspective, is it right to limit the query in the view
> or the business layer?  An if limit is only supported on a select
> number of databases, it seems like the wrong way to go.  At the same
> time, I would rather not have the jsp developer worrying if I am
> giving him/her a result set or just a Collection of model items.
> Am I to assume that the large select support handles all this in the
> background so that even though it looks like you are passing a full
> collection to the view, underneath it is only retrieving and dumping
> the data into the model object as needed?

Your assumption is correct, but there is no need to assume as you can look
at the source.  LargeSelect allows you to specify the number of records you
want to appear on each page and the number of pages of records to cache.
You store the LargeSelect instance in User.Temp for use on subsequent pages.
Only when the user pages off the cached data will the database be hit.  As
far as displaying the number of available records, LargeSelect provides an
indication of the number of records available up to the cache limit - e.g.
If the cache limit is 200 records, LargeSelect will attempt to retrieve 201
records and will report that "> 200" records exist if this is the case.

In terms of native database support for limit and offset, the database will
be used when they are supported and Village will provide this functionality
when it is not (although somewhat less efficiently).

Does this get you nearer to the answer you desire?

Scott Eade
Backstage Technologies Pty. Ltd.
.Mac Chat/AIM: seade at mac dot com

View raw message