[tmql-wg] Proposed new requirement: Paging of result sets

Robert Barta rho@bigpond.net.au
Sun, 06 Jul 2003 19:40:51 +1000

On Thu, Jul 03, 2003 at 06:30:18PM +0200, Lars Marius Garshol wrote:
> Based on this, what do people think of the following requirements:
>   "TMQL shall provide features for specifying the number of query
>   results returned by a query; similar to SQL's LIMIT feature."
>   "TMQL shall provide feature for paging of query results by providing
>   features that perform similar functions to SQL's LIMIT and OFFSET."


I would love to have a functionality doing this in the language. I
wonder whether this can be done more elegantly in the language than
with that heavy-handed LIMIT/OFFSET. So if the SQL part is omitted or

XQuery, btw, had already the concept of ordered list and uses XPath's
position() function to limit the range. It is probably debatable
whether this is elegant, but, hey, its XML anyway. :-)

If the language already has lists, then a simple

   function I_want_results (..., $lower as natural := 0, $nr as natural := 15) {
      return @results[$lower, $lower + $nr]

could do the job without hardcoding this into the language.