Mega Code Archive

 
Categories / Delphi / Algorithm Math
 

Sending integer with IB Events

Title: Sending integer with IB Events Question: How to send integer parameter with POST_EVENT? Answer: You can use Eventcount parameter that counts posted Events since last commit and passes this info to the TIBEvent (IBX) EventAlert Event. We can use a loop to post event as many times as the value of integer that we want to pass to client application. This code can be used in PSQL (stored procedures or triggers). "i" is local integer variable and "value" is parameter we want to send with STATE event. i=0; while (ido begin POST_EVENT 'STATE'; i=i+1; end In Delphi client application, use OnEventAlert handling for TIBEvent component like this. procedure TForm1.IBEvents1EventAlert(Sender: TObject; EventName: string; EventCount: Integer; var CancelAlerts: Boolean); begin if 'STATE'=EventName then begin (* "EventCount" is our variable comming from SQL Do something useful here *) end; end; Eventcount will contain integer value you posted from your SQL stored procedure code.