nanodbc
A small C++ wrapper for the native C ODBC API
Loading...
Searching...
No Matches
Binding multiple non-string values

Binds given values to given parameter placeholder number in the prepared statement. More...

Collaboration diagram for Binding multiple non-string values:

Functions

template<class T >
void nanodbc::table_valued_parameter::bind (short param_index, T const *values, std::size_t batch_size)
 Binds multiple values.
 
template<class T >
void nanodbc::table_valued_parameter::bind (short param_index, T const *values, std::size_t batch_size, T const *null_sentry)
 Binds multiple values.
 
template<class T >
void nanodbc::table_valued_parameter::bind (short param_index, T const *values, std::size_t batch_size, bool const *nulls)
 Binds multiple values.
 
void nanodbc::table_valued_parameter::bind (short param_index, std::vector< std::vector< uint8_t > > const &values)
 Binds multiple values.
 
void nanodbc::table_valued_parameter::bind (short param_index, std::vector< std::vector< uint8_t > > const &values, bool const *nulls)
 Binds multiple values.
 
void nanodbc::table_valued_parameter::bind (short param_index, std::vector< std::vector< uint8_t > > const &values, uint8_t const *null_sentry)
 Binds multiple values.
 
template<class T >
void nanodbc::statement::bind (short param_index, T const *values, std::size_t batch_size, param_direction direction=PARAM_IN)
 Binds multiple values.
 
template<class T >
void nanodbc::statement::bind (short param_index, T const *values, std::size_t batch_size, T const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple values.
 
template<class T >
void nanodbc::statement::bind (short param_index, T const *values, std::size_t batch_size, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple values.
 
void nanodbc::statement::bind (short param_index, std::vector< std::vector< uint8_t > > const &values, param_direction direction=PARAM_IN)
 Binds multiple values.
 
void nanodbc::statement::bind (short param_index, std::vector< std::vector< uint8_t > > const &values, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple values.
 
void nanodbc::statement::bind (short param_index, std::vector< std::vector< uint8_t > > const &values, uint8_t const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple values.
 
template<class T >
void nanodbc::statement::bind (short param_index, std::vector< T > const &values, param_direction direction=PARAM_IN)
 Binds multiple values, holding a copy of them.
 
template<class T >
void nanodbc::statement::bind (short param_index, std::vector< T > const &values, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple values, holding a copy of them.
 
template<class T >
void nanodbc::statement::bind (short param_index, std::vector< std::optional< T > > const &values, param_direction direction=PARAM_IN)
 Binds a batch of values, any of which may be absent and bound as null.
 

Detailed Description

Binds given values to given 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 these functions for batch operations.

Parameters
param_indexZero-based index of parameter marker (placeholder position).
valuesValues to substitute into placeholder.
batch_sizeThe number of values being bound. batch_size should greater or equal than row_count
null_sentryValue which should represent a null value.
nullsFlags for values that should be set to a null value.
param_directionODBC parameter direction.
Exceptions
database_error

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).
valuesValues to substitute into placeholder.
batch_sizeThe number of values being bound.
null_sentryValue which should represent a null value.
nullsFlags for values that should be set to a null value.
param_directionODBC parameter direction.
Exceptions
database_error

Function Documentation

◆ bind() [1/15]

template<class T >
void nanodbc::table_valued_parameter::bind ( short  param_index,
T const *  values,
std::size_t  batch_size 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [2/15]

template<class T >
void nanodbc::table_valued_parameter::bind ( short  param_index,
T const *  values,
std::size_t  batch_size,
T const *  null_sentry 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [3/15]

template<class T >
void nanodbc::table_valued_parameter::bind ( short  param_index,
T const *  values,
std::size_t  batch_size,
bool const *  nulls 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [4/15]

void nanodbc::table_valued_parameter::bind ( short  param_index,
std::vector< std::vector< uint8_t > > const &  values 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [5/15]

void nanodbc::table_valued_parameter::bind ( short  param_index,
std::vector< std::vector< uint8_t > > const &  values,
bool const *  nulls 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [6/15]

void nanodbc::table_valued_parameter::bind ( short  param_index,
std::vector< std::vector< uint8_t > > const &  values,
uint8_t const *  null_sentry 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [7/15]

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

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [8/15]

template<class T >
void nanodbc::statement::bind ( short  param_index,
T const *  values,
std::size_t  batch_size,
T const *  null_sentry,
param_direction  direction = PARAM_IN 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [9/15]

template<class T >
void nanodbc::statement::bind ( short  param_index,
T const *  values,
std::size_t  batch_size,
bool const *  nulls,
param_direction  direction = PARAM_IN 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [10/15]

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

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [11/15]

void nanodbc::statement::bind ( short  param_index,
std::vector< std::vector< uint8_t > > const &  values,
bool const *  nulls,
param_direction  direction = PARAM_IN 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [12/15]

void nanodbc::statement::bind ( short  param_index,
std::vector< std::vector< uint8_t > > const &  values,
uint8_t const *  null_sentry,
param_direction  direction = PARAM_IN 
)

Binds multiple values.

See also
Binding multiple non-string values

◆ bind() [13/15]

template<class T >
void nanodbc::statement::bind ( short  param_index,
std::vector< T > const &  values,
param_direction  direction = PARAM_IN 
)

Binds multiple values, holding a copy of them.

The overloads taking a pointer bind the caller's buffer, which has to stay alive and unchanged until the statement has been executed. These take a copy instead, so the vector is free to go out of scope.

See also
Binding multiple non-string values

◆ bind() [14/15]

template<class T >
void nanodbc::statement::bind ( short  param_index,
std::vector< T > const &  values,
bool const *  nulls,
param_direction  direction = PARAM_IN 
)

Binds multiple values, holding a copy of them.

See also
Binding multiple non-string values

◆ bind() [15/15]

template<class T >
void nanodbc::statement::bind ( short  param_index,
std::vector< std::optional< T > > const &  values,
param_direction  direction = PARAM_IN 
)
inline

Binds a batch of values, any of which may be absent and bound as null.

Where the overload taking a flags array asks the caller to keep the values and the flags in step, this reads both out of the one vector. The values are copied, so the vector is free to go out of scope before the statement is executed.

std::vector<std::optional<int>> const ages{31, std::nullopt, 47};
stmt.bind(0, ages); // the middle row binds null
Parameters
param_indexZero-based index of parameter marker (placeholder position).
valuesThe values to bind, an absent one binding null.
directionODBC parameter direction.
Exceptions
database_error
See also
Binding multiple non-string values