BOSS
8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Database/ReadDBBase/include/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
}
// namespace rdbModel
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
{
LEVELProd
= 1,
LEVELDev
= 2,
LEVELTest
= 4,
LEVELSuperseded
= 8 };
27
28
/* Someday provide option of reading in description of table. In case
29
it is used, can check that it matches dbs we're connected to, and
30
can check column values.
31
*/
32
33
/// Constructor keeps track of table of interest
34
ConnectionDBBase
(
const
std::string& host,
const
std::string& table,
35
const
std::string& dbName );
36
37
ConnectionDBBase
(
const
std::string& host,
const
std::string& dbName,
38
const
std::string& userName,
const
std::string& password );
39
40
~ConnectionDBBase
();
41
42
bool
connectRead
(
eRet
& err );
43
44
rdbModel::Connection
*
getReadConnection
() {
return
m_readCxt; }
45
46
// Should probably be const
47
rdbModel::Rdb
*
getRdb
() {
return
m_rdb; }
48
const
std::string&
getTable
() {
return
m_table; }
49
50
// Might make these private
51
void
disconnectRead
();
52
void
disconnectWrite
();
53
54
private
:
55
rdbModel::Connection
* m_readCxt;
56
rdbModel::Connection
* m_writeCxt;
57
58
// these could be static
59
rdbModel::Assertion
* m_findBest;
60
rdbModel::Assertion
* m_findSoonest;
61
62
// static bool connect(rdbModel::MysqlConnection* conn,
63
static
bool
connect(
rdbModel::Connection
* conn, std::string& host,
const
std::string& user,
64
const
std::string& pw,
eRet
& err,
const
std::string& dbName );
65
66
bool
connectWrite(
eRet
& err );
67
68
std::string m_host;
69
std::string m_table;
70
std::string m_dbName;
71
std::string m_userName;
72
std::string m_password;
73
74
rdbModel::Manager
* m_man;
75
rdbModel::Rdb
* m_rdb;
76
bool
m_match;
// true if succeeded. If not attempted, m_rdb is 0
77
};
78
//}
79
#endif
ConnectionDBBase::connectRead
bool connectRead(eRet &err)
Definition
ConnectionDBBase.cxx:69
ConnectionDBBase::getReadConnection
rdbModel::Connection * getReadConnection()
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:44
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:18
ConnectionDBBase::disconnectRead
void disconnectRead()
Definition
ConnectionDBBase.cxx:106
ConnectionDBBase::eLevel
eLevel
Used to form bit masks for dbs queries.
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::LEVELProd
@ LEVELProd
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::LEVELDev
@ LEVELDev
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::LEVELSuperseded
@ LEVELSuperseded
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::LEVELTest
@ LEVELTest
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:26
ConnectionDBBase::~ConnectionDBBase
~ConnectionDBBase()
Definition
ConnectionDBBase.cxx:45
ConnectionDBBase::disconnectWrite
void disconnectWrite()
Definition
ConnectionDBBase.cxx:115
ConnectionDBBase::getTable
const std::string & getTable()
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:48
ConnectionDBBase::getRdb
rdbModel::Rdb * getRdb()
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:47
ConnectionDBBase::eRet
eRet
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:15
ConnectionDBBase::RETBadHost
@ RETBadHost
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:18
ConnectionDBBase::RETMySQLError
@ RETMySQLError
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:22
ConnectionDBBase::RETNoConnect
@ RETNoConnect
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:19
ConnectionDBBase::RETNoSchemaMatch
@ RETNoSchemaMatch
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:23
ConnectionDBBase::RETOk
@ RETOk
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:16
ConnectionDBBase::RETWrongState
@ RETWrongState
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:20
ConnectionDBBase::RETBadCnfFile
@ RETBadCnfFile
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:17
ConnectionDBBase::RETBadValue
@ RETBadValue
Definition
Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h:21
rdbModel::Assertion
Definition
Calibration/rdbModel/include/rdbModel/Tables/Assertion.h:56
rdbModel::Connection
Definition
Calibration/rdbModel/include/rdbModel/Db/Connection.h:49
rdbModel::Manager
Definition
Calibration/rdbModel/include/rdbModel/Management/Manager.h:19
rdbModel::Rdb
Definition
Calibration/rdbModel/include/rdbModel/Rdb.h:42
rdbModel
Definition
Calibration/calibUtil/include/calibUtil/Metadata.h:11
8.0.0
BOSS_Source
Database
ReadDBBase
include
ReadDBBase
ConnectionDBBase.h
Generated by
1.16.1