TAstaServerSocket.OnTransactionBegin
Applies
to
TAstaServerSocket
Declaration
type TAstaBeginTransactionEvent = procedure(Sender:
TObject;
ClientSocket: TCustomWinSocket; Session: TComponent;
TransActionName: string) of
object;
property OnTransactionsBegin: TAstaBeginTransactionEvent;
Description
This is the event coded that allows a transaction to be started on ASTA servers
Here is an example from the AstaBDEServer. Depending on the threading model in effect, the Session parameter will be supplied by the ThreadedDBSupplyQueryEvent. In this case the ThreadedDBSupplyQuery event receives a ttTransactionStart and returns a TDataBase which the BDE uses to start a transaction with the StartTransaction method. Since ASTA suports any type of component for use with ASTA servers, the example below type casts the Session parameter as a BDE TDataBase since this example was from the AstaBDEServer.
procedure
TForm1.AstaServerSocket1TransactionBegin(Sender: TObject;
ClientSocket: TCustomWinSocket; Component; TransActionName: string);
begin
try
with Session as TDataBase do begin
if not IsSQLBased then TransIsolation := tiDirtyRead;
if not InTransaction then StartTransaction;
end;
except
LogException(ClientSocket, Exception(ExceptObject).Message, True);
end;
end;