nanodbc
A small C++ wrapper for the native C ODBC API
Loading...
Searching...
No Matches
nanodbc::detail Namespace Reference

Implementation details, not part of the interface. More...

Classes

struct  bind_as_optional_string
 
struct  bind_as_optional_value
 
struct  bind_as_string
 
struct  bind_as_value
 
struct  bind_kind
 
struct  bind_kind< T, true >
 
struct  field_type
 The type an accessor yields for a row, stripped of reference and const. More...
 
struct  is_optional
 
struct  is_optional< std::optional< T > >
 

Functions

template<class T >
std::unique_ptr< bool[]> split_optional (std::vector< std::optional< T > > const &values, std::vector< T > &column)
 Splits optionals into the values themselves and flags saying which are null.
 
template<class Row , class Member , class Class >
Member const & read_field (Row const &row, Member Class::*field)
 Reads a member through a pointer to it.
 
template<class Row , class Accessor >
auto read_field (Row const &row, Accessor const &accessor) -> decltype(accessor(row))
 Reads a value by calling something with the row.
 
template<class Rows , class Accessor >
void bind_column (statement &stmt, short param_index, Rows const &rows, Accessor const &accessor, bind_as_value)
 
template<class Rows , class Accessor >
void bind_column (statement &stmt, short param_index, Rows const &rows, Accessor const &accessor, bind_as_string)
 
template<class Rows , class Accessor , class Column >
std::unique_ptr< bool[]> gather_optional (Rows const &rows, Accessor const &accessor, Column &column)
 
template<class Rows , class Accessor >
void bind_column (statement &stmt, short param_index, Rows const &rows, Accessor const &accessor, bind_as_optional_value)
 
template<class Rows , class Accessor >
void bind_column (statement &stmt, short param_index, Rows const &rows, Accessor const &accessor, bind_as_optional_string)
 
template<class Rows , class Accessor >
void bind_one (statement &stmt, short param_index, Rows const &rows, Accessor const &accessor)
 

Variables

template<class T >
constexpr bool is_optional_v = is_optional<T>::value
 

Detailed Description

Implementation details, not part of the interface.

Function Documentation

◆ split_optional()

template<class T >
std::unique_ptr< bool[]> nanodbc::detail::split_optional ( std::vector< std::optional< T > > const &  values,
std::vector< T > &  column 
)
protected

Splits optionals into the values themselves and flags saying which are null.

An absent value still takes up its place in the column, so that the values line up with the flags marking which of them are null. What fills that place is never read.

Parameters
valuesThe optionals to split.
columnReceives one value per optional, in order.
Returns
One flag per optional, true where the value was absent.