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

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

Collaboration diagram for Binding multiple string values:

Functions

template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, std::vector< T > const &values)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize])
 Binds multiple string values.
 
template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size, T const *null_sentry)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, std::vector< T > const &values, typename T::value_type const *null_sentry)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize], T const *null_sentry)
 Binds multiple string values.
 
template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size, bool const *nulls)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, std::vector< T > const &values, bool const *nulls)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize], bool const *nulls)
 Binds multiple string values.
 
template<class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::statement::bind_strings (short param_index, std::vector< T > const &values, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize], param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size, T const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::statement::bind_strings (short param_index, std::vector< T > const &values, typename T::value_type const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize], T const *null_sentry, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const *values, std::size_t value_size, std::size_t batch_size, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::statement::bind_strings (short param_index, std::vector< T > const &values, bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings (short param_index, T const (&values)[BatchSize][ValueSize], bool const *nulls, param_direction direction=PARAM_IN)
 Binds multiple string values.
 
template<class T , typename = enable_if_string<T>>
void nanodbc::statement::bind_strings (short param_index, std::vector< std::optional< T > > const &values, param_direction direction=PARAM_IN)
 Binds a batch of strings, any of which may be absent and bound as null.
 

Detailed Description

Binds given string values to parameter marker in 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).
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. 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.
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).
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_directionODBC parameter direction.
Exceptions
database_error

Function Documentation

◆ bind_strings() [1/19]

template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const *  values,
std::size_t  value_size,
std::size_t  batch_size 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [2/19]

template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
std::vector< T > const &  values 
)

Binds multiple string values.

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/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize] 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [4/19]

template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const *  values,
std::size_t  value_size,
std::size_t  batch_size,
T const *  null_sentry 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [5/19]

template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
std::vector< T > const &  values,
typename T::value_type const *  null_sentry 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [6/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize],
T const *  null_sentry 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [7/19]

template<class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const *  values,
std::size_t  value_size,
std::size_t  batch_size,
bool const *  nulls 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [8/19]

template<class T , typename = enable_if_string<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
std::vector< T > const &  values,
bool const *  nulls 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [9/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::table_valued_parameter::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize],
bool const *  nulls 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [10/19]

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

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [11/19]

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

Binds multiple string values.

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() [12/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize],
param_direction  direction = PARAM_IN 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [13/19]

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

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [14/19]

template<class T , typename = enable_if_string<T>>
void nanodbc::statement::bind_strings ( short  param_index,
std::vector< T > const &  values,
typename T::value_type const *  null_sentry,
param_direction  direction = PARAM_IN 
)

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [15/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize],
T const *  null_sentry,
param_direction  direction = PARAM_IN 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [16/19]

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

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [17/19]

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

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [18/19]

template<std::size_t BatchSize, std::size_t ValueSize, class T , typename = enable_if_character<T>>
void nanodbc::statement::bind_strings ( short  param_index,
T const (&)  values[BatchSize][ValueSize],
bool const *  nulls,
param_direction  direction = PARAM_IN 
)
inline

Binds multiple string values.

See also
bind_strings

◆ bind_strings() [19/19]

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

Binds a batch of strings, 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 strings are copied, so the vector is free to go out of scope before the statement is executed.

std::vector<std::optional<nanodbc::string>> const names{
NANODBC_TEXT("ada"), std::nullopt};
stmt.bind_strings(0, names); // the second row binds null
#define NANODBC_TEXT(s)
Creates a string literal of the type corresponding to nanodbc::string.
Definition nanodbc.h:220
Parameters
param_indexZero-based index of parameter marker (placeholder position).
valuesThe strings to bind, an absent one binding null.
directionODBC parameter direction.
Exceptions
database_error
See also
bind_strings