Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

pqxx::Trigger Class Reference

"Observer" base class for trigger notifications. More...

#include <trigger.h>

List of all members.

Public Member Functions

 Trigger (Connection &C, const PGSTD::string &N)
 Constructor. Registers the trigger with Connection C.

virtual ~Trigger ()
PGSTD::string Name () const
virtual void operator() (int be_pid)=0
 Overridable: action to invoke when trigger is notified.


Protected Member Functions

ConnectionConn () const throw ()


Detailed Description

"Observer" base class for trigger notifications.

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 & Destructor Documentation

pqxx::Trigger::Trigger Connection   C,
const PGSTD::string &    N
 

Constructor. Registers the trigger with Connection C.

Parameters:
C the connection this trigger resides in.
N a name for the trigger.

virtual pqxx::Trigger::~Trigger   [virtual]
 


Member Function Documentation

Connection& pqxx::Trigger::Conn   const throw () [protected]
 

PGSTD::string pqxx::Trigger::Name   const
 

virtual void pqxx::Trigger::operator() int    be_pid [pure virtual]
 

Overridable: action to invoke when trigger is notified.

Parameters:
be_pid the process ID of the database backend process that served our connection when the trigger was notified. The actual process ID behind the connection may have changed by the time this method is called.


The documentation for this class was generated from the following file:
Generated on Fri Feb 28 19:23:33 2003 for libpqxx by doxygen1.3-rc3