# trigger.hxx

Go to the documentation of this file.

    00001 /*-------------------------------------------------------------------------
    00002  *
    00003  *   FILE
    00004  *      pqxx/trigger.hxx
    00005  *
    00006  *   DESCRIPTION
    00007  *      definition of the pqxx::trigger functor interface.
    00008  *   pqxx::trigger describes a database trigger to wait on, and what it does
    00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/trigger instead.
    00010  *
    00011  * Copyright (c) 2001-2006, Jeroen T. Vermeulen <jtv@xs4all.nl>
    00012  *
    00013  * See COPYING for copyright license.  If you did not receive a file called
    00014  * COPYING with this source code, please notify the distributor of this mistake,
    00015  * or contact the author.
    00016  *
    00017  *-------------------------------------------------------------------------
    00018  */
    00019 #include "pqxx/compiler-public.hxx"
    00020 #include "pqxx/compiler-internal-pre.hxx"
    00021
    00022 #include "pqxx/connection_base"
    00023
    00024
    00025 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
    00026  */
    00027
    00028 namespace pqxx
    00029 {
    00031
    00056 class PQXX_LIBEXPORT trigger : public PGSTD::unary_function<int, void>
    00057 {
    00058 public:
    00060
    00064   trigger(connection_base &C, const PGSTD::string &N) :                 //[t4]
    00065     m_Conn(C), m_Name(N) { m_Conn.AddTrigger(this); }
    00066
    00067   virtual ~trigger() throw ()                                           //[t4]
    00068   {
    00069 #ifdef PQXX_QUIET_DESTRUCTORS
    00070     internal::disable_noticer Quiet(Conn());
    00071 #endif
    00072     m_Conn.RemoveTrigger(this);
    00073   }
    00074
    00075   const PGSTD::string &name() const { return m_Name; }                  //[t4]
    00076
    00078
    00083   virtual void operator()(int be_pid) =0;                               //[t4]
    00084
    00085
    00086 protected:
    00087   connection_base &Conn() const throw () { return m_Conn; }             //[t23]
    00088
    00089 private:
    00091   trigger(const trigger &);
    00093   trigger &operator=(const trigger &);
    00094
    00095   connection_base &m_Conn;
    00096   PGSTD::string m_Name;
    00097 };
    00098
    00099 }
    00100
    00101
    00102 #include "pqxx/compiler-internal-post.hxx"