BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
DbInterface.h
Go to the documentation of this file.
1#ifndef DbInterface_h
2#define DbInterface_h
3
4#include <string>
5#include <vector>
6#include <map>
7
9
11{
12 public:
14 virtual ~DbInterface();
15
16 // Connect to db
17 virtual int connect() = 0;
18 // Select database to be used
19 virtual int select_db(std::string dbname) = 0;
20 // Query which returns data (SELECT, SHOW etc.)
21 virtual int query(std::string dbname, std::string query, DatabaseRecordVector& records) = 0;
22 // Query wich does not return data (INSERT, UPDATE etc.)
23 virtual int query(std::string dbname, std::string query) = 0;
24 // Disconnect from db
25 virtual int disconnect() = 0;
26
27 bool is_connected(){ return m_isConnected; }
28
29 void set_host(std::string host) {m_dbHost=host;};
30 void set_user(std::string user) {m_dbUser=user;};
31 void set_passwd(std::string passwd) {m_dbPasswd=passwd;};
32 void set_dbpath(std::string path) {m_dbPath=path;};
33 void set_port(int port) {m_dbPort=port;};
35
36 protected:
39
40 std::string m_dbName;
41
42 std::string m_dbHost;
44 std::string m_dbUser;
45 std::string m_dbPasswd;
46 std::string m_dbPath;
47
48};
49
50#endif
void set_dbpath(std::string path)
Definition DbInterface.h:32
virtual int select_db(std::string dbname)=0
void set_host(std::string host)
Definition DbInterface.h:29
bool is_connected()
Definition DbInterface.h:27
virtual ~DbInterface()
virtual int disconnect()=0
std::string m_dbUser
Definition DbInterface.h:44
std::string m_dbName
Definition DbInterface.h:40
virtual int query(std::string dbname, std::string query)=0
void set_passwd(std::string passwd)
Definition DbInterface.h:31
void set_port(int port)
Definition DbInterface.h:33
bool m_reuseConnection
Definition DbInterface.h:38
std::string m_dbPath
Definition DbInterface.h:46
bool m_isConnected
Definition DbInterface.h:37
virtual int query(std::string dbname, std::string query, DatabaseRecordVector &records)=0
void set_reuse_connection(bool flag)
Definition DbInterface.h:34
std::string m_dbPasswd
Definition DbInterface.h:45
virtual int connect()=0
void set_user(std::string user)
Definition DbInterface.h:30
std::string m_dbHost
Definition DbInterface.h:42