20 #ifndef PQXX_H_TRANSACTION_BASE
21 #define PQXX_H_TRANSACTION_BASE
23 #include "pqxx/compiler-public.hxx"
24 #include "pqxx/compiler-internal-pre.hxx"
35 #include "pqxx/connection_base"
36 #include "pqxx/isolation"
37 #include "pqxx/result"
44 class connection_base;
45 class transaction_base;
64 void unregister_me() throw ();
65 void reg_pending_error(const PGSTD::
string &) throw ();
66 bool registered() const throw () {
return m_registered; }
89 { add_param(v);
return *
this; }
92 { add_param(v, nonnull);
return *
this; }
101 const PGSTD::string m_query;
110 class transaction_subtransaction;
111 class transaction_tablereader;
112 class transaction_tablewriter;
113 class transaction_transactionfocus;
164 PGSTD::string esc(
const char str[])
const
165 {
return m_Conn.esc(str); }
167 PGSTD::string esc(
const char str[],
size_t maxlen)
const
168 {
return m_Conn.esc(str, maxlen); }
170 PGSTD::string esc(
const PGSTD::string &str)
const
171 {
return m_Conn.esc(str); }
185 PGSTD::string esc_raw(
const unsigned char str[],
size_t len)
const
186 {
return m_Conn.esc_raw(str, len); }
188 PGSTD::string esc_raw(
const PGSTD::string &)
const;
192 template<
typename T> PGSTD::string quote(
const T &t)
const
193 {
return m_Conn.quote(t); }
212 result exec(
const PGSTD::string &Query,
213 const PGSTD::string &Desc=PGSTD::string());
215 result exec(
const PGSTD::stringstream &Query,
216 const PGSTD::string &Desc=PGSTD::string())
217 {
return exec(Query.str(), Desc); }
285 void process_notice(
const char Msg[])
const
286 { m_Conn.process_notice(Msg); }
288 void process_notice(
const PGSTD::string &Msg)
const
289 { m_Conn.process_notice(Msg); }
304 void set_variable(
const PGSTD::string &Var,
const PGSTD::string &Val);
316 PGSTD::string get_variable(
const PGSTD::string &);
338 virtual
void do_begin() =0;
340 virtual
result do_exec(const
char Query[]) =0;
342 virtual
void do_commit() =0;
344 virtual
void do_abort() =0;
357 result DirectExec(const
char C[],
int Retries=0);
360 void reactivation_avoidance_clear() throw ()
361 {m_reactivation_avoidance.
clear();}
399 void PQXX_PRIVATE activate();
401 void PQXX_PRIVATE CheckPendingError();
403 template<
typename T>
bool parm_is_null(T *p)
const throw () {
return !p; }
404 template<
typename T>
bool parm_is_null(T)
const throw () {
return false; }
406 friend class pqxx::internal::gate::transaction_transactionfocus;
409 void PQXX_PRIVATE RegisterPendingError(const PGSTD::
string &) throw ();
411 friend class pqxx::internal::gate::transaction_tablereader;
412 void PQXX_PRIVATE BeginCopyRead(const PGSTD::
string &, const PGSTD::
string &);
413 bool ReadCopyLine(PGSTD::
string &);
415 friend class pqxx::internal::gate::transaction_tablewriter;
416 void PQXX_PRIVATE BeginCopyWrite(
417 const PGSTD::
string &Table,
418 const PGSTD::
string &Columns);
419 void WriteCopyLine(const PGSTD::
string &);
422 friend class pqxx::internal::gate::transaction_subtransaction;
426 internal::unique<internal::transactionfocus> m_Focus;
429 PGSTD::map<PGSTD::
string, PGSTD::
string> m_Vars;
430 PGSTD::
string m_PendingError;
437 transaction_base &operator=(const transaction_base &);
443 #include "pqxx/compiler-internal-post.hxx"