BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h
Go to the documentation of this file.
1#ifndef REALDBUTIL_CONNECTIONBASE_H
2#define REALDBUTIL_CONNECTIONBASE_H
3
4#include "rdbModel/Db/Connection.h"
5#include "rdbModel/Tables/Assertion.h"
6
7namespace rdbModel {
8 class Rdb;
9 class Manager;
10}
11
12//namespace RealDBUtil {
14 public:
15 enum eRet {
16 RETOk = 0,
24 };
25 /// Used to form bit masks for dbs queries
26 enum eLevel {
31 };
32
33
34 /* Someday provide option of reading in description of table. In case
35 it is used, can check that it matches dbs we're connected to, and
36 can check column values.
37 */
38
39 /// Constructor keeps track of table of interest
40 ConnectionDBBase(const std::string& host, const std::string& table, const std::string& dbName);
41
42 ConnectionDBBase(const std::string& host, const std::string& dbName, const std::string& userName, const std::string& password);
43
45
46 bool connectRead(eRet& err);
47
49
50 // Should probably be const
51 rdbModel::Rdb* getRdb() {return m_rdb;}
52 const std::string& getTable() {return m_table;}
53
54 // Might make these private
55 void disconnectRead();
56 void disconnectWrite();
57
58 private:
59
60 rdbModel::Connection* m_readCxt;
61 rdbModel::Connection* m_writeCxt;
62
63 // these could be static
64 rdbModel::Assertion* m_findBest;
65 rdbModel::Assertion* m_findSoonest;
66
67
68
69 // static bool connect(rdbModel::MysqlConnection* conn,
70 static bool connect(rdbModel::Connection* conn,
71 std::string& host,
72 const std::string& user,
73 const std::string& pw, eRet& err,
74 const std::string& dbName);
75
76 bool connectWrite(eRet& err);
77
78
79 std::string m_host;
80 std::string m_table;
81 std::string m_dbName;
82 std::string m_userName;
83 std::string m_password;
84
85 rdbModel::Manager* m_man;
86 rdbModel::Rdb* m_rdb;
87 bool m_match; // true if succeeded. If not attempted, m_rdb is 0
88 };
89//}
90#endif
bool connectRead(eRet &err)