TAstaServerSocket.ThreadedDBSupplySession


 

Applies to
TAstaServerSocket

 

Declaration
type TAstaSessionCreateEvent = procedure(Sender: TObject;
  ClientSocket: TCustomWinSocket; DataBaseString:
string;
  
var ASession: TComponent) of object;

property ThreadDBSupplySession: TAstaSessionCreateEvent;

 

Description
When Threading ASTA servers, this event must be coded so that ASTA can create whatever database component is needed to be able to run independently in a thread. This can be a TDatabase/TSession pair under the BDE, or a data module containing any components necessary. The ASession parameter is declared as a TComponent to make this as flexible as is necessary to handle any Delphi database component.

 

Example

procedure TForm1.AstaServerSocket1ThreadedDBSupplySession(
  Sender: TObject; ClientSocket: TCustomWinSocket;
  DataBaseString:
string; var ASession: TComponent);

var

  Sess: TSession;

begin

  try

    Sess := TSession.Create(nil); //Asta will dispose of it if
      //
CreateSessionForDBThreads was called with true

    ASession := TDataBase.Create(Sess);

    with ASession as TDataBAse do begin

      DataBaseName := 'db' + IntToStr(AstaServerSocket1.
        SessionList.Count);

      Name := 'DataBase' + IntToStr(AstaServerSocket1.
        SessionList.Count);

      AliasName := MainDataBase.AliasName;

      LoginPrompt := False;

      Params.Assign(MainDatabase.Params);

      TransIsolation := MainDataBase.TransIsolation;

      Connected := True;

    end;

  except

    LogException(ClientSocket, Exception(exceptObject).Message, True);

  end;

end;

 

 



ASTA Overview TAstaServerSocket.ThreadedDBSupplyServerDataSet TAstaServerSocket.ThreadedDBUtilityEvent