chetana bhargav uttered:

Hi,

 I have few questions regarding triggers,

* If we want to have trigger for some condition and if multiple applications create a trigger for the same condition providing different C callback functions (which I guess is possible through sqlite3_create_function), will the trigger be fired to all the registered apps.


Triggers are created at the schema level. As such, they don't callback to through the C API other than by creating a trigger body to call your custom function. If a database has more than once trigger for an event, they will all get called AFAIK.

Make sure that any callback functions are registered in any threads that use the database. Callbacks are per-connection. Each thread will also get other threads' callbacks if registered, or an error is such a function is not defined. Make sure your callbacks are thread-safe!



 * Is it possible to get the rowid for which the trigger is fired,


The trigger will have OLD.rowid (delete, update) or NEW.rowid (update, insert) for the row triggering the trigger. The rowid can then be passed into your callback as an argument.


--
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

Reply via email to