CMS 3D CMS Logo

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

#include <ODTowersToByPassDat.h>

Inheritance diagram for ODTowersToByPassDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getStatus () const
 
std::string getTable () override
 
int getTimeCorr () const
 
int getTrId () const
 
int getTTId () const
 
 ODTowersToByPassDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setTimeCorr (int dac)
 
void setTrId (int dac)
 
void setTTId (int dac)
 
 ~ODTowersToByPassDat () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- 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::vector< ODTowersToByPassDat > *fillMap, ODTowersToByPassInfo *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeArrayDB (const std::vector< ODTowersToByPassDat > &data, ODTowersToByPassInfo *iov) noexcept(false)
 
void writeDB (const ODTowersToByPassDat *item, ODTowersToByPassInfo *iov) noexcept(false)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sta
 
int m_time
 
int m_tr
 
int m_tt
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) 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 IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file ODTowersToByPassDat.h.

Constructor & Destructor Documentation

◆ ODTowersToByPassDat()

ODTowersToByPassDat::ODTowersToByPassDat ( )

Definition at line 10 of file ODTowersToByPassDat.cc.

10  {
11  m_env = nullptr;
12  m_conn = nullptr;
13  m_writeStmt = nullptr;
14  m_readStmt = nullptr;
15 
16  m_fed = 0;
17  m_tt = 0;
18  m_tr = 0;
19  m_time = 0;
20  m_sta = 0;
21 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
Statement * m_readStmt
Definition: IODConfig.h:34

◆ ~ODTowersToByPassDat()

ODTowersToByPassDat::~ODTowersToByPassDat ( )
override

Definition at line 23 of file ODTowersToByPassDat.cc.

23 {}

Member Function Documentation

◆ fetchData()

void ODTowersToByPassDat::fetchData ( std::vector< ODTowersToByPassDat > *  fillMap,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 55 of file ODTowersToByPassDat.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setStatus(), setTimeCorr(), setTrId(), and setTTId().

55  {
56  this->checkConnection();
57 
58  iov->setConnection(m_env, m_conn);
59  int iovID = iov->fetchID();
60  if (!iovID) {
61  std::cout << "ID not in the DB" << endl;
62  return;
63  }
64 
65  try {
66  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tr_id, tt_id ");
67  m_readStmt->setInt(1, iovID);
68  ResultSet* rset = m_readStmt->executeQuery();
69 
70  // std::vector< ODTowersToByPassDat > p;
72  while (rset->next()) {
73  // dat.setId( rset->getInt(1) );
74  dat.setFedId(rset->getInt(2));
75  dat.setTrId(rset->getInt(3));
76  dat.setTTId(rset->getInt(4));
77  dat.setTimeCorr(rset->getInt(5));
78  dat.setStatus(rset->getInt(6));
79 
80  p->push_back(dat);
81  }
82 
83  } catch (SQLException& e) {
84  throw(std::runtime_error("ODTowersToByPassDat::fetchData(): " + e.getMessage()));
85  }
86 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string getTable() override
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
Statement * m_readStmt
Definition: IODConfig.h:34
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int fetchID() noexcept(false)

◆ getFedId()

int ODTowersToByPassDat::getFedId ( ) const
inline

Definition at line 27 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by writeArrayDB().

27 { return m_fed; }

◆ getId()

int ODTowersToByPassDat::getId ( void  ) const
inline

Definition at line 21 of file ODTowersToByPassDat.h.

References m_ID.

21 { return m_ID; }

◆ getStatus()

int ODTowersToByPassDat::getStatus ( ) const
inline

Definition at line 36 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by writeArrayDB().

36 { return m_sta; }

◆ getTable()

std::string ODTowersToByPassDat::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 18 of file ODTowersToByPassDat.h.

18 { return "TOWERS_TO_BYPASS_DAT"; }

◆ getTimeCorr()

int ODTowersToByPassDat::getTimeCorr ( ) const
inline

Definition at line 33 of file ODTowersToByPassDat.h.

References m_time.

Referenced by writeArrayDB().

33 { return m_time; }

◆ getTrId()

int ODTowersToByPassDat::getTrId ( ) const
inline

Definition at line 24 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by writeArrayDB().

24 { return m_tr; }

◆ getTTId()

int ODTowersToByPassDat::getTTId ( ) const
inline

Definition at line 30 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by writeArrayDB().

30 { return m_tt; }

◆ prepareWrite()

void ODTowersToByPassDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 25 of file ODTowersToByPassDat.cc.

References MillePedeFileConverter_cfg::e.

25  {
26  this->checkConnection();
27 
28  try {
29  m_writeStmt = m_conn->createStatement();
30  m_writeStmt->setSQL("INSERT INTO " + getTable() +
31  " (rec_id, fed_id, tr_id, tt_id, time_corr, STATUS ) "
32  "VALUES (:1, :2, :3, :4, :5 , :6 )");
33  } catch (SQLException& e) {
34  throw(std::runtime_error("ODTowersToByPassDat::prepareWrite(): " + e.getMessage()));
35  }
36 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
std::string getTable() override
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

◆ setFedId()

void ODTowersToByPassDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by fetchData().

26 { m_fed = dac; }

◆ setId()

void ODTowersToByPassDat::setId ( int  dac)
inline

Definition at line 20 of file ODTowersToByPassDat.h.

References m_ID.

20 { m_ID = dac; }

◆ setStatus()

void ODTowersToByPassDat::setStatus ( int  dac)
inline

Definition at line 35 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by fetchData().

35 { m_sta = dac; }

◆ setTimeCorr()

void ODTowersToByPassDat::setTimeCorr ( int  dac)
inline

Definition at line 32 of file ODTowersToByPassDat.h.

References m_time.

Referenced by fetchData().

32 { m_time = dac; }

◆ setTrId()

void ODTowersToByPassDat::setTrId ( int  dac)
inline

Definition at line 23 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by fetchData().

23 { m_tr = dac; }

◆ setTTId()

void ODTowersToByPassDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by fetchData().

29 { m_tt = dac; }

◆ writeArrayDB()

void ODTowersToByPassDat::writeArrayDB ( const std::vector< ODTowersToByPassDat > &  data,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 90 of file ODTowersToByPassDat.cc.

References submitPVResolutionJobs::count, data, MillePedeFileConverter_cfg::e, getFedId(), getStatus(), getTimeCorr(), getTrId(), getTTId(), createfilelist::int, geometryCSVtoXML::xx, geometryCSVtoXML::yy, and geometryCSVtoXML::zz.

91  {
92  this->checkConnection();
93 
94  int iovID = iov->fetchID();
95  if (!iovID) {
96  throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
97  }
98 
99  int nrows = data.size();
100  int* ids = new int[nrows];
101  int* xx = new int[nrows];
102  int* yy = new int[nrows];
103  int* zz = new int[nrows];
104  int* ww = new int[nrows];
105  int* st = new int[nrows];
106 
107  ub2* ids_len = new ub2[nrows];
108  ub2* x_len = new ub2[nrows];
109  ub2* y_len = new ub2[nrows];
110  ub2* z_len = new ub2[nrows];
111  ub2* w_len = new ub2[nrows];
112  ub2* st_len = new ub2[nrows];
113 
114  ODTowersToByPassDat dataitem;
115 
116  for (int count = 0; count != (int)data.size(); count++) {
117  dataitem = data[count];
118  ids[count] = iovID;
119  xx[count] = dataitem.getFedId();
120  yy[count] = dataitem.getTrId();
121  zz[count] = dataitem.getTTId();
122  ww[count] = dataitem.getTimeCorr();
123  st[count] = dataitem.getStatus();
124 
125  ids_len[count] = sizeof(ids[count]);
126  x_len[count] = sizeof(xx[count]);
127  y_len[count] = sizeof(yy[count]);
128  z_len[count] = sizeof(zz[count]);
129  w_len[count] = sizeof(ww[count]);
130  st_len[count] = sizeof(st[count]);
131  }
132 
133  try {
134  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]), ids_len);
135  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT, sizeof(xx[0]), x_len);
136  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT, sizeof(yy[0]), y_len);
137  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT, sizeof(zz[0]), z_len);
138  m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT, sizeof(ww[0]), w_len);
139  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT, sizeof(st[0]), st_len);
140 
141  m_writeStmt->executeArrayUpdate(nrows);
142 
143  delete[] ids;
144  delete[] xx;
145  delete[] yy;
146  delete[] zz;
147  delete[] ww;
148  delete[] st;
149 
150  delete[] ids_len;
151  delete[] x_len;
152  delete[] y_len;
153  delete[] z_len;
154  delete[] w_len;
155  delete[] st_len;
156 
157  } catch (SQLException& e) {
158  throw(std::runtime_error("ODTowersToByPassDat::writeArrayDB(): " + e.getMessage()));
159  }
160 }
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
int fetchID() noexcept(false)

