Re: [gnome-db] trigger support or simulation with libgda ?
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Vivien Malerba <vmalerba gmail com>
- Cc: Daniel Espinosa <esodan yahoo com mx>, gnome-db <gnome-db-list gnome org>
- Subject: Re: [gnome-db] trigger support or simulation with libgda ?
- Date: Tue, 19 Apr 2005 13:52:15 +0200
On Sat, 2005-04-16 at 14:02 +0200, Vivien Malerba wrote:
> On 4/15/05, Daniel Espinosa <esodan yahoo com mx> wrote:
> >
> > --- "reinecke fox gmx net" <reinecke fox gmx net>
> > wrote:
> > >
> > >
> > > hello together,
> > > I'm new to libgda, so I took some time to review
> > > your library the last days:
> > > its great, thanks for your work !
> > >
> > > I'm looking for a mechanism to watch the changes
> > > made in a table ...
> > > Is it possible to define a listener (and a callback)
> > > that monitors a table and throws the
> > > callback or a signal if one of the typical
> > > DML-commands (insert, update, delete) ran ???
> > >
> > > The program I'm writing is a service, what has to
> > > make some actions, if the data in
> > > the monitored table was changed from outside (maybe
> > > by a webfrontend or anything else)...
> > >
> > > PostgreSQL has TRIGGERS implemented to support such
> > > requirements. But I
> > > really don't want to use libpq ;) Can I use libgda
> > > to use such postgres triggers ?
> > >
> > > Maybe I found a usable mechanism within the
> > > GdaDataModel - e.g. the gda_data_model_row_inserted
> > > function and others. Within the
> > > 'gda_data_model_changed()' function documentation,
> > > listeners
> > > are spoken to - but where can I define one ? I
> > > couldn't find any listener defining function in the
> > > lib. I think I was blind ;)
> > >
> > > I hope there's any possibility to bypass the
> > > inefficient table polling, I had to use before.
> > >
> > > Thanks in advance for some help.
> > > darius
> >
> > In LibGda 1.3.1 GdaDataModel is a GObject, then you
> > can associate a callback to any event. The events know
> > sopported are:
> >
> > changed
> > row_inserted
> > row_updated
> > row_removed
> > column_inserted
> > column_updated
> > column_removed
> > begin_update
> > cancel_update
> > commit_update
>
> This would not work to be notified of a table's contents change as the
> data model notifies of changes made to its own contents (defined in
> any way you want).
>
> Postgres has the notification system which allows to be notified of a
> named condition which has to be "emitted" by the NOTIFY command. The
> condition then needs to be emitted by a trigger. This is not really
> portable...
>
right, we should add this for providers that support change
notification, and propagate the changes to the model.
> Libgda has support for notifiction propagation through the
> "event-notification" signal of the GdaClient object. However for now
> the only events to be notified do not include table content change.
> More work would be required to add such support, but it is doable.
>
table content change should be notified via the data models. For other
events, like real DB triggers and other things, we can use the
event_notification signal.
--
Rodrigo Moya <rodrigo gnome-db org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]