Subject | Re: [firebird-support] How to implement "fetch data on demand" at SQL level |
---|---|
Author | Helen Borrie |
Post date | 2004-12-19T23:39:11Z |
At 10:13 PM 19/12/2004 +0000, you wrote:
size of the buffer on the client side then the answer is No. Rows are
returned one by one from a one-way cursor, in response to a call to
isc_dsql_fetch. The client code is responsible for deciding how many rows
to return, by putting the call inside a loop. Many data access interfaces
encapsulate the required behaviour in their data access and data-aware
controls. IB Objects, for example, uses a very sophisticated system with
multiple cursors to make a scrollable dataset available to the application.
If you are asking whether there is some SQL language element to limit the
number of rows in the entire output set, then the answer is Yes. Use the
SELECT FIRST m SKIP n syntax with an ordered set to return m rows starting
at the nth row in the set. All of the rows following the (m + n)th row
will be discarded, i.e. they will be eliminated from the set that the
application can fetch from. Both the [FIRST n] and the [SKIP n] clauselets
are optional.
./hb
>Hi, AllIf you are asking whether there is some SQL language element to set the
>
> I have a 20 rows grid that I just want to implement "fetch data on
>demand" for it, that is I only want to fetch 20 rows data from server
>until the grid is scrolled, then fetch another 20 rows, so what should
>I do implement this purpose at SQL level (back end)?
size of the buffer on the client side then the answer is No. Rows are
returned one by one from a one-way cursor, in response to a call to
isc_dsql_fetch. The client code is responsible for deciding how many rows
to return, by putting the call inside a loop. Many data access interfaces
encapsulate the required behaviour in their data access and data-aware
controls. IB Objects, for example, uses a very sophisticated system with
multiple cursors to make a scrollable dataset available to the application.
If you are asking whether there is some SQL language element to limit the
number of rows in the entire output set, then the answer is Yes. Use the
SELECT FIRST m SKIP n syntax with an ordered set to return m rows starting
at the nth row in the set. All of the rows following the (m + n)th row
will be discarded, i.e. they will be eliminated from the set that the
application can fetch from. Both the [FIRST n] and the [SKIP n] clauselets
are optional.
./hb