CGEM BOSS
6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
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
7
namespace
rdbModel
{
8
class
Rdb;
9
class
Manager;
10
}
11
12
//namespace RealDBUtil {
13
class
ConnectionDBBase
{
14
public
:
15
enum
eRet
{
16
RETOk
= 0,
17
RETBadCnfFile
= 1,
18
RETBadHost
= 2,
19
RETNoConnect
= 3,
20
RETWrongState
= 4,
21
RETBadValue
= 5,
22
RETMySQLError
= 6,
23
RETNoSchemaMatch
= 7
24
};
25
/// Used to form bit masks for dbs queries
26
enum
eLevel
{
27
LEVELProd
= 1,
28
LEVELDev
= 2,
29
LEVELTest
= 4,
30
LEVELSuperseded
= 8
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
44
~ConnectionDBBase
();
45
46
bool
connectRead
(
eRet
& err);
47
48
rdbModel::Connection
*
getReadConnection
() {
return
m_readCxt;}
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
Assertion.h
Connection.h
ConnectionDBBase
Definition
ConnectionDBBase.h:13
ConnectionDBBase::connectRead
bool connectRead(eRet &err)
Definition
ConnectionDBBase.cxx:60
ConnectionDBBase::getReadConnection
rdbModel::Connection * getReadConnection()
Definition
ConnectionDBBase.h:48
ConnectionDBBase::ConnectionDBBase
ConnectionDBBase(const std::string &host, const std::string &table, const std::string &dbName)
Constructor keeps track of table of interest.
Definition
ConnectionDBBase.cxx:20
ConnectionDBBase::disconnectRead
void disconnectRead()
Definition
ConnectionDBBase.cxx:96
ConnectionDBBase::eLevel
eLevel
Used to form bit masks for dbs queries.
Definition
ConnectionDBBase.h:26
ConnectionDBBase::LEVELProd
@ LEVELProd
Definition
ConnectionDBBase.h:27
ConnectionDBBase::LEVELDev
@ LEVELDev
Definition
ConnectionDBBase.h:28
ConnectionDBBase::LEVELSuperseded
@ LEVELSuperseded
Definition
ConnectionDBBase.h:30
ConnectionDBBase::LEVELTest
@ LEVELTest
Definition
ConnectionDBBase.h:29
ConnectionDBBase::~ConnectionDBBase
~ConnectionDBBase()
Definition
ConnectionDBBase.cxx:34
ConnectionDBBase::disconnectWrite
void disconnectWrite()
Definition
ConnectionDBBase.cxx:104
ConnectionDBBase::getTable
const std::string & getTable()
Definition
ConnectionDBBase.h:52
ConnectionDBBase::getRdb
rdbModel::Rdb * getRdb()
Definition
ConnectionDBBase.h:51
ConnectionDBBase::eRet
eRet
Definition
ConnectionDBBase.h:15
ConnectionDBBase::RETOk
@ RETOk
Definition
ConnectionDBBase.h:16
ConnectionDBBase::RETNoSchemaMatch
@ RETNoSchemaMatch
Definition
ConnectionDBBase.h:23
ConnectionDBBase::RETWrongState
@ RETWrongState
Definition
ConnectionDBBase.h:20
ConnectionDBBase::RETBadCnfFile
@ RETBadCnfFile
Definition
ConnectionDBBase.h:17
ConnectionDBBase::RETNoConnect
@ RETNoConnect
Definition
ConnectionDBBase.h:19
ConnectionDBBase::RETBadHost
@ RETBadHost
Definition
ConnectionDBBase.h:18
ConnectionDBBase::RETBadValue
@ RETBadValue
Definition
ConnectionDBBase.h:21
ConnectionDBBase::RETMySQLError
@ RETMySQLError
Definition
ConnectionDBBase.h:22
rdbModel::Assertion
Definition
Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Assertion.h:56
rdbModel::Connection
Definition
Connection.h:54
rdbModel::Manager
Definition
Manager.h:18
rdbModel::Rdb
Definition
Rdb.h:41
rdbModel
Definition
Metadata.h:11
6.6.5.h
Database
ReadDBBase
ReadDBBase-00-00-02
ReadDBBase
ConnectionDBBase.h
Generated by
1.12.0