/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/row.h

  • Committer: edam
  • Date: 2010-07-29 20:56:19 UTC
  • Revision ID: edam@waxworlds.org-20100729205619-a9yo4uzu647nvnsj
- renamed database to connection to better identify what it is (would database_connection be better though?)
- moved basic_statement and basic_transaction to sqlite::detail
- made sqlite::threadsafe() return the threading mode int, not a bool
- renamed row::index() to row_number() so it isn't confused with column index
- added typedef for deferred_transaction
- added early rollback method to transaction_guard
- allowed transaction_guard::~transaction_guard() to throw exceptions, since when it needs to, we're really screwed anyway
- bugfix: query::reset() didn't reset the internal row counter
- added query::num_results()
- added docs/design-notes
- reimplemented query::iterator so that increment() (which performs a step() on the query) now caches the returned row to be returned during dereference() (previously it stashed details and returned new row!?)
- bugfix: resetting active queries during rollbacks would hang!

Show diffs side-by-side

added added

removed removed

60
60
 
61
61
        /**
62
62
         * Constructor that produces a valid row.
63
 
         * @param the handle of the statement (query) that created this row
64
 
         * @oaram the result index that is this row
 
63
         * @param handle of the statement (query) that created this row
 
64
         * @oaram row_number the index of this row
65
65
         */
66
66
        explicit row(
67
67
                sqlite3_stmt *handle,
68
 
                unsigned long long index );
 
68
                unsigned long long row_number );
69
69
 
70
70
        /**
71
71
         * Constructor that produces an invalid row.
72
 
         * @param the handle of the statement (query) that created this row
73
72
         */
74
73
        explicit row();
75
74
 
81
80
         * Determine if this row is valid or not. If it is not valid, there are no
82
81
         * more rows in the results of the query.
83
82
         */
84
 
        inline operator bool() const
85
 
        {
86
 
                return _index != std::numeric_limits< unsigned long long >::max();
87
 
        }
 
83
        operator bool() const;
88
84
 
89
85
        /**
90
86
         * get the index in to the results that is this row
91
87
         * @return index
92
88
         */
93
 
        inline unsigned long long index()
 
89
        inline unsigned long long row_number()
94
90
        {
95
 
                return _index;
 
91
                return _row_number;
96
92
        }
97
93
 
98
94
        /**
170
166
        row &operator >>(
171
167
                detail::set_index_t t );
172
168
 
 
169
        /**
 
170
         * Test to see if two rows are the same
 
171
         * @param other the row to compare this one to
 
172
         * @return true if they are
 
173
         */
 
174
        bool operator ==(
 
175
                const row &other )
 
176
                const;
 
177
 
173
178
//______________________________________________________________________________
174
179
//                                                                implementation
175
180
protected:
176
181
 
177
 
        /** the query's handle */
 
182
        /** the query's handle, or NULL */
178
183
        sqlite3_stmt *_handle;
179
184
 
180
185
private:
183
188
        unsigned int _column_index;
184
189
 
185
190
        /** the index of this row */
186
 
        unsigned long long _index;
 
191
        unsigned long long _row_number;
187
192
 
188
193
};
189
194