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

  • Committer: edam
  • Date: 2010-07-27 15:12:55 UTC
  • Revision ID: edam@waxworlds.org-20100727151255-goaqgdz4kj13q7gz
- update TODO
- added some missing includes for <string>
- changed usage of database::exec() to not require return code!
- prevented transaction_guard destructor from throwing an exception

Show diffs side-by-side

added added

removed removed

25
25
 
26
26
 
27
27
#include <sqlite3cc/basic_statement.h>
 
28
#include <boost/thread/recursive_mutex.hpp>
28
29
 
29
30
 
30
31
namespace sqlite
82
83
         * @return an sqlite error code
83
84
         * @see sqlite3_step()
84
85
         */
85
 
        int step();
 
86
        virtual int step();
86
87
 
87
88
        /**
88
89
         * Execute the command. This is the same as doing a step().
126
127
                return _last_insert_rowid;
127
128
        }
128
129
 
129
 
        /**
130
 
         * Stream operator is used to bind values to parameters automatically, in
131
 
         * ascending order. In addition, the null, set_index() and execute auto-
132
 
         * binding manipulators can be used.
133
 
         * @param value a value to bind
134
 
         */
135
 
        template< class T >
136
 
        command &operator <<(
137
 
                const T &value )
138
 
        {
139
 
                int code = bind( _bind_index, value );
140
 
                if( code != SQLITE_OK ) throw sqlite_error( _database, code );
141
 
                _bind_index++;
142
 
                return *this;
143
 
        }
144
 
 
145
130
//______________________________________________________________________________
146
131
//                                                                implementation
147
132
private:
155
140
        /** the rowid of the last successful insert command */
156
141
        long long _last_insert_rowid;
157
142
 
 
143
        /** exclusive use during command mutex */
 
144
        static boost::recursive_mutex _command_mutex;
 
145
 
158
146
};
159
147
 
160
148
 
161
 
// template specialisations for command::operator <<()
162
 
template< >
163
 
command &command::operator << < detail::null_t >(
164
 
        const detail::null_t & );
165
 
template< >
166
 
command &command::operator << < detail::exec_t >(
167
 
        const detail::exec_t & );
168
 
template< >
169
 
command &command::operator << < detail::set_index_t >(
170
 
        const detail::set_index_t &t );
171
 
 
172
 
 
173
149
} // namespace sqlite
174
150
 
175
151