#include <trigger.hxx>
Public Member Functions | |
trigger (connection_base &C, const PGSTD::string &N) | |
Constructor. Registers the trigger with connection C. | |
virtual | ~trigger () throw () |
const PGSTD::string & | name () const |
virtual void | operator() (int be_pid)=0 |
Overridable: action to invoke when trigger is notified. | |
Protected Member Functions | |
connection_base & | Conn () const throw () |
To listen on a database trigger, derive your own class from trigger and define its function call operator to perform whatever action you wish to take when the given trigger arrives. Then create an object of that class and pass it to your connection. DO NOT set triggers directly through SQL, or they won't be restored when your connection fails--and you'll have no way to notice.
Trigger notifications never arrive inside a transaction. Therefore, you are free to open a transaction of your own inside your trigger's function invocation operator.
Notifications for your trigger may arrive anywhere within libpqxx code, but be aware that PostgreSQL defers notifications occurring inside transactions. So if you're keeping a transaction open, don't expect any of your triggers on the same connection to be notified.
Multiple triggers on the same connection may have the same name.
|
Constructor. Registers the trigger with connection C.
|
|
|
|
|
|
|
|
Overridable: action to invoke when trigger is notified.
|