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
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
ConnectionDBBase
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:13
ConnectionDBBase::connectRead
bool connectRead(eRet &err)
Definition:
ConnectionDBBase.cxx:60
ConnectionDBBase::getReadConnection
rdbModel::Connection * getReadConnection()
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:48
ConnectionDBBase::disconnectRead
void disconnectRead()
Definition:
ConnectionDBBase.cxx:96
ConnectionDBBase::eLevel
eLevel
Used to form bit masks for dbs queries.
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::LEVELProd
@ LEVELProd
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:27
ConnectionDBBase::LEVELDev
@ LEVELDev
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:28
ConnectionDBBase::LEVELSuperseded
@ LEVELSuperseded
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:30
ConnectionDBBase::LEVELTest
@ LEVELTest
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/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:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:52
ConnectionDBBase::getRdb
rdbModel::Rdb * getRdb()
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:51
ConnectionDBBase::eRet
eRet
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:15
ConnectionDBBase::RETBadHost
@ RETBadHost
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:18
ConnectionDBBase::RETMySQLError
@ RETMySQLError
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:22
ConnectionDBBase::RETNoConnect
@ RETNoConnect
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:19
ConnectionDBBase::RETNoSchemaMatch
@ RETNoSchemaMatch
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:23
ConnectionDBBase::RETOk
@ RETOk
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:16
ConnectionDBBase::RETWrongState
@ RETWrongState
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:20
ConnectionDBBase::RETBadCnfFile
@ RETBadCnfFile
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:17
ConnectionDBBase::RETBadValue
@ RETBadValue
Definition:
Database/ReadDBBase/ReadDBBase-00-00-02/ReadDBBase/ConnectionDBBase.h:21
rdbModel::Assertion
Definition:
Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Tables/Assertion.h:56
rdbModel::Connection
Definition:
Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Db/Connection.h:54
rdbModel::Manager
Definition:
Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Management/Manager.h:18
rdbModel::Rdb
Definition:
Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h:41
rdbModel
Definition:
Calibration/calibUtil/calibUtil-00-00-43/calibUtil/Metadata.h:11
source
Database
ReadDBBase
ReadDBBase-00-00-02
ReadDBBase
ConnectionDBBase.h
Generated by
1.9.6