View on GitHub API Documentation
A small C++ wrapper for the native C ODBC API.
Modules | Functions
Binding parameters

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. More...
 
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. More...
 

Detailed Description

Function Documentation

◆ bind()

template<class T >
void nanodbc::statement::bind ( short  param_index,
T const *  value,
param_direction  direction = PARAM_IN 
)

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.

Parameters
param_indexZero-based index of parameter marker (placeholder position).
valueValue to substitute into placeholder.
directionODBC parameter direction.
Exceptions
database_error

◆ bind_null()

void nanodbc::statement::bind_null ( short  param_index,
std::size_t  batch_size = 1 
)

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.

Parameters
param_indexZero-based index of parameter marker (placeholder position).
batch_sizeThe number of elements being bound.
Exceptions
database_error