7#include <unordered_map>
8#include "UniSetTypes.h"
23 virtual bool connect(
const std::string& param ) = 0;
24 virtual bool close() = 0;
25 virtual bool isConnection()
const = 0;
26 virtual bool ping()
const = 0;
28 virtual DBResult query(
const std::string& q ) = 0;
29 virtual void cancel_query() {};
30 virtual const std::string lastQuery() = 0;
31 virtual bool insert(
const std::string& q ) = 0;
32 virtual double insert_id() = 0;
33 virtual const std::string error() = 0;
44 virtual bool connect(
const std::string& param );
45 virtual bool nconnect(
const std::string& host,
const std::string& user,
const std::string& pswd,
46 const std::string& dbname,
unsigned int port ) = 0;
58 typedef std::vector<std::string> COL;
59 typedef std::deque<COL> ROW;
65 operator bool()
const;
70 void setColName(
int index,
const std::string& name );
76 std::string getColName(
int index );
80 static int as_int(
const DBResult::COL::iterator& it );
81 static double as_double(
const DBResult::COL::iterator& it );
82 static std::string as_string(
const DBResult::COL::iterator& it );
90 std::unordered_map<std::string, int> colname;
97 using iterator_category = std::bidirectional_iterator_tag;
98 using value_type = DBResult::ROW::value_type;
99 using difference_type = DBResult::ROW::difference_type;
100 using pointer = DBResult::ROW::pointer;
101 using reference = DBResult::ROW::reference;
103 std::string as_string(
const char* name )
const;
104 std::string as_string(
const std::string& name )
const;
105 int as_int(
const std::string& name )
const;
106 double as_double(
const std::string& name )
const;
108 std::string as_string(
int col )
const;
109 int as_int(
int col )
const;
110 double as_double(
int col )
const;
112 size_t num_cols()
const;
114 typename DBRowIterator::pointer operator->();
115 typename DBRowIterator::reference operator*()
const;
135 DBResult::ROW::iterator it;
152 typedef std::shared_ptr<DBInterface> create_dbinterface_t();
Definition DBInterface.h:16
Definition DBInterface.h:37
Definition DBInterface.h:52
void setColName(int index, const std::string &name)
Definition DBInterface.cc:117
int getColIndex(const std::string &name)
Definition DBInterface.cc:122
Definition DBInterface.h:94
Definition Calibration.h:27
Definition DBInterface.h:140