kacor
asked on
Using TIBEvents
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.IBEvents1Even tAlert(Sen der: 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
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.IBEvents1Even
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
ASKER
Hi Bojidar,
I've found in the IB6EmbeddedSQLGuide.pdf/Ch apter 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
I've found in the IB6EmbeddedSQLGuide.pdf/Ch
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
my last question is where (in which part) can I register my interest for a given event for ex. for NEW_EMPL
wbr
Janos
TEventAlerter - as you have begin initially.
Insert in it NEW_EMPL and set a handler to it - see its events (ov TEventAlerter)
Insert in it NEW_EMPL and set a handler to it - see its events (ov TEventAlerter)
ASKER
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
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
Events are not triggers!
Make your trigger above to post POST_EVENT "NEW_EMPL";
and catch NEW_EMPL in Event Alerter
Make your trigger above to post POST_EVENT "NEW_EMPL";
and catch NEW_EMPL in Event Alerter
ASKER
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
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
SET TERM ^ ;
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
POST_EVENT "NEW_EMPL";
END^
SET TERM ; ^
CREATE TRIGGER POST_NEW_EMPL FOR EMPLOYEE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
POST_EVENT "NEW_EMPL";
END^
SET TERM ; ^
in Event Alerter register this event - NEW_EMPL
Bojidar Alexandrov