Firebird + Zeos + Events

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
silviojgfr
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 26.10.2005, 15:03
Location: Joao Pessoa - PB

Firebird + Zeos + Events

Post by silviojgfr »

Hi, pals!

When I was using IBX, i had the IBEvents components which i could get events (posts, updates) on IB database and then manipulate in code (update a grid or something).

In Zeos Lib I couldn't see this component (*Events). Zeos has this feature via some other component or a class/unit? If not, some one have any idea on how can I do this FB Event treatment? And it will be present in future versions?

Thanx so much, and congratulations ZeosLib devs! Great Tool!! :wink:
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

See downloads section for the rediscovered ZIBEventAlerter Component.

Mark
Image
User avatar
cipto_kh
Senior Boarder
Senior Boarder
Posts: 83
Joined: 28.09.2005, 11:22
Location: Indonesia
Contact:

Post by cipto_kh »

Rediscovered? it's already done by you Mark? it's great, today I try it (rev 368), but nothing happen :( Am I miss something?

Connect that component to TZConnection, and set AutoRegister to true, then I trap on EventAlert event but nothing happen, maybe there is some setting again?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Cipto,

I think there's something wrong with the Autoregister stuff. Not sure but... Didn't really look into it yet.
I just took the old code I found, did some minor changes to adapt it to current version (actually, I think I only added the new protocols for FB and the firebird constants files)

I got it working with a FB embedded db.
What I did:
- add connection + connected TZIBEventAlerter
- add the Event string to TZIBEventAlerter.Events
- set ZIBEventAlerter1.Registered := True; at runtime after opening the connection.

Attention : when you raise the Event in a stored proc, make sure it is committed. (I have been waiting for Events for a long time until I found that.)

I don't have my test case right here. If you need it, mail me, so I can reply later on.
Image
sveni2211
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 10.06.2008, 15:18
Location: Erfurt, Germany
Contact:

Post by sveni2211 »

Hello.

I've a similar problem. Currently, i'm switching some projects from IBX to Zeos. And i need Events, too.

I got ZEOS from SVN. So i have got the latest Version (revision 370).
But i can't find the rediscovered Version of ZIbEventAlerter. On which directory it is?

I also try out to use the old Version (from 6.1.5 i think). With changes in uses- part and so on i'm able to compile it, but it crashed with error (read from $000000) if the register is called (Registered:=true).
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I suppose you used SVN trunk? Use testing branch. There the components are available.

My advice (for what it's worth):
- Don't try to set Registered to true at design time. It's a known bug. The error is raised because at the creation time of the Alerer the connection to the db using the library isn't made yet. RegisterEvents after opening the connection.
- Please test and make patches to avoid this problems. Maybe best solution is to make Register a registration with the ZConnection component which OnOpen checks what listeners should be added to the connection.
- Somebody out there really hoping to use Events a lot? We need him/her on the dev team!!

Mark
Image
TonyG
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 01.04.2006, 13:39

Post by TonyG »

Hello to all.

I use MySQL with ZEOS and I need events too. I would like to know if is it possible to know when a table have been changed (insert, delete or just update a record) for refreshing the data.

Thanks in advance.

Anthony.
fcodebue
Junior Boarder
Junior Boarder
Posts: 32
Joined: 05.04.2008, 16:02
Contact:

Post by fcodebue »

TonyG wrote:Hello to all.

I use MySQL with ZEOS and I need events too. I would like to know if is it possible to know when a table have been changed (insert, delete or just update a record) for refreshing the data.

Thanks in advance.

Anthony.
Events are ONLY a property of firebird. No other RDBMS have it ;)
Codebue Fabio
P-Soft - http://www.p-soft.biz
Firebird La Comunità Italiana - http://www.firebirdsql.it
GestionaleOpen - http://www.gestionaleopen.org
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Fabio, did you check Postgres? (I'm not a postgres user, but I heard about events or something similar)

Mark
Image
fcodebue
Junior Boarder
Junior Boarder
Posts: 32
Joined: 05.04.2008, 16:02
Contact:

Post by fcodebue »

mdaems wrote:Fabio, did you check Postgres? (I'm not a postgres user, but I heard about events or something similar)

Mark
checking...........
Codebue Fabio
P-Soft - http://www.p-soft.biz
Firebird La Comunità Italiana - http://www.firebirdsql.it
GestionaleOpen - http://www.gestionaleopen.org
TonyG
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 01.04.2006, 13:39

Post by TonyG »

Interbase has events (probably that's wy Firebird has).

Anthony.
TonyG
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 01.04.2006, 13:39

Post by TonyG »

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

Post by seawolf »

Me too I had problem with EventAlert. Taking at look it seems that synchronize calls blocks all the event threads (if your software doesn't use Application.ProcessMessages)

So changing Synchronize calls to TCriticalSection seems to work pretty well (for me :wink: )

I've also add some lines to create_interbase.sql (I don't know if this is the right place) in order to send you also a test procedure

/*==============================================================*/
/* Events */
/*==============================================================*/

CREATE PROCEDURE PROCEDURE_TEST_EVENT_1
AS
BEGIN
POST_EVENT 'my event 1';
END^

CREATE PROCEDURE PROCEDURE_TEST_EVENT_2
AS
BEGIN
POST_EVENT 'my event 2';
END^
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi Seawolf,

Unfortunately your patch does not compile on fpc/lazarus. So I changed it, with the old situation IFDEFed for FPC.
However : my very simple test program failed. I'll send it to you using mail, so you can try yourself. Meanwhile, I can't accept hte patch.

Mark
Image
Post Reply