Search code examples
delphin-tier-architecturedatasnap

Dynamically filtering clientdataset content


I'm asking myself a question about the way to filter content of a clientdataset in a 3 tier datasnap architecture : Oracle DB <=> My Datasnap Server <=> My Datasnap clients

I have a Oracle table accessed thru a TDSProviderConnection and a TClientDataset.

Multiple clients are using the dataset, which contains a field named "clientId". I would like each client to request only his rows (just like WHERE clientId = 'Client1' in a sql statement).

If I understant right, use of filter doesn't not reduce overhead.

myclientdataset.Filter:= 'ClientId = Client1';
myclientdataset.Filtered:= true;

As this pass all the client anyway. I want the server to filter what's sent.

But I have no idea how to accomplish this using these components.

Any idea would be greatly appreciated.

Regards, JP


Solution

  • Sounds like a task for a parametrized query as described in this etutorial. As each client sets its own parameter only the requested data is transferred to each client.