(1) Is there any suggestion to implement fetch-on-demand data (like clientdataset packetRecord)?
What i am testing out now is to use the "SELECT FIRST m SKIP" (Firebird) to return limited rows.
I hope this reply isn't too late, but I've had to implement the type of fetch on demand that you're talking about. As Danijel mentioned in his own reply, you don't want to store state on the server side, but you're going to have to store it somewhere; In this case, the client.
If you can work with data in terms of "pages", then all you have to do is have the client "tell" the server which "page" of data that it wants. A page represents a number of rows of data. If you specify the number of rows that makes up a page (lines per page (LPP)), you can easily calculate the OFFSET (PostgreSQL). I guess this would be SKIP in Firebird?
If I had a situation where I want my clients to fetch 20 rows of data at a time, and I wanted the data from the 5th page, I could do the following (Note: PostgreSQL syntax):
LPP := 20;
PageNo := 5
SQL := 'SELECT * FROM MyTable LIMIT %d OFFSET %d';
SQL := Format(SQL, [LPP, (LPP * (PageNo - 1))]);
I hope this helps.
Kevin