/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 06:28:53 UTC
  • Revision ID: edam@waxworlds.org-20100729062853-4i2fec52m86mh724
- made basic_statement::step() protected, for use by query and command only
- moved basic_statement::operator<<() to command and query instead; one needs to accept sqlite::exec, the other doesn't
- added tests for query::operator<<()
- added code to invlaidate in-progress queries during any transaction rollbacks (currently segfaults in basic_statement::finalize())
- added new sqlite_error constructor that obtains a full error message
- implemented database::database_mutex_guard class
- swapped command's step mutex in favour of the database mutex

Show diffs side-by-side

added added

removed removed

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