BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
Database/DatabaseSvc/DatabaseSvc-00-00-26/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;};
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
virtual int select_db(std::string dbname)=0
virtual ~DbInterface()
Definition: DbInterface.cxx:11
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