11-16-2019, 08:51 AM
Hi
I use a datamodule pool with my program. Each user can have a different db to look at. The usersession holds the path to that database,
Now i adjusted the Lock and Unlock :
And
However, once in every 4-6 months we have a customer showing me data from another customers db! Which is ofcourse not what i want.
After loggin out/in the users gets the correct database info.
It's all about the line
Which should work properly , if it choses someone else its usersession, this goes wrong.
Any idea what could go wrong ???
Eric
I use a datamodule pool with my program. Each user can have a different db to look at. The usersession holds the path to that database,
Now i adjusted the Lock and Unlock :
Code:
function LockDataModule: TDtmMain;
begin
Result := TDtmMain(TIWServerController(GServerController).Pool.Lock);
if Result.IBDatabase.Connected then
begin
if Result.IBTransaction.InTransaction then
Result.IBTransaction.Rollback;
Result.IBDatabase.Connected := False;
end;
Result.IBDatabase.DatabaseName := UserSession.DbPad;
Result.IBDatabase.Open;
end;
And
Code:
procedure UnlockDataModule(ADataModule: TDtmMain);
var
LTemp: TDataModule;
begin
LTemp := ADataModule;
if TDtmMain(LTemp).IBTransaction.InTransaction then
TDtmMain(LTemp).IBTransaction.Rollback;
TDtmMain(LTemp).IBDatabase.CloseDataSets;
TDtmMain(LTemp).IBDatabase.Close;
TDtmMain(ADataModule).IBDatabase.DatabaseName := '';
TIWServerController(GServerController).Pool.Unlock(LTemp);
end;
However, once in every 4-6 months we have a customer showing me data from another customers db! Which is ofcourse not what i want.
After loggin out/in the users gets the correct database info.
It's all about the line
Code:
Result.IBDatabase.DatabaseName := UserSession.DbPad;
Which should work properly , if it choses someone else its usersession, this goes wrong.
Any idea what could go wrong ???
Eric