27
27
#include <boost/utility.hpp>
37
class basic_transaction
42
* A basic (default, deferred) transaction.
44
class basic_transaction
46
private boost::noncopyable
48
//__________________________________________________________________________
53
* Constructor that provides a connection upon which to act
54
* @param connection a connection
56
explicit basic_transaction(
57
connection &connection );
59
//__________________________________________________________________________
64
* Begin the transaction
69
* Commit the transaction
71
virtual void commit();
74
* Rollback the transaction
76
virtual void rollback();
78
//__________________________________________________________________________
82
/** reset any in-progress statements */
83
void reset_active_queries();
85
/** the connection on which to act */
86
connection &_connection;
93
////////////////////////////////////////////////////////////////////////////////
97
* A deferred transaction (the default)
99
typedef detail::basic_transaction deferred_tranaction;
102
////////////////////////////////////////////////////////////////////////////////
106
* An immediate transaction
108
class immediate_transaction
39
private boost::noncopyable
110
public detail::basic_transaction
41
112
//______________________________________________________________________________
46
* Constructor that provides a database upon which to act
47
* @param database a database
117
* Constructor that provides a connection upon which to act
118
* @param connection a connection
49
explicit basic_transaction(
120
explicit immediate_transaction(
121
connection &connection );
52
123
//______________________________________________________________________________
53
124
// public interface
59
130
virtual void begin();
62
* Commit the transaction
64
virtual void commit();
67
* Rollback the transaction
69
virtual void rollback();
71
//______________________________________________________________________________
75
/* the database on which to act */
81
135
////////////////////////////////////////////////////////////////////////////////
139
* An exclusive transaction
84
141
class exclusive_transaction
86
public basic_transaction
143
public detail::basic_transaction
88
145
//______________________________________________________________________________
93
* Constructor that provides a database upon which to act
94
* @param database a database
150
* Constructor that provides a connection upon which to act
151
* @param connection a connection
96
153
explicit exclusive_transaction(
154
connection &connection );
99
156
//______________________________________________________________________________
100
157
// public interface
111
168
////////////////////////////////////////////////////////////////////////////////
172
* A recursive transaction, allowing transactions to be nested.
114
174
class recursive_transaction
116
public basic_transaction
176
public detail::basic_transaction
118
178
//______________________________________________________________________________
123
* Constructor that provides a database upon which to act
124
* @param database a database
183
* Constructor that provides a connection upon which to act
184
* @param connection a connection
126
186
explicit recursive_transaction(
127
database &database );
187
connection &connection );
129
189
//______________________________________________________________________________
130
190
// public interface
158
218
////////////////////////////////////////////////////////////////////////////////
161
template< class T = basic_transaction >
222
* A scope guard (sentinel) for use with one of the transaction classes to
223
* provide RIAA-style transactions.
225
template< class T = deferred_tranaction >
162
226
class transaction_guard
164
228
private boost::noncopyable
171
* Constructor that provides a database upon which to act
172
* @param database a database
235
* Constructor that provides a connection upon which to act
236
* @param connection a connection
174
238
explicit transaction_guard(
239
connection &connection )
177
_transaction( database ),
241
_transaction( connection ),
178
242
_released( false )
180
244
_transaction.begin();