◆ writeDB()

void ODTowersToByPassDat::writeDB ( const ODTowersToByPassDat item,
ODTowersToByPassInfo iov 
)
privatenoexcept

Definition at line 38 of file ODTowersToByPassDat.cc.

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

38  {
39  this->checkConnection();
40 
41  try {
42  m_writeStmt->setInt(1, item->getId());
43  m_writeStmt->setInt(2, item->getFedId());
44  m_writeStmt->setInt(3, item->getTrId());
45  m_writeStmt->setInt(4, item->getTTId());
46  m_writeStmt->setInt(5, item->getTimeCorr());
47  m_writeStmt->setInt(6, item->getStatus());
48 
49  m_writeStmt->executeUpdate();
50  } catch (SQLException& e) {
51  throw(std::runtime_error("ODTowersToByPassDat::writeDB(): " + e.getMessage()));
52  }
53 }
Statement * m_writeStmt
Definition: IODConfig.h:33
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODTowersToByPassDat.h.

Member Data Documentation

◆ m_fed

int ODTowersToByPassDat::m_fed
private

Definition at line 49 of file ODTowersToByPassDat.h.

Referenced by getFedId(), and setFedId().

◆ m_ID

int ODTowersToByPassDat::m_ID
private

Definition at line 53 of file ODTowersToByPassDat.h.

Referenced by getId(), and setId().

◆ m_sta

int ODTowersToByPassDat::m_sta
private

Definition at line 52 of file ODTowersToByPassDat.h.

Referenced by getStatus(), and setStatus().

◆ m_time

int ODTowersToByPassDat::m_time
private

Definition at line 51 of file ODTowersToByPassDat.h.

Referenced by getTimeCorr(), and setTimeCorr().

◆ m_tr

int ODTowersToByPassDat::m_tr
private

Definition at line 48 of file ODTowersToByPassDat.h.

Referenced by getTrId(), and setTrId().

◆ m_tt

int ODTowersToByPassDat::m_tt
private

Definition at line 50 of file ODTowersToByPassDat.h.

Referenced by getTTId(), and setTTId().