Jump to content
Wagner Landgraf

TDataset with non-contiguos fetch-on-demand

Recommended Posts

I wonder if it's possible to have a TDataset that performs fetch-on-demand, but fetching non-contiguous records?

For example, when view data in a TDBGrid, user could use TDataset.Last and only the last records would be fetched. In this way the first and last records are fetched, but not the intermediate ones.

I'm not talking about the mechanism for fetching the data itself, but the dataset structure.

 

1. Does it support such mechanism?

2. Have anyone tried it, or implemented it? 

3. Do you have any idea on how complex it is?

 

Current my dataset does paged fetching, but when user uses TDataset.Last, it fetches moves the dataset forward fetching all records just to get to the last one.

Share this post


Link to post

Hi!

 

My guess is that the problem here is that you are trying to force the dataset to do something it wasn't designed for. 

What you could do is to put a restriction that your users should *also* be using the TMS stuff for record streaming, then you could add some methods such that the server does this and transmits the data to your dataset. 

Alternatively, you could create a separate query requesting MAX(ID) and using the exact same where and order by and then another one doing a select where the ID is the MAX(ID) you got and finally add this to your current dataset's data. 

Either way you end up with a mess to maintain though :) 

Share this post


Link to post
11 hours ago, Uwe Raabe said:

AFAIK, TFDTable does something like that when used in Live Data Window Mode, but the implementation seems to be pretty complicated.

Thank you. It looks indeed complex, and unfortunately mixed all the way through the whole FireDac source code. But part of complexity is the data retrieval mechanism, which I already have.

Share this post


Link to post
6 hours ago, Andrea Raimondi said:

Hi!

 

My guess is that the problem here is that you are trying to force the dataset to do something it wasn't designed for. 

What you could do is to put a restriction that your users should *also* be using the TMS stuff for record streaming, then you could add some methods such that the server does this and transmits the data to your dataset. 

Alternatively, you could create a separate query requesting MAX(ID) and using the exact same where and order by and then another one doing a select where the ID is the MAX(ID) you got and finally add this to your current dataset's data. 

Either way you end up with a mess to maintain though 🙂

Retrieving data is not my issue. Data will come via Aurelius so it already has a paging mechanism where I can retrieve any page of data.

My issue is how to make the dataset work with this (the internal buffer mechanism, filtering, etc.).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×