@@ -121,6 +121,8 @@ class Statement
121
121
// instead of being copied.
122
122
// => if you know what you are doing, use bindNoCopy() instead of bind()
123
123
124
+ int getIndex (const char * const apName);
125
+
124
126
/* *
125
127
* @brief Bind an int value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
126
128
*/
@@ -206,11 +208,17 @@ class Statement
206
208
/* *
207
209
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
208
210
*/
209
- void bind (const char * apName, const int aValue);
211
+ void bind (const char * apName, const int aValue)
212
+ {
213
+ bind (getIndex (apName), aValue);
214
+ }
210
215
/* *
211
216
* @brief Bind a 32bits unsigned int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
212
217
*/
213
- void bind (const char * apName, const unsigned aValue);
218
+ void bind (const char * apName, const unsigned aValue)
219
+ {
220
+ bind (getIndex (apName), aValue);
221
+ }
214
222
215
223
#if (LONG_MAX == INT_MAX) // 4 bytes "long" type means the data model is ILP32 or LLP64 (Win64 Visual C++ and MinGW)
216
224
/* *
@@ -232,57 +240,84 @@ class Statement
232
240
/* *
233
241
* @brief Bind a 64bits int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
234
242
*/
235
- void bind (const char * apName, const long long aValue);
243
+ void bind (const char * apName, const long long aValue)
244
+ {
245
+ bind (getIndex (apName), aValue);
246
+ }
236
247
/* *
237
248
* @brief Bind a double (64bits float) value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
238
249
*/
239
- void bind (const char * apName, const double aValue);
250
+ void bind (const char * apName, const double aValue)
251
+ {
252
+ bind (getIndex (apName), aValue);
253
+ }
240
254
/* *
241
255
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
242
256
*
243
257
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
244
258
*/
245
- void bind (const char * apName, const std::string& aValue);
259
+ void bind (const char * apName, const std::string& aValue)
260
+ {
261
+ bind (getIndex (apName), aValue);
262
+ }
246
263
/* *
247
264
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
248
265
*
249
266
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
250
267
*/
251
- void bind (const char * apName, const char * apValue);
268
+ void bind (const char * apName, const char * apValue)
269
+ {
270
+ bind (getIndex (apName), apValue);
271
+ }
252
272
/* *
253
273
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
254
274
*
255
275
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
256
276
*/
257
- void bind (const char * apName, const void * apValue, const int aSize);
277
+ void bind (const char * apName, const void * apValue, const int aSize)
278
+ {
279
+ bind (getIndex (apName), apValue, aSize);
280
+ }
258
281
/* *
259
282
* @brief Bind a string value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
260
283
*
261
284
* The string can contain null characters as it is binded using its size.
262
285
*
263
286
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
264
287
*/
265
- void bindNoCopy (const char * apName, const std::string& aValue);
288
+ void bindNoCopy (const char * apName, const std::string& aValue)
289
+ {
290
+ bindNoCopy (getIndex (apName), aValue);
291
+ }
266
292
/* *
267
293
* @brief Bind a text value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
268
294
*
269
295
* Main usage is with null-terminated literal text (aka in code static strings)
270
296
*
271
297
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
272
298
*/
273
- void bindNoCopy (const char * apName, const char * apValue);
299
+ void bindNoCopy (const char * apName, const char * apValue)
300
+ {
301
+ bindNoCopy (getIndex (apName), apValue);
302
+ }
274
303
/* *
275
304
* @brief Bind a binary blob value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
276
305
*
277
306
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
278
307
*/
279
- void bindNoCopy (const char * apName, const void * apValue, const int aSize);
308
+ void bindNoCopy (const char * apName, const void * apValue, const int aSize)
309
+ {
310
+ bindNoCopy (getIndex (apName), apValue, aSize);
311
+ }
280
312
/* *
281
313
* @brief Bind a NULL value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
282
314
*
283
315
* @see clearBindings() to set all bound parameters to NULL.
284
316
*/
285
- void bind (const char * apName); // bind NULL value
317
+ void bind (const char * apName) // bind NULL value
318
+ {
319
+ bind (getIndex (apName));
320
+ }
286
321
287
322
288
323
/* *
0 commit comments