BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ConnectionDBBase Class Reference

#include <ConnectionDBBase.h>

Public Types

enum  eRet {
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7
}
enum  eLevel {
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8
}
 Used to form bit masks for dbs queries. More...
enum  eRet {
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7
}
enum  eLevel {
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8
}
 Used to form bit masks for dbs queries. More...
enum  eRet {
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 ,
  RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 ,
  RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7
}
enum  eLevel {
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 ,
  LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8
}
 Used to form bit masks for dbs queries. More...

Public Member Functions

 ConnectionDBBase (const std::string &host, const std::string &table, const std::string &dbName)
 Constructor keeps track of table of interest.
 ConnectionDBBase (const std::string &host, const std::string &dbName, const std::string &userName, const std::string &password)
 ~ConnectionDBBase ()
bool connectRead (eRet &err)
rdbModel::ConnectiongetReadConnection ()
rdbModel::RdbgetRdb ()
const std::string & getTable ()
void disconnectRead ()
void disconnectWrite ()
 ConnectionDBBase (const std::string &host, const std::string &table, const std::string &dbName)
 Constructor keeps track of table of interest.
 ConnectionDBBase (const std::string &host, const std::string &dbName, const std::string &userName, const std::string &password)
 ~ConnectionDBBase ()
bool connectRead (eRet &err)
rdbModel::ConnectiongetReadConnection ()
rdbModel::RdbgetRdb ()
const std::string & getTable ()
void disconnectRead ()
void disconnectWrite ()
 ConnectionDBBase (const std::string &host, const std::string &table, const std::string &dbName)
 Constructor keeps track of table of interest.
 ConnectionDBBase (const std::string &host, const std::string &dbName, const std::string &userName, const std::string &password)
 ~ConnectionDBBase ()
bool connectRead (eRet &err)
rdbModel::ConnectiongetReadConnection ()
rdbModel::RdbgetRdb ()
const std::string & getTable ()
void disconnectRead ()
void disconnectWrite ()

Detailed Description

Member Enumeration Documentation

◆ eLevel [1/3]

Used to form bit masks for dbs queries.

Enumerator
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 

Definition at line 26 of file Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h.

◆ eLevel [2/3]

Used to form bit masks for dbs queries.

Enumerator
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 

Definition at line 26 of file InstallArea/x86_64-el9-gcc13-dbg/include/ReadDBBase/ConnectionDBBase.h.

26{ LEVELProd = 1, LEVELDev = 2, LEVELTest = 4, LEVELSuperseded = 8 };

◆ eLevel [3/3]

Used to form bit masks for dbs queries.

Enumerator
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 
LEVELProd 
LEVELDev 
LEVELTest 
LEVELSuperseded 

Definition at line 26 of file InstallArea/x86_64-el9-gcc13-opt/include/ReadDBBase/ConnectionDBBase.h.

26{ LEVELProd = 1, LEVELDev = 2, LEVELTest = 4, LEVELSuperseded = 8 };

◆ eRet [1/3]

Enumerator
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 

Definition at line 15 of file Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h.

◆ eRet [2/3]

Enumerator
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 

Definition at line 15 of file InstallArea/x86_64-el9-gcc13-dbg/include/ReadDBBase/ConnectionDBBase.h.

15 {
16 RETOk = 0,
17 RETBadCnfFile = 1,
18 RETBadHost = 2,
19 RETNoConnect = 3,
20 RETWrongState = 4,
21 RETBadValue = 5,
22 RETMySQLError = 6,
24 };

◆ eRet [3/3]

Enumerator
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 
RETOk 
RETBadCnfFile 
RETBadHost 
RETNoConnect 
RETWrongState 
RETBadValue 
RETMySQLError 
RETNoSchemaMatch 

Definition at line 15 of file InstallArea/x86_64-el9-gcc13-opt/include/ReadDBBase/ConnectionDBBase.h.

15 {
16 RETOk = 0,
17 RETBadCnfFile = 1,
18 RETBadHost = 2,
19 RETNoConnect = 3,
20 RETWrongState = 4,
21 RETBadValue = 5,
22 RETMySQLError = 6,
24 };

Constructor & Destructor Documentation

◆ ConnectionDBBase() [1/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & table,
const std::string & dbName )

Constructor keeps track of table of interest.

Definition at line 18 of file ConnectionDBBase.cxx.

20 : m_readCxt( 0 )
21 , m_writeCxt( 0 )
22 , m_host( host )
23 , m_table( table )
24 , m_dbName( dbName )
25 , m_userName( "maqm" )
26 , m_password( "12345" )
27 , m_man( 0 )
28 , m_rdb( 0 )
29 , m_match( false ) {
30 // if (table.compare("*") == 0) m_table = std::string("$(MYSQL_METATABLE)");
31 // if (host.compare("*") == 0) m_host = std::string("$(MYSQL_HOST)");
32}

◆ ConnectionDBBase() [2/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & dbName,
const std::string & userName,
const std::string & password )

Definition at line 33 of file ConnectionDBBase.cxx.

35 : m_readCxt( 0 )
36 , m_writeCxt( 0 )
37 , m_host( host )
38 , m_dbName( dbName )
39 , m_userName( userName )
40 , m_password( password )
41 , m_man( 0 )
42 , m_rdb( 0 )
43 , m_match( false ) {}

