/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-07-27 15:12:55 UTC
  • Revision ID: edam@waxworlds.org-20100727151255-goaqgdz4kj13q7gz
- update TODO
- added some missing includes for <string>
- changed usage of database::exec() to not require return code!
- prevented transaction_guard destructor from throwing an exception

Show diffs side-by-side

added added

removed removed

35
35
class database;
36
36
 
37
37
 
38
 
/**
39
 
 * A basic (default, deferred) transaction.
40
 
 */
41
38
class basic_transaction
42
39
        :
43
40
        private boost::noncopyable
76
73
//                                                                implementation
77
74
protected:
78
75
 
79
 
        /** close any in-progress statements */
80
 
        void invalidate_queries();
81
 
 
82
 
        /** the database on which to act */
 
76
        /* the database on which to act */
83
77
        database &_database;
84
78
 
85
79
};
88
82
////////////////////////////////////////////////////////////////////////////////
89
83
 
90
84
 
91
 
/**
92
 
 * An exclusive transaction
93
 
 */
94
 
class immediate_transaction
95
 
        :
96
 
        public basic_transaction
97
 
{
98
 
//______________________________________________________________________________
99
 
//                                                                 instantiation
100
 
public:
101
 
 
102
 
        /**
103
 
         * Constructor that provides a database upon which to act
104
 
         * @param database a database
105
 
         */
106
 
        explicit immediate_transaction(
107
 
                database &database );
108
 
 
109
 
//______________________________________________________________________________
110
 
//                                                              public interface
111
 
public:
112
 
 
113
 
        /**
114
 
         * Begin the transaction
115
 
         */
116
 
        virtual void begin();
117
 
 
118
 
};
119
 
 
120
 
 
121
 
////////////////////////////////////////////////////////////////////////////////
122
 
 
123
 
 
124
 
/**
125
 
 * An exclusive transaction
126
 
 */
127
85
class exclusive_transaction
128
86
        :
129
87
        public basic_transaction
154
112
////////////////////////////////////////////////////////////////////////////////
155
113
 
156
114
 
157
 
/**
158
 
 * A recursive transaction, allowing transactions to be nested.
159
 
 */
160
115
class recursive_transaction
161
116
        :
162
117
        public basic_transaction
204
159
////////////////////////////////////////////////////////////////////////////////
205
160
 
206
161
 
207
 
/**
208
 
 * A scope guard, or sentinel for use with one of the transaction classes.
209
 
 */
210
162
template< class T = basic_transaction >
211
163
class transaction_guard
212
164
        :
259
211
//                                                                implementation
260
212
protected:
261
213
 
262
 
        /** the transaction */
 
214
        /* the transaction */
263
215
        T _transaction;
264
216
 
265
 
        /** have we released the transaction yet? */
 
217
        /* have we released the transaction yet? */
266
218
        bool _released;
267
219
 
268
220
};