4
* Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
4
* Copyright (C) 2009 Tim Marston <tim@ed.am>
6
6
* This file is part of sqlite3cc (hereafter referred to as "this program").
7
* See http://www.waxworlds.org/edam/software/sqlite3cc for more information.
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU Lesser General Public License as published
11
* by the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Lesser General Public License for more details.
7
* See http://ed.am/dev/sqlite3cc for more information.
9
* This program is free software: you can redistribute it and/or modify it under
10
* the terms of the GNU Lesser General Public License as published by the Free
11
* Software Foundation, either version 3 of the License, or (at your option) any
14
* This program is distributed in the hope that it will be useful, but WITHOUT
15
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
19
19
* You should have received a copy of the GNU Lesser General Public License
20
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
51
* The statement class represents an SQL statement. It is the base class for
51
* The statement class represents an SQL statement. It is the base class for
52
52
* both the command and the query classes, which should be used for those
53
* purposes. The basic_statement class its self has protected instantiation.
53
* purposes. The basic_statement class its self has protected instantiation.
55
55
class basic_statement
93
96
const std::string &sql );
96
* Reset the statement, ready to re-execute it. This does not clear any of
99
* Reset the statement, ready to re-execute it. This does not clear any of
97
100
* the values bound to the statement.
98
102
* @returns an sqlite error code
99
103
* @see sqlite3_reset()
104
108
* Clears the values bound to a statement to NULL.
105
110
* @returns an sqlite error code
106
111
* @see sqlite3_clear_bindings()
108
113
int clear_bindings();
111
* Bind a value to the SQL statement via it's index. This template will take
112
* a variety of data types and bind them as text. This is how sqlite
116
* Bind a value to the SQL statement via it's index. This template will
117
* take a variety of data types and bind them as text. This is how sqlite
113
118
* internally stores the data anyway, so always binding as text just means
114
119
* we do the conversion instead of sqlite and is no less efficient.
115
121
* @param index the index of the parameter to bind to
116
122
* @param value the value to bind
117
123
* @returns an sqlite error code
131
137
* Bind a string value to the SQL statement via it's index where the value
132
* 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
138
* of that string will not change for the duration of the statement. This
139
* is more optimal because sqlite will not have to take it's own copy of the
135
142
* @param index the index of the parameter to bind to
136
143
* @param value the invariant string value
137
144
* @param value_length the length of the string including zero-terminator
147
154
* Bind a string value to the SQL statement via it's index where the value
148
* 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
155
* of that string will not change for the duration of the statement. This
156
* is more optimal because sqlite will not have to take it's own copy of the
151
159
* @param index the index of the parameter to bind to
152
160
* @param value the invariant string value
153
161
* @returns an sqlite error code
161
169
* Bind a string value to the SQL statement via it's index where the value
162
* 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
170
* of that string will not change for the duration of the statement. This
171
* is more optimal because sqlite will not have to take it's own copy of the
165
174
* @param index the index of the parameter to bind to
166
175
* @param value the invariant string value
167
176
* @returns an sqlite error code
181
191
unsigned int index );
184
* Bind a value to the SQL statement via a named parameter. This template
185
* will take a variety of data types and bind them as text. This is how
194
* Bind a value to the SQL statement via a named parameter. This template
195
* will take a variety of data types and bind them as text. This is how
186
196
* sqlite internally stores the data anyway, so always binding as text just
187
197
* means we do the conversion instead of sqlite and is no less efficient.
188
199
* @param name the named parameter to bind to
189
200
* @param value the value to bind
190
201
* @returns an sqlite error code
202
213
* Bind a string value to the SQL statement via a named parameter where the
203
* string value will not change for the duration of the statement. This
214
* string value will not change for the duration of the statement. This
204
215
* prevents sqlite from taking its own copy of the string.
205
217
* @param name the named parameter to bind to
206
218
* @param value the invariant string value
207
219
* @param value_length the length of the string including zero-terminator
217
229
* Bind a string value to the SQL statement via a named parameter where the
218
* string value will not change for the duration of the statement. This
230
* string value will not change for the duration of the statement. This
219
231
* prevents a copy of the string being taken.
220
233
* @param name the named parameter to bind to
221
234
* @param value the invariant string value
222
235
* @returns an sqlite error code
230
243
* Bind a string value to the SQL statement via a named parameter where the
231
* string value will not change for the duration of the statement. This
244
* string value will not change for the duration of the statement. This
232
245
* prevents a copy of the string being taken.
233
247
* @param name the named parameter to bind to
234
248
* @param value the invariant string value
235
249
* @returns an sqlite error code
252
267
* Stream operator is used to bind values to parameters automatically, in
253
* ascending order. In addition, the null and set_index() auto-binding
268
* ascending order. In addition, the null and set_index() auto-binding
254
269
* manipulators can be used.
255
271
* @param value a value to bind
257
273
template< class T >
274
290
* Finalise an SQL statement.
275
292
* @returns an sqlite error code
276
293
* @see sqlite3_finalize()
281
* Get the index number of a named parameter
298
* Get the index number of a named parameter.
282
300
* @param parameter name
283
301
* @return index of named parameter