123
124
template< class T >
125
126
unsigned int index,
128
// bind as text (applying the type affinity of the underlying column)
129
129
std::string string_value = boost::lexical_cast< std::string >( value );
130
130
return sqlite3_bind_text( _handle, index, string_value.c_str(),
131
131
string_value.length(), SQLITE_TRANSIENT );
135
* Bind a value to the SQL statement via a named parameter.
135
* Bind a string value to the SQL statement via it's index where the value
136
* of that string will not change for the duration of the statement. This
137
* is more optimal because sqlite will not have to take it's own copy of the
140
* @param index the index of the parameter to bind to
141
* @param value the invariant string value
142
* @param value_length the length of the string including zero-terminator
143
* @returns an sqlite error code
144
* @see sqlite3_bind_text()
149
unsigned int value_length );
152
* Bind a string value to the SQL statement via it's index where the value
153
* of that string will not change for the duration of the statement. This
154
* is more optimal because sqlite will not have to take it's own copy of the
157
* @param index the index of the parameter to bind to
158
* @param value the invariant string value
159
* @returns an sqlite error code
160
* @see sqlite3_bind_text()
167
* Bind a string value to the SQL statement via it's index where the value
168
* of that string will not change for the duration of the statement. This
169
* is more optimal because sqlite will not have to take it's own copy of the
172
* @param index the index of the parameter to bind to
173
* @param value the invariant string value
174
* @returns an sqlite error code
175
* @see sqlite3_bind_text()
179
const std::string &value );
182
* Bind a NULL value to the SQL statement via it's index.
184
* @param index the index of the parameter to bind to
185
* @returns an sqlite error code
186
* @see sqlite3_bind_null()
189
unsigned int index );
192
* Bind a value to the SQL statement via a named parameter. This template
193
* will take a variety of data types and bind them as text. This is how
194
* sqlite internally stores the data anyway, so always binding as text just
195
* means we do the conversion instead of sqlite and is no less efficient.
137
197
* @param name the named parameter to bind to
138
198
* @param value the value to bind
142
202
template< class T >
144
204
const std::string &name,
147
207
return bind( bind_parameter_index( name ), value );
211
* Bind a string value to the SQL statement via a named parameter where the
212
* string value will not change for the duration of the statement. This
213
* prevents sqlite from taking its own copy of the string.
215
* @param name the named parameter to bind to
216
* @param value the invariant string value
217
* @param value_length the length of the string including zero-terminator
218
* @returns an sqlite error code
219
* @see sqlite3_bind_text()
222
const std::string &name,
224
unsigned int value_length );
227
* Bind a string value to the SQL statement via a named parameter where the
228
* string value will not change for the duration of the statement. This
229
* prevents a copy of the string being taken.
231
* @param name the named parameter to bind to
232
* @param value the invariant string value
233
* @returns an sqlite error code
234
* @see sqlite3_bind_text()
237
const std::string &name,
241
* Bind a string value to the SQL statement via a named parameter where the
242
* string value will not change for the duration of the statement. This
243
* prevents a copy of the string being taken.
245
* @param name the named parameter to bind to
246
* @param value the invariant string value
247
* @returns an sqlite error code
248
* @see sqlite3_bind_text()
251
const std::string &name,
252
const std::string &value );
255
* Bind a NULL value to the SQL statement via a named parameter.
257
* @param name the named parameter to bind to
258
* @returns an sqlite error code
259
* @see sqlite3_bind_null()
262
const std::string &name );
151
265
* Stream operator is used to bind values to parameters automatically, in
152
266
* ascending order. In addition, the null and set_index() auto-binding
153
267
* manipulators can be used.
168
* Bind a string value to the SQL statement via it's index where the value
169
* of that string will not change for the duration of the statement. This
170
* is more optimal because sqlite will not have to take it's own copy of the
173
* @param index the index of the parameter to bind to
174
* @param value the invariant string value
175
* @param value_length the length of the string including zero-terminator
176
* @returns an sqlite error code
177
* @see sqlite3_bind_text()
182
unsigned int value_length );
185
* Bind a string value to the SQL statement via it's index where the value
186
* of that string will not change for the duration of the statement. This
187
* is more optimal because sqlite will not have to take it's own copy of the
190
* @param index the index of the parameter to bind to
191
* @param value the invariant string value
192
* @returns an sqlite error code
193
* @see sqlite3_bind_text()
200
* Bind a string value to the SQL statement via it's index where the value
201
* of that string will not change for the duration of the statement. This
202
* is more optimal because sqlite will not have to take it's own copy of the
205
* @param index the index of the parameter to bind to
206
* @param value the invariant string value
207
* @returns an sqlite error code
208
* @see sqlite3_bind_text()
212
const std::string &value );
215
* Bind a string value to the SQL statement via a named parameter where the
216
* string value will not change for the duration of the statement. This
217
* prevents sqlite from taking its own copy of the string.
219
* @param name the named parameter to bind to
220
* @param value the invariant string value
221
* @param value_length the length of the string including zero-terminator
222
* @returns an sqlite error code
223
* @see sqlite3_bind_text()
226
const std::string &name,
228
unsigned int value_length );
231
* Bind a string value to the SQL statement via a named parameter where the
232
* string value will not change for the duration of the statement. This
233
* prevents a copy of the string being taken.
235
* @param name the named parameter to bind to
236
* @param value the invariant string value
237
* @returns an sqlite error code
238
* @see sqlite3_bind_text()
241
const std::string &name,
245
* Bind a string value to the SQL statement via a named parameter where the
246
* string value will not change for the duration of the statement. This
247
* prevents a copy of the string being taken.
249
* @param name the named parameter to bind to
250
* @param value the invariant string value
251
* @returns an sqlite error code
252
* @see sqlite3_bind_text()
255
const std::string &name,
256
const std::string &value );
259
* Bind a NULL value to the SQL statement via it's index.
261
* @param index the index of the parameter to bind to
262
* @returns an sqlite error code
263
* @see sqlite3_bind_null()
266
unsigned int index );
269
* Bind a NULL value to the SQL statement via a named parameter.
271
* @param name the named parameter to bind to
272
* @returns an sqlite error code
273
* @see sqlite3_bind_null()
276
const std::string &name );
279
* Bind a string value as a blob to the SQL statement via its index.
281
* @param name the named parameter to bind to
282
* @param value the blob data value
283
* @param value_length the length of the blob data
284
* @returns an sqlite error code
285
* @see sqlite3_bind_blob()
290
unsigned int value_length );
293
* Bind a string value as a blob to the SQL statement via its index.
295
* @param name the named parameter to bind to
296
* @param value the blob data value
297
* @returns an sqlite error code
298
* @see sqlite3_bind_blob()
302
const std::string &value );
305
* Bind a string value as a blob to the SQL statement via a named parameter.
307
* @param name the named parameter to bind to
308
* @param value the blob data value
309
* @param value_length the length of the blob data
310
* @returns an sqlite error code
311
* @see sqlite3_bind_blob()
314
const std::string &name,
316
unsigned int value_length );
319
* Bind a string value as a blob to the SQL statement via a named parameter.
321
* @param name the named parameter to bind to
322
* @param value the blob data value
323
* @returns an sqlite error code
324
* @see sqlite3_bind_blob()
327
const std::string &name,
328
const std::string &value );
330
281
//______________________________________________________________________________
331
282
// implementation