Jump to content

IBCAlert : FireBird Events


Abaksoft

Recommended Posts

Hello Friends,
 
For receiving notifications from new insertion, deleting, updating reords from a DB
did Somebody work with Devart IBDAC IBCAlert Component ?
 

procedure TForm1.IBCAlerter1Event(Sender: TObject; EventName: string;
  EventCount: Integer);
begin
  if EventName='new' then
  begin
    ShowMessage('New Record !');
  end;
end;


SET TERM !! ;
CREATE TRIGGER Tr1 FOR TPatients
ACTIVE
AFTER INSERT POSITION 0 
AS
BEGIN
  POST_EVENT ’new’;
END
!!
SET TERM ; !!



It works fine on a VCL project, but not on Unigui.
Do I forgot some thing ?
Any idea

Thx

Link to comment
Share on other sites

Thank you Farshad.

OK. No problem.

I will develope a standard Service, witch uses IBCAlert for "listening" events.

 

Good custard desert :)

Can you more explain how doit?

How you connect your service + unigui and on web app  control or receive events from service

?

  • Upvote 1
Link to comment
Share on other sites

How you connect your service + unigui and on web app  control or receive events from service ?

 

Alert Notifications from a DB Table

are useful when you need a realtime DBGrid refresh data.

We got used on VCL project. That have worked fine.

 

Ok, but on Web Developpment, generally and surprisingly, avoid using this technic is a good practice !.

We should not open regularly some long queries for refreshing a DBGrid.

(taking care of ressources consumptions).

 

But in some case, we need it also.

For instance, on a small DB, when a secretary keep an eye on new patients.

So, let's go on this idea with Unigui :

 

No need to use big technics here :  UniTimer will save us.

 

Many scenarios and possibilities :

 

1. Notification Event  after insert or Delete :  

No need, a service listener. Just use a UniTimer (10 sec) on your form to compare Record Count(*) before refreshnig the UniDBGrid.

 

2. Notification Event after an Update :

Farshad said just above "Asynchronous events generated independent from unigui can not be used in unigui. "

The idea, is to develope  a standard Delphi Service (witch have an IBCAlert component or else...)  in background to listen events.

When a notification is raising, you can insert on a table the last event, let say ('1' for insert, '2' for delete, '3' for update, etc...) 

Then, retreive this event from an unitimer on your Unigui project.

 

Very simple :)

Link to comment
Share on other sites

I'm not test in unigui yet, I hope I will :)

use only one event alert component and put it on where is the dbconnection component. Add your application's form names as a event name. Or Table names as a event name. insert,update &delete action need reReaad data from table, so no need to separate event more.

When dbEvent came to EventAlert component, sent this event to all opened forms (can add property to form class is easy way). This property has a if condition, if CamedEventName='xxxxTable'then .......  reFresh what you need form's query(s).

This is my vcl way, I said, I don't test in unigui yet,

Link to comment
Share on other sites

How you connect your service + unigui and on web app  control or receive events from service ?

 

Alert Notifications from a DB Table

are useful when you need a realtime DBGrid refresh data.

We got used on VCL project. That have worked fine.

 

Ok, but on Web Developpment, generally and surprisingly, avoid using this technic is a good practice !.

We should not open regularly some long queries for refreshing a DBGrid.

(taking care of ressources consumptions).

 

But in some case, we need it also.

For instance, on a small DB, when a secretary keep an eye on new patients.

So, let's go on this idea with Unigui :

 

No need to use big technics here :  UniTimer will save us.

 

Many scenarios and possibilities :

 

1. Notification Event  after insert or Delete :  

No need, a service listener. Just use a UniTimer (10 sec) on your form to compare Record Count(*) before refreshnig the UniDBGrid.

 

2. Notification Event after an Update :

Farshad said just above "Asynchronous events generated independent from unigui can not be used in unigui. "

The idea, is to develope  a standard Delphi Service (witch have an IBCAlert component or else...)  in background to listen events.

When a notification is raising, you can insert on a table the last event, let say ('1' for insert, '2' for delete, '3' for update, etc...) 

Then, retreive this event from an unitimer on your Unigui project.

 

Very simple :)

 

 

Why?  when you call event in trigger or procedure you can insert event table and select with unitimer

Link to comment
Share on other sites

 

Mmm...

IMHO, old Unigui Builds rised exceptions on Asynchronous FireBird Events.

I tink, Farshad fixed that on new builds : No notifications are now possible and we can'nt work with this technic.

So that code from DocJones is obsolete.

 

OK,

Why?  when you call event in trigger or procedure you can insert event table and select with unitimer

 

1. From your Service application, when a notification (trigger) is raising, 

2. this service application connect to your DB and insert something on a special table let's say TAlterts

3. Now, From your Unigui Application, check via an Unitimer, this TAlerts  (all 10 secondes for exemple)

4. If they are changes then refresh your DBGrid.

 

Best regards

Link to comment
Share on other sites

Mmm...

IMHO, old Unigui Builds rised exceptions on Asynchronous FireBird Events.

I tink, Farshad fixed that on new builds : No notifications are now possible and we can'nt work with this technic.

So that code from DocJones is obsolete.

 

OK,

Why?  when you call event in trigger or procedure you can insert event table and select with unitimer

 

1. From your Service application, when a notification (trigger) is raising, 

2. this service application connect to your DB and insert something on a special table let's say TAlterts

3. Now, From your Unigui Application, check via an Unitimer, this TAlerts  (all 10 secondes for exemple)

4. If they are changes then refresh your DBGrid.

 

Best regards

 

 

I don't understand why use service for this

Example

I have table Torder

 

when inserting or update or delete in this table i have trigger which

insert to table Talert  log  insert update delete etc

 

from this table i will select unitimer but exclude old logs?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...