/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: 2012-01-23 13:51:26 UTC
  • Revision ID: edam@waxworlds.org-20120123135126-7gohm0mv9qwismla
typo

Show diffs side-by-side

added added

removed removed

39
39
 */
40
40
class command
41
41
        :
42
 
        public basic_statement
 
42
        public detail::basic_statement
43
43
{
44
44
//______________________________________________________________________________
45
45
//                                                                 instantiation
46
46
public:
47
47
 
48
48
        /**
49
 
         * Constructor that provides a database upon which to act and the SQL
 
49
         * Constructor that provides a connection upon which to act and the SQL
50
50
         * command to execute.
51
 
         * @param database a reference to a database
 
51
         * @param connection a reference to a connection
52
52
         * @param sql an SQL statement in UTF-8
53
53
         */
54
54
        explicit command(
55
 
                database &database,
 
55
                connection &connection,
56
56
                const std::string &sql );
57
57
 
58
58
        /**
59
 
         * Constructor that provides a database upon which to act.
60
 
         * @param database a reference to a database
 
59
         * Constructor that provides a connection upon which to act.
 
60
         * @param connection a reference to a connection
61
61
         */
62
62
        explicit command(
63
 
                database &database );
 
63
                connection &connection );
64
64
 
65
65
//______________________________________________________________________________
66
66
//                                                              public interface
126
126
                return _last_insert_rowid;
127
127
        }
128
128
 
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
129
//______________________________________________________________________________
146
130
//                                                                implementation
147
131
private:
158
142
};
159
143
 
160
144
 
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 >(
 
145
namespace detail
 
146
{
 
147
 
 
148
 
 
149
// template specialisations for detail::basic_statement::operator <<()
 
150
template< >
 
151
basic_statement &basic_statement::operator << < detail::exec_t >(
167
152
        const detail::exec_t & );
168
 
template< >
169
 
command &command::operator << < detail::set_index_t >(
170
 
        const detail::set_index_t &t );
 
153
 
 
154
 
 
155
} // namespace detail
171
156
 
172
157
 
173
158
} // namespace sqlite