The hard part is to do it portably.

I use a multicast socket that writes the change-event. Then I use a
select() call on the multicast socket in other clients- if they see the
change event, they incorporate the new data into their cache.

If you want it reasonably seamless, create triggers that evaluate a
dummy-function that calls your notify: (e.g. SELECT foo() FROM table
LIMIT 1)



On Sun, 2004-05-09 at 18:39, Chris Waters wrote:
> Hi,
> 
> I need the ability to tell if changes have been made in the database. Kind
> of like the LISTEN capability in Postgresql. In particular I need to know
> if:
> 
> * A row was inserted.
> * A row was deleted.
> * A row was modified.
> 
> I would like to implement this through a callback that an application could
> register. The callback would specify the operation that was performed, the
> affected table and maybe the rowid affected.
> 
> If the rowid is reported then for operations that affect a large number of
> rows there would be a performance penalty to call the callback per row. For
> my application this is not a problem, but perhaps when the callback is
> specified the application could indicate whether it wants per row, or per
> table notification.
> 
> I am looking for ideas on where I should hook into the source code to add
> this functionality. From what I have seen so far it looks like I could
> change the implementation of the Delete and MakeRecord VM instructions to do
> the callback.
> 
> I haven't thought through the timing implications yet. Ideally when a row is
> inserted, code in the callback could query the newly inserted row. I am not
> 100% sure at what point the row becomes visible for query.
> 
> I would welcome any insight since this is my first attempt (of many I have
> lots of features I want :-) to modify the sqlite code.
> 
> Thanks,
> 
> Chris.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to