/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 09:16:26 UTC
  • Revision ID: edam@waxworlds.org-20100729091626-h8fmg0r74eyfo5ae
- fixed error caused by finialising in-progress queries during rollback that were later finaliased by RAII.

Show diffs side-by-side

added added

removed removed

34
34
{
35
35
 
36
36
 
37
 
class connection;
 
37
class database;
38
38
class row;
39
39
namespace detail {
40
40
        struct null_t;
43
43
}
44
44
 
45
45
 
46
 
namespace detail
47
 
{
48
 
 
49
 
 
50
46
/**
51
47
 * The statement class represents an SQL statement. It is the base class for
52
48
 * both the command and the query classes, which should be used for those
61
57
protected:
62
58
 
63
59
        /**
64
 
         * Constructor that provides a connection upon which to act and the SQL
 
60
         * Constructor that provides a database upon which to act and the SQL
65
61
         * statement.
66
 
         * @param connection a reference to a connection
 
62
         * @param database a reference to a database
67
63
         * @param sql an SQL statement in UTF-8
68
64
         */
69
65
        explicit basic_statement(
70
 
                connection &connection,
 
66
                database &database,
71
67
                const std::string &sql );
72
68
 
73
69
        /**
74
 
         * Constructor that provides a connection upon which to act.
75
 
         * @param connection a reference to a connection
 
70
         * Constructor that provides a database upon which to act.
 
71
         * @param database a reference to a database
 
72
         * @param sql an SQL statement in UTF-8
76
73
         */
77
74
        explicit basic_statement(
78
 
                connection &connection );
 
75
                database &database );
79
76
 
80
77
        virtual ~basic_statement();
81
78
 
98
95
         * @returns an sqlite error code
99
96
         * @see sqlite3_reset()
100
97
         */
101
 
        virtual int reset();
 
98
        int reset();
102
99
 
103
100
        /**
104
101
         * Clears the values bound to a statement to NULL.
130
127
        /**
131
128
         * Bind a string value to the SQL statement via it's index where the value
132
129
         * of that string will not change for the duration of the statement. This is
133
 
         * more optimal because sqlite will not have to take it's own copy of the
 
130
         * more optimal because sqlite will not have to make it's own copy of the
134
131
         * data.
135
132
         * @param index the index of the parameter to bind to
136
133
         * @param value the invariant string value
137
 
         * @param value_length the length of the string including zero-terminator
138
134
         * @returns an sqlite error code
139
135
         * @see sqlite3_bind_text()
140
136
         */
146
142
        /**
147
143
         * Bind a string value to the SQL statement via it's index where the value
148
144
         * of that string will not change for the duration of the statement. This is
149
 
         * more optimal  because sqlite will not have to take it's own copy of the
 
145
         * more optimal  because sqlite will not have to make it's own copy of the
150
146
         * data.
151
147
         * @param index the index of the parameter to bind to
152
148
         * @param value the invariant string value
160
156
        /**
161
157
         * Bind a string value to the SQL statement via it's index where the value
162
158
         * of that string will not change for the duration of the statement. This is
163
 
         * more optimal because sqlite will not have to take it's own copy of the
 
159
         * more optimal because sqlite will not have to make it's own copy of the
164
160
         * data.
165
161
         * @param index the index of the parameter to bind to
166
162
         * @param value the invariant string value
201
197
        /**
202
198
         * Bind a string value to the SQL statement via a named parameter where the
203
199
         * string value will not change for the duration of the statement. This
204
 
         * prevents sqlite from taking its own copy of the string.
 
200
         * prevents a copy of the string being taken.
205
201
         * @param name the named parameter to bind to
206
202
         * @param value the invariant string value
207
 
         * @param value_length the length of the string including zero-terminator
208
203
         * @returns an sqlite error code
209
204
         * @see sqlite3_bind_text()
210
205
         */
259
254
                const T &value )
260
255
        {
261
256
                int code = bind( _bind_index, value );
262
 
                if( code != SQLITE_OK ) throw sqlite_error( _connection, code );
 
257
                if( code != SQLITE_OK ) throw sqlite_error( _database, code );
263
258
                _bind_index++;
264
259
                return *this;
265
260
        }
292
287
         */
293
288
        int step();
294
289
 
295
 
        /** the connection upon which to act */
296
 
        connection &_connection;
 
290
        /** the database upon which to act */
 
291
        database &_database;
297
292
 
298
293
        /** the statement handle */
299
294
        sqlite3_stmt *_handle;
313
308
        const detail::set_index_t &t );
314
309
 
315
310
 
316
 
} // namespace detail
317
 
 
318
 
 
319
311
} // namespace sqlite
320
312
 
321
313