/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-23 09:17:03 UTC
  • Revision ID: edam@waxworlds.org-20100723091703-3siqjj6eeux9hupz
- added NEWS
- added library checks to configure.ac
- added query::iterators
- remove dependency that rows have on querys (since querys have to be dependent on rows for boost::iterator_facade to work)
- rows now have the handle to the sqlite3 statement and know a count of their row number
- added convenience function tht can be used to detect presence of sqlite3cc in other packages
- updated test-main
- renamed all subdir.mk files to emake.mk

Show diffs side-by-side

added added

removed removed

37
37
 
38
38
void sqlite::basic_transaction::begin()
39
39
{
40
 
        _database.exec( "BEGIN" );
 
40
        int error_code = _database.exec( "BEGIN" );
 
41
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
41
42
}
42
43
 
43
44
 
44
45
void sqlite::basic_transaction::commit()
45
46
{
46
 
        _database.exec( "COMMIT" );
 
47
        int error_code = _database.exec( "COMMIT" );
 
48
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
47
49
}
48
50
 
49
51
 
50
52
void sqlite::basic_transaction::rollback()
51
53
{
52
 
        _database.exec( "ROLLBACK" );
 
54
        int error_code = _database.exec( "ROLLBACK" );
 
55
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
53
56
}
54
57
 
55
58
 
63
66
 
64
67
void sqlite::exclusive_transaction::begin()
65
68
{
66
 
        _database.exec( "BEGIN EXCLUSIVE" );
 
69
        int error_code = _database.exec( "BEGIN EXCLUSIVE" );
 
70
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
67
71
}
68
72
 
69
73
 
85
89
 
86
90
void sqlite::recursive_transaction::begin()
87
91
{
88
 
        _database.exec( "SAVEPOINT " + _sp_name );
 
92
        int error_code = _database.exec( "SAVEPOINT " + _sp_name );
 
93
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
89
94
}
90
95
 
91
96
 
92
97
void sqlite::recursive_transaction::commit()
93
98
{
94
 
        _database.exec( "RELEASE " + _sp_name );
 
99
        int error_code = _database.exec( "RELEASE " + _sp_name );
 
100
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
95
101
}
96
102
 
97
103
 
98
104
void sqlite::recursive_transaction::rollback()
99
105
{
100
 
        _database.exec( "ROLLBACK TO " + _sp_name );
 
106
        int error_code = _database.exec( "ROLLBACK TO " + _sp_name );
 
107
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
101
108
 
102
109
        // we have rolled back this transaction's savepoint, but the savepoint will
103
110
        // remain on the transaction stack unless we also release it
104
 
        _database.exec( "RELEASE " + _sp_name );
 
111
        error_code = _database.exec( "RELEASE " + _sp_name );
 
112
        if( error_code != SQLITE_OK ) throw sqlite_error( error_code );
105
113
}