|
nanodbc
A small C++ wrapper for the native C ODBC API
|
These functions are used to bind values to ODBC parameters. More...

Modules | |
| Binding multiple non-string values | |
| Binds given values to given parameter placeholder number in the prepared statement. | |
| Binding multiple string values | |
| Binds given string values to parameter marker in prepared statement. | |
Functions | |
| template<class T > | |
| void | nanodbc::statement::bind (short param_index, T const *value, param_direction direction=PARAM_IN) |
| Binds given value to given parameter placeholder number in the prepared statement. | |
| void | nanodbc::statement::bind_null (short param_index, std::size_t batch_size=1) |
| Binds null values to the parameter placeholder number in the prepared statement. | |
These functions are used to bind values to ODBC parameters.
T const* and the null flags overload takes bool const*, so for T=bool the two collapse into one signature that neither an explicit instantiation nor a call can choose between. Bind nullable booleans as a wider integral type instead. | void nanodbc::statement::bind | ( | short | param_index, |
| T const * | value, | ||
| param_direction | direction = PARAM_IN |
||
| ) |
Binds given value to given parameter placeholder number in the prepared statement.
If your prepared SQL query has any ? placeholders, this is how you bind values to them. Placeholder numbers count from left to right and are 0-indexed.
It is NOT possible to use these functions for batch operations as number of elements is not specified here.
| param_index | Zero-based index of parameter marker (placeholder position). |
| value | Value to substitute into placeholder. |
| direction | ODBC parameter direction. |
| database_error |
| void nanodbc::statement::bind_null | ( | short | param_index, |
| std::size_t | batch_size = 1 |
||
| ) |
Binds null values to the parameter placeholder number in the prepared statement.
If your prepared SQL query has any parameter markers, ? (question mark) placeholders, this is how you bind values to them. Parameter markers are numbered using Zero-based index from left to right.
It is possible to use this function for batch operations.
| param_index | Zero-based index of parameter marker (placeholder position). |
| batch_size | The number of elements being bound. |
| database_error |