/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: 2012-04-23 18:40:10 UTC
  • Revision ID: tim@ed.am-20120423184010-3zaiqkhxwequfaey
Removed an optimisation in command::step() (calling finalize() here prevents
the command from being reset() and reused), and added a wrapper for a
transaction's begin() method to transaction_guard (both thanks to Ron Wilson).

Show diffs side-by-side

added added

removed removed

244
244
                connection &connection )
245
245
                :
246
246
                _transaction( connection ),
247
 
                _released( false )
 
247
                _released( true )
248
248
        {
249
249
                _transaction.begin();
 
250
                _released = false;
250
251
        }
251
252
 
252
253
        ~transaction_guard()
260
261
public:
261
262
 
262
263
        /**
 
264
         * Begin the transaction. Note that this is done automatically in the
 
265
         * constructor.
 
266
         */
 
267
        void begin()
 
268
        {
 
269
                if( _released ) {
 
270
                        _transaction.begin();
 
271
                        _released = false;
 
272
                }
 
273
        }
 
274
 
 
275
        /**
263
276
         * Commit the transaction.
264
277
         */
265
278
        void commit()
271
284
        }
272
285
 
273
286
        /**
274
 
         * Rollback the transaction early.
 
287
         * Rollback the transaction. Note that this is done automatically in the
 
288
         * destructor if the transaction hasn't otherwise been completed.
275
289
         */
276
290
        void rollback()
277
291
        {