Jukka Zitting wrote:
Hi,
On 8/17/07, Christoph Kiehl <[EMAIL PROTECTED]> wrote:
Thomas Mueller wrote:
That's a good idea! Implementations that can't support it efficiently
could then calculate the size only when required. What about
getTotalSize()?
Implementations should maybe even allowed to return -1 (as on
RangeIterator.getSize()) if they do not support this method ...
I don't like the -1 result. As long as it's allowed, an interoperable
client must always assume that an implementation may return -1 and
provide a workaround for such cases.
I don't like it either, but I have absolutely no idea what kind of systems there
are trying to implement the JCR API and if they are capable of providing a total
result size. Until now, without setLimit(), they weren't forced to return the
total size in RangeIterator.getSize() so I thought it might be necessary to
provide that option for other implementors because at least one off them seems
to need that -1 return value. But if it isn't necessary I would definitely like
to skip that option.
How is the total size question typically solved in cases where an
application pages through a large database result set? I recall
sometimes using a separate COUNT(*) query for that, but there may be
more efficient alternatives.
That's what Thomas suggested as well and I know of no other option.
Cheers,
Christoph