libpqxx
4.0.1
Main Page
Related Pages
Modules
Namespaces
Classes
transaction_base.hxx
1
/*-------------------------------------------------------------------------
2
*
3
* FILE
4
* pqxx/transaction_base.hxx
5
*
6
* DESCRIPTION
7
* common code and definitions for the transaction classes.
8
* pqxx::transaction_base defines the interface for any abstract class that
9
* represents a database transaction
10
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transaction_base instead.
11
*
12
* Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
13
*
14
* See COPYING for copyright license. If you did not receive a file called
15
* COPYING with this source code, please notify the distributor of this mistake,
16
* or contact the author.
17
*
18
*-------------------------------------------------------------------------
19
*/
20
#ifndef PQXX_H_TRANSACTION_BASE
21
#define PQXX_H_TRANSACTION_BASE
22
23
#include "pqxx/compiler-public.hxx"
24
#include "pqxx/compiler-internal-pre.hxx"
25
26
/* End-user programs need not include this file, unless they define their own
27
* transaction classes. This is not something the typical program should want
28
* to do.
29
*
30
* However, reading this file is worthwhile because it defines the public
31
* interface for the available transaction classes such as transaction and
32
* nontransaction.
33
*/
34
35
#include "pqxx/connection_base"
36
#include "pqxx/isolation"
37
#include "pqxx/result"
38
39
/* Methods tested in eg. self-test program test001 are marked with "//[t1]"
40
*/
41
42
namespace
pqxx
43
{
44
class
connection_base;
45
class
transaction_base;
46
47
48
namespace
internal
49
{
50
class
sql_cursor;
51
52
class
PQXX_LIBEXPORT
transactionfocus
:
public
virtual
namedclass
53
{
54
public
:
55
explicit
transactionfocus
(
transaction_base
&t) :
56
namedclass
(
"transactionfocus"
),
57
m_Trans(t),
58
m_registered(false)
59
{
60
}
61
62
protected
:
63
void
register_me();
64
void
unregister_me() throw ();
65
void
reg_pending_error(const PGSTD::
string
&) throw ();
66
bool
registered() const throw () {
return
m_registered; }
67
68
transaction_base
&
m_Trans
;
69
70
private
:
71
bool
m_registered;
72
74
transactionfocus
();
76
transactionfocus
(
const
transactionfocus
&);
78
transactionfocus
&operator=(
const
transactionfocus
&);
79
};
80
81
82
class
PQXX_LIBEXPORT
parameterized_invocation
: statement_parameters
83
{
84
public
:
85
parameterized_invocation
(
connection_base
&,
const
PGSTD::string &query);
86
87
parameterized_invocation
&
operator()
() { add_param();
return
*
this
; }
88
parameterized_invocation
&operator()(
const
binarystring
&v)
89
{ add_binary_param(v,
true
);
return
*
this
; }
90
template
<
typename
T>
parameterized_invocation
&operator()(
const
T &v)
91
{ add_param(v,
true
);
return
*
this
; }
92
parameterized_invocation
&operator()(
const
binarystring
&v,
bool
nonnull)
93
{ add_binary_param(v, nonnull);
return
*
this
; }
94
template
<
typename
T>
95
parameterized_invocation
&operator()(
const
T &v,
bool
nonnull)
96
{ add_param(v, nonnull);
return
*
this
; }
97
98
result
exec();
99
100
private
:
102
parameterized_invocation
&operator=(
const
parameterized_invocation
&);
103
104
connection_base
&m_home;
105
const
PGSTD::string m_query;
106
};
107
}
// namespace internal
108
109
110
namespace
internal
111
{
112
namespace
gate
113
{
114
class
transaction_subtransaction;
115
class
transaction_tablereader;
116
class
transaction_tablewriter;
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>
108>