CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
RunCommentDat Class Reference

#include <RunCommentDat.h>

Inheritance diagram for RunCommentDat:
IDataItem IDBObject

Public Member Functions

std::string getComment () const
 
Tm getDBTime () const
 
std::string getSource () const
 
std::string getTable () override
 
 RunCommentDat ()
 
void setComment (std::string x)
 
void setDBTime (const Tm &x)
 
void setSource (std::string x)
 
 ~RunCommentDat () override
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunCommentDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunCommentDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

std::string m_comment
 
std::string m_source
 
Tm m_time
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file RunCommentDat.h.

Constructor & Destructor Documentation

◆ RunCommentDat()

RunCommentDat::RunCommentDat ( )

Definition at line 14 of file RunCommentDat.cc.

14  {
15  m_env = nullptr;
16  m_conn = nullptr;
17  m_writeStmt = nullptr;
18  m_source = "";
19  m_comment = "";
20  m_time = Tm();
21 }

◆ ~RunCommentDat()

RunCommentDat::~RunCommentDat ( )
override

Definition at line 23 of file RunCommentDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void RunCommentDat::fetchData ( std::map< EcalLogicID, RunCommentDat > *  fillMap,
RunIOV iov 
)
privatenoexcept

Definition at line 60 of file RunCommentDat.cc.

60  {
61  this->checkConnection();
62  fillMap->clear();
63 
65 
66  iov->setConnection(m_env, m_conn);
67  int iovID = iov->fetchID();
68  if (!iovID) {
69  // throw(std::runtime_error("RunCommentDat::writeDB: IOV not in DB"));
70  return;
71  }
72 
73  try {
74  Statement* stmt = m_conn->createStatement();
75  stmt->setSQL(
76  "SELECT d.comment_id, "
77  "d.source, d.user_comment, d.db_timestamp "
78  "FROM run_comment_dat d "
79  "WHERE d.iov_id = :iov_id order by d.logic_id ");
80  stmt->setInt(1, iovID);
81  ResultSet* rset = stmt->executeQuery();
82 
83  std::pair<EcalLogicID, RunCommentDat> p;
84  RunCommentDat dat;
85  while (rset->next()) {
86  p.first = EcalLogicID("Comment_order",
87  rset->getInt(1),
88  rset->getInt(1),
90  EcalLogicID::NULLID, // comment number
91  "Comment_order");
92 
93  dat.setSource(rset->getString(2));
94  dat.setComment(rset->getString(3));
95 
96  Date startDate = rset->getDate(4);
97  m_time = dh.dateToTm(startDate);
98 
99  p.second = dat;
100  fillMap->insert(p);
101  }
102  m_conn->terminateStatement(stmt);
103  } catch (SQLException& e) {
104  throw(std::runtime_error("RunCommentDat::fetchData(): " + e.getMessage()));
105  }
106 }

References cuy::dh, MillePedeFileConverter_cfg::e, EcalLogicID::NULLID, AlCaHLTBitMon_ParallelJobs::p, setComment(), and setSource().

◆ getComment()

std::string RunCommentDat::getComment ( ) const
inline

Definition at line 23 of file RunCommentDat.h.

23 { return m_comment; }

References m_comment.

◆ getDBTime()

Tm RunCommentDat::getDBTime ( ) const
inline

Definition at line 25 of file RunCommentDat.h.

25 { return m_time; }

References m_time.

◆ getSource()

std::string RunCommentDat::getSource ( ) const
inline

Definition at line 21 of file RunCommentDat.h.

21 { return m_source; }

References m_source.

◆ getTable()

std::string RunCommentDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunCommentDat.h.

18 { return "RUN_COMMENT_DAT"; }

◆ prepareWrite()

void RunCommentDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 25 of file RunCommentDat.cc.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL(
31  "INSERT INTO run_comment_dat (iov_id, "
32  "source, user_comment) "
33  "VALUES (:iov_id, "
34  ":source, :user_comment)");
35  } catch (SQLException& e) {
36  throw(std::runtime_error("RunCommentDat::prepareWrite(): " + e.getMessage()));
37  }
38 }

References MillePedeFileConverter_cfg::e.

◆ setComment()

void RunCommentDat::setComment ( std::string  x)
inline

Definition at line 22 of file RunCommentDat.h.

22 { m_comment = x; }

References m_comment, and x.

Referenced by ConfigToolBase.ConfigToolBase::apply(), and fetchData().

◆ setDBTime()

void RunCommentDat::setDBTime ( const Tm x)
inline

Definition at line 24 of file RunCommentDat.h.

24 { m_time = x; }

References m_time, and x.

◆ setSource()

void RunCommentDat::setSource ( std::string  x)
inline

Definition at line 20 of file RunCommentDat.h.

20 { m_source = x; }

References m_source, and x.

Referenced by fetchData().

◆ writeDB()

void RunCommentDat::writeDB ( const EcalLogicID ecid,
const RunCommentDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 40 of file RunCommentDat.cc.

40  {
41  this->checkConnection();
42  this->checkPrepare();
43 
44  int iovID = iov->fetchID();
45  if (!iovID) {
46  throw(std::runtime_error("RunCommentDat::writeDB: IOV not in DB"));
47  }
48 
49  try {
50  m_writeStmt->setInt(1, iovID);
51  m_writeStmt->setString(2, item->getSource());
52  m_writeStmt->setString(3, item->getComment());
53 
54  m_writeStmt->executeUpdate();
55  } catch (SQLException& e) {
56  throw(std::runtime_error("RunCommentDat::writeDB(): " + e.getMessage()));
57  }
58 }

References MillePedeFileConverter_cfg::e, and B2GTnPMonitor_cfi::item.

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunCommentDat.h.

Member Data Documentation

◆ m_comment

std::string RunCommentDat::m_comment
private

Definition at line 36 of file RunCommentDat.h.

Referenced by getComment(), and setComment().

◆ m_source

std::string RunCommentDat::m_source
private

Definition at line 35 of file RunCommentDat.h.

Referenced by getSource(), and setSource().

◆ m_time

Tm RunCommentDat::m_time
private

Definition at line 37 of file RunCommentDat.h.

Referenced by getDBTime(), and setDBTime().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
DDAxes::x
RunCommentDat::setSource
void setSource(std::string x)
Definition: RunCommentDat.h:20
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
EcalLogicID
Definition: EcalLogicID.h:7
Tm
Definition: Tm.h:13
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
RunCommentDat
Definition: RunCommentDat.h:11
RunCommentDat::m_time
Tm m_time
Definition: RunCommentDat.h:37
RunCommentDat::setComment
void setComment(std::string x)
Definition: RunCommentDat.h:22
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
RunCommentDat::m_comment
std::string m_comment
Definition: RunCommentDat.h:36
RunIOV::fetchID
int fetchID() noexcept(false) override
Definition: RunIOV.cc:60
RunCommentDat::m_source
std::string m_source
Definition: RunCommentDat.h:35
EcalLogicID::NULLID
static const int NULLID
Definition: EcalLogicID.h:35
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
DateHandler
Definition: DateHandler.h:7
cuy.dh
dh
Definition: cuy.py:355
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37