AnyDAC
ContentsIndexHome
PreviousUpNext
TADEventAlerter Class

The class is responsible for handling the database event notifications.

Group
Class Hierarchy
uADCompClient_TADEventAlerteruADCompClient_TADEventAlerter
File

uADCompClient

Links

Use the TADEventAlerter class to handle the database event notifications. 

The kind and general behavior of the events is DBMS specific. But TADEventAlerter provides unified way for handling them.

TADEventAlerter = class(TADCustomEventAlerter);
ADEventAlerter1.Options.Kind := 'DBMS_ALERT';
ADEventAlerter1.Names.Text := 'Customers';
ADEventAlerter1.Options.Synchronize := True;
ADEventAlerter1.Options.Timeout := 10000;
ADEventAlerter1.OnAlter := DoAlert;
ADEventAlerter1.OnTimeout := DoTimeout;
ADEventAlerter1.Active := True;
........

procedure TForm1.DoAlert(ASender: TADCustomEventAlerter;
  const AEventName: String; const AArgument: Variant);
begin
  if CompareText(AEventName, 'Customers') = 0 then
    qryCustomers.Refresh;
end;

procedure TForm1.DoTimeout(ASender: TObject);
begin
  qryCustomers.Refresh;
end;

See the demo at: AnyDAC\Samples\Comp Layer\TADEventAlerter\Main

What do you think about this topic? Send feedback!