/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-29 06:39:13 UTC
  • Revision ID: edam@waxworlds.org-20100729063913-wvcvkogsa2alwkhr
- moved basic_statement::operator <<() back to basic_statement and just create another specialisation in command so that it can use sqlite::exec

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
 */
38
41
class basic_transaction
39
42
        :
40
43
        private boost::noncopyable
73
76
//                                                                implementation
74
77
protected:
75
78
 
76
 
        /* the database on which to act */
 
79
        /** close any in-progress statements */
 
80
        void invalidate_queries();
 
81
 
 
82
        /** the database on which to act */
77
83
        database &_database;
78
84
 
79
85
};
82
88
////////////////////////////////////////////////////////////////////////////////
83
89
 
84
90
 
 
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
 */
85
127
class exclusive_transaction
86
128
        :
87
129
        public basic_transaction
112
154
////////////////////////////////////////////////////////////////////////////////
113
155
 
114
156
 
 
157
/**
 
158
 * A recursive transaction, allowing transactions to be nested.
 
159
 */
115
160
class recursive_transaction
116
161
        :
117
162
        public basic_transaction
159
204
////////////////////////////////////////////////////////////////////////////////
160
205
 
161
206
 
 
207
/**
 
208
 * A scope guard, or sentinel for use with one of the transaction classes.
 
209
 */
162
210
template< class T = basic_transaction >
163
211
class transaction_guard
164
212
        :
211
259
//                                                                implementation
212
260
protected:
213
261
 
214
 
        /* the transaction */
 
262
        /** the transaction */
215
263
        T _transaction;
216
264
 
217
 
        /* have we released the transaction yet? */
 
265
        /** have we released the transaction yet? */
218
266
        bool _released;
219
267
 
220
268
};