◆ ~ConnectionDBBase() [1/3]

ConnectionDBBase::~ConnectionDBBase ( )

Definition at line 45 of file ConnectionDBBase.cxx.

45 {
48 if ( m_man ) delete m_man;
49}

◆ ConnectionDBBase() [3/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & table,
const std::string & dbName )

Constructor keeps track of table of interest.

◆ ConnectionDBBase() [4/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & dbName,
const std::string & userName,
const std::string & password )

◆ ~ConnectionDBBase() [2/3]

ConnectionDBBase::~ConnectionDBBase ( )

◆ ConnectionDBBase() [5/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & table,
const std::string & dbName )

Constructor keeps track of table of interest.

◆ ConnectionDBBase() [6/6]

ConnectionDBBase::ConnectionDBBase ( const std::string & host,
const std::string & dbName,
const std::string & userName,
const std::string & password )

◆ ~ConnectionDBBase() [3/3]

ConnectionDBBase::~ConnectionDBBase ( )

Member Function Documentation

◆ connectRead() [1/3]

bool ConnectionDBBase::connectRead ( eRet & err)

Definition at line 69 of file ConnectionDBBase.cxx.

69 {
70 if ( m_readCxt == 0 )
71 {
72 // for now use std::cout, std::cerr
73 m_readCxt = new rdbModel::MysqlConnection();
74 bool ok = connect( m_readCxt, m_host, m_userName, m_password, err, m_dbName );
75 if ( !ok )
76 {
77 delete m_readCxt;
78 m_readCxt = 0;
79 }
80 else {}
81 return ok;
82 }
83 else return true;
84}

◆ connectRead() [2/3]

bool ConnectionDBBase::connectRead ( eRet & err)

◆ connectRead() [3/3]

bool ConnectionDBBase::connectRead ( eRet & err)

◆ disconnectRead() [1/3]

void ConnectionDBBase::disconnectRead ( )

Definition at line 106 of file ConnectionDBBase.cxx.

106 {
107 if ( m_readCxt )
108 {
109 m_readCxt->close();
110 delete m_readCxt;
111 m_readCxt = 0;
112 }
113}

Referenced by ~ConnectionDBBase().

◆ disconnectRead() [2/3]

void ConnectionDBBase::disconnectRead ( )

◆ disconnectRead() [3/3]

void ConnectionDBBase::disconnectRead ( )

◆ disconnectWrite() [1/3]

void ConnectionDBBase::disconnectWrite ( )

Definition at line 115 of file ConnectionDBBase.cxx.

115 {
116 if ( m_writeCxt )
117 {
118 m_writeCxt->close();
119 delete m_writeCxt;
120 m_writeCxt = 0;
121 }
122}

Referenced by ~ConnectionDBBase().

◆ disconnectWrite() [2/3]

void ConnectionDBBase::disconnectWrite ( )

◆ disconnectWrite() [3/3]

void ConnectionDBBase::disconnectWrite ( )

◆ getRdb() [1/3]

rdbModel::Rdb * ConnectionDBBase::getRdb ( )
inline

Definition at line 47 of file Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h.

47{ return m_rdb; }

◆ getRdb() [2/3]

rdbModel::Rdb * ConnectionDBBase::getRdb ( )
inline

Definition at line 47 of file InstallArea/x86_64-el9-gcc13-dbg/include/ReadDBBase/ConnectionDBBase.h.

47{ return m_rdb; }

◆ getRdb() [3/3]

rdbModel::Rdb * ConnectionDBBase::getRdb ( )
inline

Definition at line 47 of file InstallArea/x86_64-el9-gcc13-opt/include/ReadDBBase/ConnectionDBBase.h.

47{ return m_rdb; }

◆ getReadConnection() [1/3]

rdbModel::Connection * ConnectionDBBase::getReadConnection ( )
inline

Definition at line 44 of file Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h.

44{ return m_readCxt; }

◆ getReadConnection() [2/3]

rdbModel::Connection * ConnectionDBBase::getReadConnection ( )
inline

Definition at line 44 of file InstallArea/x86_64-el9-gcc13-dbg/include/ReadDBBase/ConnectionDBBase.h.

44{ return m_readCxt; }

◆ getReadConnection() [3/3]

rdbModel::Connection * ConnectionDBBase::getReadConnection ( )
inline

Definition at line 44 of file InstallArea/x86_64-el9-gcc13-opt/include/ReadDBBase/ConnectionDBBase.h.

44{ return m_readCxt; }

◆ getTable() [1/3]

const std::string & ConnectionDBBase::getTable ( )
inline

Definition at line 48 of file Database/ReadDBBase/include/ReadDBBase/ConnectionDBBase.h.

48{ return m_table; }

◆ getTable() [2/3]

const std::string & ConnectionDBBase::getTable ( )
inline

Definition at line 48 of file InstallArea/x86_64-el9-gcc13-dbg/include/ReadDBBase/ConnectionDBBase.h.

48{ return m_table; }

◆ getTable() [3/3]

const std::string & ConnectionDBBase::getTable ( )
inline

Definition at line 48 of file InstallArea/x86_64-el9-gcc13-opt/include/ReadDBBase/ConnectionDBBase.h.

48{ return m_table; }

The documentation for this class was generated from the following files: