/sqlite3cc

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

« back to all changes in this revision

Viewing changes to src/transaction.cc

  • Committer: edam
  • Date: 2010-07-27 15:46:42 UTC
  • Revision ID: edam@waxworlds.org-20100727154642-1uxrjkpxhp7xl6hq
- moved null_t, exec_t and set_index_t to detail namespace so only their extern instantiations are in the main namespace
- added immediate transation

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
}
48
48
 
49
49
 
50
 
void sqlite::basic_transaction::invalidate_queries()
51
 
{
52
 
        while( sqlite3_stmt *handle = sqlite3_next_stmt( _database._handle, NULL ) )
53
 
                if( int code = sqlite3_reset( handle ) )
54
 
                        throw sqlite_error( _database, code );
55
 
}
56
 
 
57
 
 
58
50
void sqlite::basic_transaction::rollback()
59
51
{
60
 
        // we must invalidate any active queries when rolling back
61
 
        invalidate_queries();
62
52
        _database.exec( "ROLLBACK" );
63
53
}
64
54
 
97
87
        basic_transaction( database )
98
88
{
99
89
        static unsigned long long i = 0;
 
90
        unsigned long long my_i;
100
91
        static boost::mutex mutex;
101
 
        unsigned long long my_i;
102
92
        {
103
93
                boost::lock_guard< boost::mutex > lock( mutex );
104
94
                my_i = i++;
121
111
 
122
112
void sqlite::recursive_transaction::rollback()
123
113
{
124
 
        // we must invalidate any active queries when rolling back
125
 
        invalidate_queries();
126
114
        _database.exec( "ROLLBACK TO " + _sp_name );
127
115
 
128
116
        // we have rolled back this transaction's savepoint, but the savepoint will