Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 13 of 13 total
Thread Solution needed...
Wed, Aug 26 2009 11:58 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>He's not transferring the session information directly, he's using a medium
>of exchange (registry, .ini) that allows to different sessions to read and
>use the same configuration information. The "read and use" part depends
>upon your application, but the EDB Manager is a good example of how to do it
>with an .ini file.

I was reading

<<1. A Mail-Client (appA) is running (local access to EDB).
2. Another application (appB) needs the account-data from the
mail-client in order to import them into his database.>>

to mean two different databases with different configs etc so two different sessions being accessed simultaneously. I was more interested in this than where he was getting the session info from.

Roy Lambert
Wed, Aug 26 2009 12:28 PMPermanent Link

Uli Becker
Roy,

Here the code I am using to setup the second session:

procedure TOptionenForm.ImportAccount;
var
  ...
begin
  MyReg := TRegistry.create;
  try
    MyReg.openKey('Software\Becker\Easymail3', false);
    EasymailConfigPath := MyReg.ReadString('ConfigPath');
    EasymailSessionType := MyReg.ReadString('Sessiontype');
    MyReg.CloseKey;
    MyReg.openKey('Software\Becker\Common', false);
    RemoteAddress := MyReg.ReadString('RemoteAddress');
  finally
    MyReg.free;
  end;

  if (EasymailConfigPath = '') and (EasymailSessionType = '') then
  begin
    Application.MessageBox('Easymail3 scheint auf diesem Rechner nicht
installiert zu sein.', global.titel, 64);
    exit;
  end;

  if EasymailSessionType = 'stRemote' then
  begin
    dm.EasymailSession.SessionType := stRemote;
    dm.EasymailSession.RemoteAddress := RemoteAddress;
  end else
  begin
    dm.EasymailSession.SessionType := stLocal;
    dm.EasymailSession.LocalConfigPath := EasymailConfigPath;
  end;

  dm.TempQuery.Open;
  ImportAccountForm := TImportAccountForm.create(self);
  try
    if ImportAccountForm.showmodal = mrOK then
    begin
      with dm.ActionQuery do
      begin
        if prepared then
          unprepare;
        sql.clear;
        sql.add('delete from Accounts where BenutzerID = :FID');
        ParamByName('FID').asInteger := CurrentBenutzer.ID;
        ExecSQL;
        dm.OpenOrRefresh(dm.AccountsTable);
        dm.AccountsTable.append;
        ...
        dm.AccountsTable.Post;
      end;
    end;
  finally
    ...
  end;
end;

In my datamodule I have set

MyEngine.UseLocalSessionEngineSettings := true

The "Main" Session also uses LocalConfigPath.

That's all.

Regards Uli
Thu, Aug 27 2009 12:02 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< to mean two different databases with different configs etc so two
different sessions being accessed simultaneously. I was more interested in
this than where he was getting the session info from. >>

Ah, he is using TEDBEngine.UseLocalSessionEngineSettings=True, just like the
EDB Manager.  It's what allows you to specify the configuration settings on
a per-session basis instead of a per-engine basis.

--
Tim Young
Elevate Software
www.elevatesoft.com

« Previous PagePage 2 of 2
Jump to Page:  1 2
Image