BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Database/DatabaseSvc/DatabaseSvc-00-00-24/DatabaseSvc/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
8#include "DatabaseSvc/DatabaseRecord.h"
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;};
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
virtual int select_db(std::string dbname)=0
virtual ~DbInterface()
Definition: DbInterface.cxx:10
virtual int disconnect()=0
virtual int query(std::string dbname, std::string query)=0
virtual int query(std::string dbname, std::string query, DatabaseRecordVector &records)=0
virtual int connect()=0