Page 1 of 1

ZIBEventAlerter always return "after insert" event instead of "after update" event

Posted: 16.07.2019, 08:44
by radha
ZeosLib 7.27.2.4-stable
Firebird 3.0.4
Lazarus 2.0.2
:D
I created a test code using
SQLQuery,SQLTransaction,IBConnection and FBEventMonitor.
the test code work fine.
and check with FlameRobin -> Database -> Tools --> Monitor Events
also work correctly.

but with ZeosLib 7.27.2.4-stable
ZIBEventAlerter1 Always return after insert event instead of after update event.

/*------------------------------

Code: Select all

ZConnection1.Autocommit := True;
ZQuery1.CachedUpdates:=True;
insert single record directly from dbgrid.

Code: Select all

  ZQuery1.ApplyUpdates; 
/* --------- After Insert Trigger ---------- */

Code: Select all

SET TERM ^ ;
CREATE TRIGGER ISSUES_AI FOR ISSUES ACTIVE
AFTER insert POSITION 0
AS
BEGIN
  post_event 'issue_added';
END^
SET TERM ; ^
/* --------- After Update Trigger ---------- */

Code: Select all

SET TERM ^ ;
CREATE TRIGGER ISSUES_AU FOR ISSUES ACTIVE
AFTER update POSITION 0
AS 
BEGIN 
    post_event 'issue_updated';
END^
SET TERM ; ^
Try with another ZQuery

Code: Select all

  ZQuery2.SQL:=ZQuery1.SQL;
  ZQuery2.Open;
  ZQuery2.Append;
  // Copy the current record
  for i := 0 to ZQuery1.FieldCount  - 1 do
  ZQuery2.Fields[i].Value := ZQuery1.Fields[i].Value; 
  ZQuery2.ApplyUpdates;
ZConnection TransactIsolationLevel = tiReadCommitted
Try with other TransactIsolationLevel ...

:D I'm just being curious. :D

Re: ZIBEventAlerter always return "after insert" event instead of "after update" event

Posted: 16.07.2019, 08:51
by marsupilami
Locked because it is a duplicate of http://zeoslib.sourceforge.net/viewtopi ... 40&t=96042. PLease see there for further discussion.