?
Solved

Using TIBEvents

Posted on 2003-03-10
10
Medium Priority
?
1,048 Views
Last Modified: 2013-12-09
Hi Experts,
                  I try to use a TIBEvents component but I don't know what kind of events are to be used. I have choosen logical events (for example EMP_NO>100) for the Events property (EventAlerter Events window) and I don't get event report using the procedure as follows:

procedure TDMDatamodul.IBEvents1EventAlert(Sender: TObject;
  EventName: String; EventCount: Integer; var CancelAlerts: Boolean);
begin
   MessageDlg ('Event: '+EventName, mtInformation, [mbOK], 0);
end;

This is placed in a DataModule so first I had to insert the "uses Dialogs" to the used units to be able to use here the message dialog box.

An other question: How can I delete event from this list (EventAlerter Events window)?

with best regards

Janos
0
Comment
Question by:kacor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 8136442
This is not the purpose of events at all. Please read the pdf - Language Reference

Bojidar Alexandrov
0
 
LVL 10

Author Comment

by:kacor
ID: 8138167
Hi Bojidar,
I've found in the IB6EmbeddedSQLGuide.pdf/Chapter 11 Working with events interesting things, thanks for the idea. But could you send me an example how to create such an event.
I tried to insert this trigger into Employee.gdb in Program Files\Common Files\Borland Shared\Data

SET TERM !! ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
   ACTIVE
   AFTER INSERT
   POSITION 0
   AS
      BEGIN
         POST_EVENT ’NEW_EMPL’;
   END
!!
SET TERM ; !!

but I got an error message:
 
Dynamic SQL Error
SQL error code = -104
Unexpected end of command

This is an example from Embedded Sql Guide P.234.

wbr Janos
0
 
LVL 6

Accepted Solution

by:
BAlexandrov earned 340 total points
ID: 8141426
You have some invalid characters in post_event line.
It must be:
POST_EVENT "NEW_EMPL";


Regards,
Bojidar Alexandrov
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 10

Author Comment

by:kacor
ID: 8159898
Dear Bojidar,
my last question is where (in which part) can I register my interest for a given event for ex. for NEW_EMPL

wbr

Janos
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 8160500
TEventAlerter - as you have begin initially.
Insert in it NEW_EMPL and set a handler to it - see its events (ov TEventAlerter)
0
 
LVL 10

Author Comment

by:kacor
ID: 8165010
Bojidar,
I used the Employee.gdb from the examples (\common files\borland shared\data). As I see in IBConsole Employee table has two triggers: SET_EMP_NO and SAVE_SALARY_CHANGE, so this events exist. I use this events in the IBEvents1.Events property but the IBEvents1EventAlert procedure (see above) don't give a message dialog box whether I use the Commit or don't use. Any more idea?

wbr Janos
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 8165067
Events are not triggers!
Make your trigger above to post POST_EVENT "NEW_EMPL";
and catch NEW_EMPL in Event Alerter
0
 
LVL 10

Author Comment

by:kacor
ID: 8165492
To remain compatible with the earlier settings I used the code as follows:
SET TERM ^ ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
    POST_EVENT "NEW_EMPL";
END
SET TERM ; ^

but it gives an error message:

Dynamic SQL Error
SQL error code = -104
Token unknown - line 7, char -1
SET
Statement: CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  POST_EVENT "NEW_EMPL";
END
SET TERM ;

I can't understand. I feel it is a tree near the forest and this tree drapes the whole forest and I can't see the forest. Everything is dark...

Janos
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 8166990
SET TERM ^ ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   POST_EVENT "NEW_EMPL";
END^
SET TERM ; ^
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 8166994
in Event Alerter register this event - NEW_EMPL
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question