How use post_event in Lazarus (Firebird)

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Fortuna1
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 04.11.2007, 11:47

How use post_event in Lazarus (Firebird)

Post by Fortuna1 »

1) I put this in my Firebired base;


CREATE TRIGGER "My_table_MSG" FOR "My_table"
ACTIVE AFTER INSERT POSITION 0
AS
beg
POST_EVENT 'my_event';
end


2 I put ZConnection1 and ZIBEventAlerter1 and ZQuery1 on my form
ZConnection1.Contected:=false;
ZConnection1.AutoCommit:=true;


ZIBEventAlerter.Conection:=ZConnection1;

ZIBEventAlerter1.AutoRegister:=False;

ZIBEventAlerter1.Register:=False;
ZIBEventAlerter1.Events[0]:='my_event';

ZConnection1.Contected:=]true;
ZIBEventAlerter1.RegisterEvents;

ZIBEventAlerter1.Register:=True;

and then dead

constructor TIBEventThread.Create(Owner: TZIBEventAlerter;
EventGrp: integer; TermEvent: TNotifyEvent);
begin
inherited Create(True); <-------------------------------------Drop dead
FCancelAlerts := False;
Signal := TSimpleEvent.Create;
Parent := Owner;
EventGroup := EventGrp;
OnTerminate := TermEvent;
Resume;
end;


What is wrong.

Thanks
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Which Firebird version are you using? Embedded or SS?

And What if you do not register any events? Does the app hangs?
Fortuna1
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 04.11.2007, 11:47

Post by Fortuna1 »

I m using SS.
How register any events?
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Supposing you are using Firebrid 2.1, and you have set it as driver in ZConnection1, open

..\src\component\ZIBEventAlerter.pas

and add

uses
SysUtils, Classes, Math,
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
{$IFDEF LINUX}
Libc,
{$ENDIF}
ZDbcInterbase6, ZPlainInterbaseDriver, ZConnection, ZDbcIntfs,
ZPlainInterbase5, ZPlainInterbase6, ZPlainFirebird10, ZPlainFirebird15, ZPlainFirebird20, ZPlainFirebird21, ZPlainFirebirdInterbaseConstants;

procedure TIBEventThread.RegisterEvents;

if Parent.Connection.Protocol='interbase-5' then
sib_event_block := Tsib_event_block(ZPlainInterbase5.isc_event_block)
else if Parent.Connection.Protocol='interbase-6' then
sib_event_block := Tsib_event_block(ZPlainInterbase6.isc_event_block)
else if Parent.Connection.Protocol='firebird-1.0' then
sib_event_block := Tsib_event_block(ZPlainFirebird10.isc_event_block)
else if Parent.Connection.Protocol='firebird-1.5' then
sib_event_block := Tsib_event_block(ZPlainFirebird15.isc_event_block)
else if Parent.Connection.Protocol='firebirdd-1.5' then
sib_event_block := Tsib_event_block(ZPlainFirebird15.isc_event_block)
else if Parent.Connection.Protocol='firebird-2.0' then
sib_event_block := Tsib_event_block(ZPlainFirebird20.isc_event_block)
else if Parent.Connection.Protocol='firebirdd-2.0' then
sib_event_block := Tsib_event_block(ZPlainFirebird20.isc_event_block)
else if Parent.Connection.Protocol='firebird-2.1' then
sib_event_block := Tsib_event_block(ZPlainFirebird21.isc_event_block)
else if Parent.Connection.Protocol='firebirdd-2.1' then
sib_event_block := Tsib_event_block(ZPlainFirebird21.isc_event_block)
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Did this change to testing branch. Will be added to 6.6-patches branch soon.

Fortuna1,
Did this solve the problem?

Mark
Image
mvolovich
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 29.01.2010, 10:19

Post by mvolovich »

mdaems wrote:Did this change to testing branch. Will be added to 6.6-patches branch soon.

Fortuna1,
Did this solve the problem?

Mark
I have same problem with TZIBEventAlerter, it die in same place in ZIBEventAlerter.pas and throw RunError(232).. I use lastest version of ZEOS from SVN (7.0.0) installed in lazarus on linux.
Post Reply