/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/basic_statement.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

243
243
        int bind_null(
244
244
                const std::string &name );
245
245
 
246
 
        /**
247
 
         * Stream operator is used to bind values to parameters automatically, in
248
 
         * ascending order. In addition, the null and set_index() auto-binding
249
 
         * manipulators can be used.
250
 
         * @param value a value to bind
251
 
         */
252
 
        template< class T >
253
 
        basic_statement &operator <<(
254
 
                const T &value )
255
 
        {
256
 
                int code = bind( _bind_index, value );
257
 
                if( code != SQLITE_OK ) throw sqlite_error( _database, code );
258
 
                _bind_index++;
259
 
                return *this;
260
 
        }
261
 
 
262
246
//______________________________________________________________________________
263
247
//                                                                implementation
264
248
protected:
299
283
};
300
284
 
301
285
 
302
 
// template specialisations for basic_statement::operator <<()
303
 
template< >
304
 
basic_statement &basic_statement::operator << < detail::null_t >(
305
 
        const detail::null_t & );
306
 
template< >
307
 
basic_statement &basic_statement::operator << < detail::set_index_t >(
308
 
        const detail::set_index_t &t );
309
 
 
310
 
 
311
286
} // namespace sqlite
312
287
 
313
288