View on GitHub API Documentation
A small C++ wrapper for the native C ODBC API.
Functions
Binding multiple string values

Binds given string values to parameter marker in prepared statement. More...

Functions

void nanodbc::statement::bind_strings (short param_index, string::value_type const *values, std::size_t value_size, std::size_t batch_size, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
void nanodbc::statement::bind_strings (short param_index, std::vector< string > const &values, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings (short param_index, string::value_type const (&values)[BatchSize][ValueSize], param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
void nanodbc::statement::bind_strings (short param_index, string::value_type const *values, std::size_t value_size, std::size_t batch_size, string::value_type const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
void nanodbc::statement::bind_strings (short param_index, std::vector< string > const &values, string::value_type const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings (short param_index, string::value_type const (&values)[BatchSize][ValueSize], string::value_type const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
void nanodbc::statement::bind_strings (short param_index, string::value_type const *values, std::size_t value_size, std::size_t batch_size, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
void nanodbc::statement::bind_strings (short param_index, std::vector< string > const &values, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 
template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings (short param_index, string::value_type const (&values)[BatchSize][ValueSize], bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values. More...
 

Detailed Description

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 these functions for batch operations.

Parameters
param_indexZero-based index of parameter marker (placeholder position).
valuesArray of values to substitute into parameter placeholders.
value_sizeMaximum length of string value in array.
batch_sizeNumber of string values to bind. Otherwise template parameter BatchSize is taken as the number of values.
null_sentryValue which should represent a null value.
nullsFlags for values that should be set to a null value.
param_direcitonODBC parameter direction.
Exceptions
database_error

Function Documentation

◆ bind_strings() [1/9]

void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const *  values,
std::size_t  value_size,
std::size_t  batch_size,
param_direction  direction = PARAM_IN 
)
See also
bind_strings

◆ bind_strings() [2/9]

void nanodbc::statement::bind_strings ( short  param_index,
std::vector< string > const &  values,
param_direction  direction = PARAM_IN 
)

Size of the values vector indicates number of values to bind. Longest string in the array determines maximum length of individual value.

See also
bind_strings

◆ bind_strings() [3/9]

template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const (&)  values[BatchSize][ValueSize],
param_direction  direction = PARAM_IN 
)
inline
See also
bind_strings

◆ bind_strings() [4/9]

void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const *  values,
std::size_t  value_size,
std::size_t  batch_size,
string::value_type const *  null_sentry,
param_direction  direction = PARAM_IN 
)
See also
bind_strings

◆ bind_strings() [5/9]

void nanodbc::statement::bind_strings ( short  param_index,
std::vector< string > const &  values,
string::value_type const *  null_sentry,
param_direction  direction = PARAM_IN 
)
See also
bind_strings

◆ bind_strings() [6/9]

template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const (&)  values[BatchSize][ValueSize],
string::value_type const *  null_sentry,
param_direction  direction = PARAM_IN 
)
inline
See also
bind_strings

◆ bind_strings() [7/9]

void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const *  values,
std::size_t  value_size,
std::size_t  batch_size,
bool const *  nulls,
param_direction  direction = PARAM_IN 
)
See also
bind_strings

◆ bind_strings() [8/9]

void nanodbc::statement::bind_strings ( short  param_index,
std::vector< string > const &  values,
bool const *  nulls,
param_direction  direction = PARAM_IN 
)
See also
bind_strings

◆ bind_strings() [9/9]

template<std::size_t BatchSize, std::size_t ValueSize>
void nanodbc::statement::bind_strings ( short  param_index,
string::value_type const (&)  values[BatchSize][ValueSize],
bool const *  nulls,
param_direction  direction = PARAM_IN 
)
inline
See also
bind_strings