|
nanodbc
A small C++ wrapper for the native C ODBC API
|
Reads values from columns of the current rowset. More...
Functions | |
| template<class T > | |
| void | nanodbc::result::get_ref (short column, T &result) const |
| Gets data from the given column of the current rowset. | |
| template<class T > | |
| void | nanodbc::result::get_ref (short column, T const &fallback, T &result) const |
| Gets data from the given column of the current rowset. | |
| template<class T > | |
| void | nanodbc::result::get_ref (string const &column_name, T &result) const |
| Gets data from the given column by name of the current rowset. | |
| template<class T > | |
| void | nanodbc::result::get_ref (string const &column_name, T const &fallback, T &result) const |
| Gets data from the given column by name of the current rowset. | |
| template<class T > | |
| T | nanodbc::result::get (short column) const |
| Gets data from the given column of the current rowset. | |
| template<class T > | |
| T | nanodbc::result::get (short column, T const &fallback) const |
| Gets data from the given column of the current rowset. | |
| template<class T > | |
| T | nanodbc::result::get_as (short column) const |
| Reads a column as whatever it holds, into a type able to hold any of them. | |
| template<class T > | |
| T | nanodbc::result::get_as (string const &column_name) const |
| Reads a column by name as whatever it holds. | |
| template<class T > | |
| T | nanodbc::result::get (string const &column_name) const |
| Gets data from the given column by name of the current rowset. | |
| template<class T > | |
| T | nanodbc::result::get (string const &column_name, T const &fallback) const |
| Gets data from the given column by name of the current rowset. | |
Reads values from columns of the current rowset.
| void nanodbc::result::get_ref | ( | short | column, |
| T & | result | ||
| ) | const |
Gets data from the given column of the current rowset.
Columns are numbered from left to right and 0-indexed.
| column | position. |
| result | The column's value will be written to this parameter. |
| void nanodbc::result::get_ref | ( | short | column, |
| T const & | fallback, | ||
| T & | result | ||
| ) | const |
Gets data from the given column of the current rowset.
If the data is null, fallback is returned instead.
Columns are numbered from left to right and 0-indexed.
| column | position. |
| fallback | if value is null, return fallback instead. |
| result | The column's value will be written to this parameter. |
| void nanodbc::result::get_ref | ( | string const & | column_name, |
| T & | result | ||
| ) | const |
Gets data from the given column by name of the current rowset.
| column_name | column's name. |
| result | The column's value will be written to this parameter. |
| void nanodbc::result::get_ref | ( | string const & | column_name, |
| T const & | fallback, | ||
| T & | result | ||
| ) | const |
Gets data from the given column by name of the current rowset.
If the data is null, fallback is returned instead.
| column_name | column's name. |
| fallback | if value is null, return fallback instead. |
| result | The column's value will be written to this parameter. |
| T nanodbc::result::get | ( | short | column | ) | const |
Gets data from the given column of the current rowset.
Columns are numbered from left to right and 0-indexed.
| column | position. |
T may be std::any, which is filled according to what the column says it holds rather than what the caller asks for. A null column gives an any holding nothing.
| T nanodbc::result::get | ( | short | column, |
| T const & | fallback | ||
| ) | const |
Gets data from the given column of the current rowset.
If the data is null, fallback is returned instead.
Columns are numbered from left to right and 0-indexed.
| column | position. |
| fallback | if value is null, return fallback instead. |
| T nanodbc::result::get_as | ( | short | column | ) | const |
Reads a column as whatever it holds, into a type able to hold any of them.
Where get() reads a column as the type the caller names, converting where it can, this reads it as the type the column says it is and hands back a T holding that. T may be std::any, or a std::variant naming the alternatives to choose between.
A null column gives a T built from nothing: an any holding nothing, or a variant on its first alternative, which is what std::monostate is for.
| column | position. |
| database_error | |
| index_range_error | |
| type_incompatible_error | if the column holds something T cannot. |
| T nanodbc::result::get_as | ( | string const & | column_name | ) | const |
Reads a column by name as whatever it holds.
| T nanodbc::result::get | ( | string const & | column_name | ) | const |
Gets data from the given column by name of the current rowset.
| column_name | column's name. |
| T nanodbc::result::get | ( | string const & | column_name, |
| T const & | fallback | ||
| ) | const |
Gets data from the given column by name of the current rowset.
If the data is null, fallback is returned instead.
| column_name | column's name. |
| fallback | if value is null, return fallback instead. |