triggers

Freature requests from users for ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
Shomer
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.04.2006, 15:54

triggers

Post by Shomer »

I used to have triggers with Interbase and worked with TIBEvents, how to work with tiggers within PostgreSQL?

I am also having errors when creating EMS SQL the triggers. Sintaxe error...
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

Give us an example of what you are trying to do and we should be able to help.

Regards,

Ben
Shomer
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.04.2006, 15:54

Post by Shomer »

I have 2 applications.. the 1st one is working to update my table, and the 2nd will try to see if there is any new updating. Now a days I am using a TTimer with an opened query, so time to time I issue a refresh to the query. With Interbase I could create a trigger, so after any change (controlling as insert/delete/update), my application could 'fell' that change and only call the refresh if really necessary, saving a lot of database processing. My application had a component that act as semaphore and it simple receives a string, that I could put anything on that, as 'data_inserted'... i.e.

Any suggestion?
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

Well, PostgreSQL has notifications which sound similar, but ZeosLib doesn't support them. It may be possible to use low level calls against libpq to get this working but don't know how. Sorry to not be of more help.

Ben
kotadr
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 30.10.2006, 22:59
Location: Ukraine, Dniepropetrovsk

PostgreSQL notifies for ZeosDBO

Post by kotadr »

I have written (see attach) successor TZAbstractNotification (port from old Zeos), is used in a separate thread in my application.

Yours faithfully, Konstantin.

PS: Sorry for my bad English
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 »

Thanks Konstantin!!

I'll move this thread to the feature requests forum. That way we may not 'forget' it when we go on after version 6.6.

Maybe we should try to make it more 'general' in that sense that we should be able to create a Notify object from the connection, without actually knowing the database that is used. The actual implementation would depend on the connection (and fail for all databases not supporting it).

Mark
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 checked the code that's already present.
Just add your code to ZDbcPostgreSql.pas,
Overwrite TZAbstractConnection.CreateNotification
Then you can
1) Add a function CreateNotification to TZConnection to create an AbstractNotification object you can use. Maybe this is not optimal as you will have to maintain it yourself in your app.
2) (I would like this) Create a new component TZEventListener (or something like that) similar to TZSequence which uses the FConnection.DbcConnection.CreateNotification call.

Do you think you can do that?

Mark
Shomer
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 10.04.2006, 15:54

Post by Shomer »

Since my first post, almost 1 year ago, I am here again to see the news... So, The new 6.6 version contains such feature as a component?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

No Shomer,
The new 6.6 version does not contain such feature as a component.
The main reasons for this are :
- there's nobody using Pgsql on the team who can develop it.
- there's somebody needed who's used to write threaded applications as this kind of component will have to be waiting for input from the server while the application goes on. The developer will have to take into account behaviour of other databases in order to develop a component which works the same way, independent of the server used.

So, if you feel like going for it, please feel free to contact me.
If not, you will have to work with Konstantins port above until somebody else shows up. I know about somebody who's willing to implement it for Firebird, but he's also very new in zeosdbo development. When he succeeds it may be easier to add pgsql support. So stay tuned and have a look again next year.

Mark
Post Reply