Page 1 of 1

triggers

Posted: 03.05.2006, 16:36
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...

Posted: 04.05.2006, 09:00
by btrewern
Give us an example of what you are trying to do and we should be able to help.

Regards,

Ben

Posted: 29.06.2006, 15:45
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?

Posted: 30.06.2006, 09:30
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

PostgreSQL notifies for ZeosDBO

Posted: 30.10.2006, 23:25
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

Posted: 31.10.2006, 08:32
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

Posted: 31.10.2006, 11:16
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

Posted: 06.06.2007, 18:52
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?

Posted: 06.06.2007, 20:21
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