@@ -256,6 +256,83 @@ class Statement
256
256
* @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
257
257
*/
258
258
void bind (const int aIndex, const char * apValue);
259
+ #ifdef __cpp_unicode_characters
260
+ /* *
261
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
262
+ *
263
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
264
+ */
265
+ void bind (const int aIndex, const std::u16string& aValue);
266
+ #if WCHAR_MAX == 0xffff
267
+ /* *
268
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
269
+ *
270
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
271
+ */
272
+ void bind (const int aIndex, const std::wstring& aValue)
273
+ {
274
+ #ifdef __cpp_lib_string_view
275
+ bind (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
276
+ #else
277
+ bind (aIndex, std::u16string (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
278
+ #endif
279
+ }
280
+ #endif
281
+ #endif
282
+ #ifdef __cpp_lib_string_view
283
+ /* *
284
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
285
+ *
286
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
287
+ */
288
+ void bind (const int aIndex, const std::string_view aValue);
289
+ #ifdef __cpp_char8_t
290
+ /* *
291
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
292
+ *
293
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
294
+ */
295
+ void bind (const int aIndex, const std::u8string_view aValue)
296
+ {
297
+ bind (aIndex, std::string_view (reinterpret_cast <const char *>(aValue.data ()), aValue.size ()));
298
+ }
299
+ #endif
300
+ /* *
301
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
302
+ *
303
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
304
+ */
305
+ void bind (const int aIndex, const std::u16string_view aValue);
306
+ /* *
307
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
308
+ *
309
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
310
+ */
311
+ void bind (const int aIndex, const char16_t * aValue)
312
+ {
313
+ bind (aIndex, std::u16string_view (aValue));
314
+ }
315
+ #if WCHAR_MAX == 0xffff
316
+ /* *
317
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
318
+ *
319
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
320
+ */
321
+ void bind (const int aIndex, const wchar_t * aValue)
322
+ {
323
+ bind (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue)));
324
+ }
325
+ /* *
326
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
327
+ *
328
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
329
+ */
330
+ void bind (const int aIndex, const std::wstring_view aValue)
331
+ {
332
+ bind (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
333
+ }
334
+ #endif
335
+ #endif
259
336
/* *
260
337
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
261
338
*
@@ -278,6 +355,95 @@ class Statement
278
355
* @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
279
356
*/
280
357
void bindNoCopy (const int aIndex, const char * apValue);
358
+ #ifdef __cpp_unicode_characters
359
+ /* *
360
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
361
+ *
362
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
363
+ */
364
+ void bindNoCopy (const int aIndex, const std::u16string& aValue);
365
+ #if WCHAR_MAX == 0xffff
366
+ /* *
367
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
368
+ *
369
+ * @note Uses the SQLITE_TRANSIENT flag, making a copy of the data, for SQLite internal use
370
+ */
371
+ void bindNoCopy (const int aIndex, const std::wstring& aValue)
372
+ {
373
+ #if __cpp_lib_string_view
374
+ bindNoCopy (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
375
+ #else
376
+ bindNoCopy (aIndex, std::u16string (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
377
+ #endif
378
+ }
379
+ #endif
380
+ #endif
381
+ #if __cpp_lib_string_view
382
+ /* *
383
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
384
+ *
385
+ * The string can contain null characters as it is binded using its size.
386
+ *
387
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
388
+ */
389
+ void bindNoCopy (const int aIndex, const std::string_view aValue);
390
+ #ifdef __cpp_char8_t
391
+ /* *
392
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
393
+ *
394
+ * The string can contain null characters as it is binded using its size.
395
+ *
396
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
397
+ */
398
+ void bindNoCopy (const int aIndex, const std::u8string_view aValue)
399
+ {
400
+ bindNoCopy (aIndex, std::string_view (reinterpret_cast <const char *>(aValue.data ()), aValue.size ()));
401
+ }
402
+ #endif
403
+ /* *
404
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
405
+ *
406
+ * The string can contain null characters as it is binded using its size.
407
+ *
408
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
409
+ */
410
+ void bindNoCopy (const int aIndex, const std::u16string_view aValue);
411
+ /* *
412
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
413
+ *
414
+ * The string can contain null characters as it is binded using its size.
415
+ *
416
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
417
+ */
418
+ void bindNoCopy (const int aIndex, const char16_t * aValue)
419
+ {
420
+ bindNoCopy (aIndex, std::u16string_view (aValue));
421
+ }
422
+ #if WCHAR_MAX == 0xffff
423
+ /* *
424
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
425
+ *
426
+ * The string can contain null characters as it is binded using its size.
427
+ *
428
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
429
+ */
430
+ void bindNoCopy (const int aIndex, const wchar_t * aValue)
431
+ {
432
+ bindNoCopy (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue)));
433
+ }
434
+ /* *
435
+ * @brief Bind a string value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1).
436
+ *
437
+ * The string can contain null characters as it is binded using its size.
438
+ *
439
+ * @warning Uses the SQLITE_STATIC flag, avoiding a copy of the data. The string must remains unchanged while executing the statement.
440
+ */
441
+ void bindNoCopy (const int aIndex, const std::wstring_view aValue)
442
+ {
443
+ bindNoCopy (aIndex, std::u16string_view (reinterpret_cast <const char16_t *>(aValue.data ()), aValue.size ()));
444
+ }
445
+ #endif
446
+ #endif
281
447
/* *
282
448
* @brief Bind a binary blob value to a parameter "?", "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
283
449
*
@@ -291,6 +457,28 @@ class Statement
291
457
*/
292
458
void bind (const int aIndex);
293
459
460
+ template <typename T>
461
+ inline void bind (const char * apName, T&& aValue)
462
+ {
463
+ bind (getIndex (apName), std::forward<T>(aValue));
464
+ }
465
+ template <typename T>
466
+ inline void bindNoCopy (const char * apName, T&& aValue)
467
+ {
468
+ bindNoCopy (getIndex (apName), std::forward<T>(aValue));
469
+ }
470
+ template <typename T>
471
+ inline void bind (const std::string& aName, T&& aValue)
472
+ {
473
+ bind (getIndex (aName.c_str ()), std::forward<T>(aValue));
474
+ }
475
+ template <typename T>
476
+ inline void bindNoCopy (const std::string& aName, T&& aValue)
477
+ {
478
+ bindNoCopy (getIndex (aName.c_str ()), std::forward<T>(aValue));
479
+ }
480
+
481
+
294
482
/* *
295
483
* @brief Bind an int value to a named parameter "?NNN", ":VVV", "@VVV" or "$VVV" in the SQL prepared statement (aIndex >= 1)
296
484
*/
0 commit comments