CGEM BOSS 6.6.5.g
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_reuse_connection(bool flag) { m_reuseConnection=flag;};
34
35 protected:
38
39 std::string m_dbName;
40
41 std::string m_dbHost;
42 std::string m_dbUser;
43 std::string m_dbPasswd;
44 std::string m_dbPath;
45};
46
47#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()
Definition: DbInterface.cxx:10
virtual int disconnect()=0
std::string m_dbUser
Definition: DbInterface.h:42
std::string m_dbName
Definition: DbInterface.h:39
virtual int query(std::string dbname, std::string query)=0
void set_passwd(std::string passwd)
Definition: DbInterface.h:31
bool m_reuseConnection
Definition: DbInterface.h:37
std::string m_dbPath
Definition: DbInterface.h:44
bool m_isConnected
Definition: DbInterface.h:36
virtual int query(std::string dbname, std::string query, DatabaseRecordVector &records)=0
void set_reuse_connection(bool flag)
Definition: DbInterface.h:33
std::string m_dbPasswd
Definition: DbInterface.h:43
virtual int connect()=0
void set_user(std::string user)
Definition: DbInterface.h:30
std::string m_dbHost
Definition: DbInterface.h:41