/sqlite3cc

To get this branch, use:
bzr branch http://bzr.ed.am/sqlite3cc

« back to all changes in this revision

Viewing changes to include/sqlite3cc/transaction.h

  • Committer: edam
  • Date: 2010-02-07 14:39:18 UTC
  • Revision ID: edam@waxworlds.org-20100207143918-gi030ojecbska8hw
- updated README
- set up project for use with autotools

Show diffs side-by-side

added added

removed removed

25
25
 
26
26
 
27
27
#include <boost/utility.hpp>
28
 
#include <string>
29
28
 
30
29
 
31
30
namespace sqlite
35
34
class database;
36
35
 
37
36
 
38
 
/**
39
 
 * A basic (default, deferred) transaction.
40
 
 */
41
37
class basic_transaction
42
38
        :
43
39
        private boost::noncopyable
85
81
////////////////////////////////////////////////////////////////////////////////
86
82
 
87
83
 
88
 
/**
89
 
 * An exclusive transaction
90
 
 */
91
 
class immediate_transaction
92
 
        :
93
 
        public basic_transaction
94
 
{
95
 
//______________________________________________________________________________
96
 
//                                                                 instantiation
97
 
public:
98
 
 
99
 
        /**
100
 
         * Constructor that provides a database upon which to act
101
 
         * @param database a database
102
 
         */
103
 
        explicit immediate_transaction(
104
 
                database &database );
105
 
 
106
 
//______________________________________________________________________________
107
 
//                                                              public interface
108
 
public:
109
 
 
110
 
        /**
111
 
         * Begin the transaction
112
 
         */
113
 
        virtual void begin();
114
 
 
115
 
};
116
 
 
117
 
 
118
 
////////////////////////////////////////////////////////////////////////////////
119
 
 
120
 
 
121
 
/**
122
 
 * An exclusive transaction
123
 
 */
124
84
class exclusive_transaction
125
85
        :
126
86
        public basic_transaction
151
111
////////////////////////////////////////////////////////////////////////////////
152
112
 
153
113
 
154
 
/**
155
 
 * A recursive transaction, allowing transactions to be nested.
156
 
 */
157
114
class recursive_transaction
158
115
        :
159
116
        public basic_transaction
201
158
////////////////////////////////////////////////////////////////////////////////
202
159
 
203
160
 
204
 
/**
205
 
 * A scope guard, or sentinel for use with one of the transaction classes.
206
 
 */
207
161
template< class T = basic_transaction >
208
162
class transaction_guard
209
163
        :
228
182
 
229
183
        ~transaction_guard()
230
184
        {
231
 
                if( !_released ) {
232
 
                        try {
233
 
                                _transaction.rollback();
234
 
                        }
235
 
                        catch( ... ) {
236
 
                        }
237
 
                }
 
185
                if( !_released )
 
186
                        _transaction.rollback();
238
187
        }
239
188
 
240
189
//______________________________________________________________________________