Board index » off-topic » Using different DBs for different clients

Using different DBs for different clients


2005-07-16 04:13:58 AM
off-topic18
How can I make an app server access the data from different DBs depending on
the client?
For example, sometimes a user will need to use historical data form a
previous year's DB. How can I make the server use the historical data for
that user only?
The project is not started yet, so anything is still possible.
TIA,
Stephan
 
 

Re:Using different DBs for different clients

Stiphane wrote:
Quote
How can I make an app server access the data from different DBs
depending on the client?

For example, sometimes a user will need to use historical data form a
previous year's DB. How can I make the server use the historical data
for that user only?

The project is not started yet, so anything is still possible.

TIA,
Stephan
This answer also apply to you last post titled ClientDataset Params.
You can pass anything you want to the server with the
BeforeApplyUpdates, BeforeRowRequest, and BeforeGetRecords. I use them
to pass state around, or params that are not used by query on the other
side. To pass multiple params use a variant array. Here is an example
of a procedure I use on all 3 of those events.
procedure Tdm.SetUserSession(Sender: TObject;
var OwnerData: OleVariant);
begin
OwnerData := VarArrayOf([UserID,FSessionID]);
end;
Then on the provider you can use the same events to read the data back.
For instance I could access the UserID from the prior code with
OwnerData[0]. You can do anything you want in the Before* events. You
can change the providers source dataset or even datasets database. I
have even created dynamic CDSs and populated them. I tend to use the
OnDataRequest event for that though. Just set the return value to
cds.data and on the client do cds.data := provider.DataRequest(Input).
--------------
Joe Bain
www.iegsoftware.com
 

Re:Using different DBs for different clients

Works beautifully.
Thanks a ton Joe
"Joe Bain" < XXXX@XXXXX.COM ..c.o.m>wrote in message
Quote
Stiphane wrote:

>How can I make an app server access the data from different DBs
>depending on the client?
>
>For example, sometimes a user will need to use historical data form a
>previous year's DB. How can I make the server use the historical data
>for that user only?
>
>The project is not started yet, so anything is still possible.
>
>TIA,
>Stephan

This answer also apply to you last post titled ClientDataset Params.


You can pass anything you want to the server with the
BeforeApplyUpdates, BeforeRowRequest, and BeforeGetRecords. I use them
to pass state around, or params that are not used by query on the other
side. To pass multiple params use a variant array. Here is an example
of a procedure I use on all 3 of those events.

procedure Tdm.SetUserSession(Sender: TObject;
var OwnerData: OleVariant);
begin
OwnerData := VarArrayOf([UserID,FSessionID]);
end;


Then on the provider you can use the same events to read the data back.
For instance I could access the UserID from the prior code with
OwnerData[0]. You can do anything you want in the Before* events. You
can change the providers source dataset or even datasets database. I
have even created dynamic CDSs and populated them. I tend to use the
OnDataRequest event for that though. Just set the return value to
cds.data and on the client do cds.data := provider.DataRequest(Input).





--------------
Joe Bain
www.iegsoftware.com
 

{smallsort}