Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mixing of usersessions?
#1
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 :

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
Reply


Messages In This Thread
Mixing of usersessions? - by etwoss - 11-16-2019, 08:51 AM
RE: Mixing of usersessions? - by kudzu - 11-16-2019, 05:02 PM
RE: Mixing of usersessions? - by etwoss - 11-18-2019, 08:35 AM
RE: Mixing of usersessions? - by DanBarclay - 11-18-2019, 10:52 PM
RE: Mixing of usersessions? - by etwoss - 11-19-2019, 08:56 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)