/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:39:13 UTC
  • Revision ID: edam@waxworlds.org-20100729063913-wvcvkogsa2alwkhr
- moved basic_statement::operator <<() back to basic_statement and just create another specialisation in command so that it can use sqlite::exec

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
246
262
//______________________________________________________________________________
247
263
//                                                                implementation
248
264
protected:
283
299
};
284
300
 
285
301
 
 
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
 
286
311
} // namespace sqlite
287
312
 
288
313