31#ifndef DOXYGEN_SHOULD_SKIP_THIS
48 if (connexion.connected()) {
49 _result_ = nanodbc::execute(connexion, query);
50 _data_.resize(std::size_t(_result_.columns()));
78 if (_result_.next()) {
79 const std::size_t nb_cols = std::size_t(_result_.columns());
81 for (std::size_t i = 0; i < nb_cols; ++i) {
84 const int type = _result_.column_datatype(pos);
90 if ((type >= SQL_NUMERIC) && (type <= SQL_DOUBLE)) {
91 snprintf(str, 100,
"%g", _result_.get<
float >(pos));
94 _data_[i] = _result_.get< std::string >(pos);
96 }
catch (nanodbc::null_access_error& e) { _data_[i] =
"NULL"; }
101 }
catch (std::runtime_error& e) {
GUM_ERROR(DatabaseError, std::string(e.what())) }
108 _result_ = nanodbc::execute(connexion, query);
109 _data_.resize(std::size_t(_result_.columns()));
110 _nb_line_ = std::size_t(0);
virtual ~NanodbcParser()
destructor
bool next()
Gets the next line of the SQL stream and parses it.
NanodbcParser()
Default constructor: create a parser without being connected.
void useNewQuery(nanodbc::connection &connexion, const std::string &query)
start a new query
#define GUM_ERROR(type, msg)
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
Class for parsing SQL results using Nanodbc.
Class for parsing SQL results using Nanodbc.