CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
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 ()
 
- 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) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::vector< ODTowersToByPassDat > &data, ODTowersToByPassInfo *iov) throw (std::runtime_error)
 
void writeDB (const ODTowersToByPassDat *item, ODTowersToByPassInfo *iov) throw (std::runtime_error)
 

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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) throw (std::runtime_error)
 
unsigned char * readClob (Clob &clob, int size) throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- 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 ( )

Definition at line 10 of file ODTowersToByPassDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17 
18  m_fed = 0;
19  m_tt = 0;
20  m_tr = 0;
21  m_time = 0;
22  m_sta = 0;
23 
24 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
#define NULL
Definition: scimark2.h:8
Statement * m_readStmt
Definition: IODConfig.h:37
ODTowersToByPassDat::~ODTowersToByPassDat ( )

Definition at line 28 of file ODTowersToByPassDat.cc.

29 {
30 }

Member Function Documentation

void ODTowersToByPassDat::fetchData ( std::vector< ODTowersToByPassDat > *  fillMap,
ODTowersToByPassInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 71 of file ODTowersToByPassDat.cc.

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

73 {
74  this->checkConnection();
75 
76  iov->setConnection(m_env, m_conn);
77  int iovID = iov->fetchID();
78  if (!iovID) {
79  std::cout <<"ID not in the DB"<< endl;
80  return;
81  }
82 
83  try {
84  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by fed_id, tr_id, tt_id ");
85  m_readStmt->setInt(1, iovID);
86  ResultSet* rset = m_readStmt->executeQuery();
87 
88  // std::vector< ODTowersToByPassDat > p;
90  while(rset->next()) {
91  // dat.setId( rset->getInt(1) );
92  dat.setFedId( rset->getInt(2) );
93  dat.setTrId( rset->getInt(3) );
94  dat.setTTId( rset->getInt(4) );
95  dat.setTimeCorr( rset->getInt(5) );
96  dat.setStatus( rset->getInt(6) );
97 
98  p->push_back( dat);
99 
100  }
101 
102 
103  } catch (SQLException &e) {
104  throw(std::runtime_error("ODTowersToByPassDat::fetchData(): "+e.getMessage()));
105  }
106 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
Statement * m_readStmt
Definition: IODConfig.h:37
tuple cout
Definition: gather_cfg.py:145
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int ODTowersToByPassDat::getFedId ( ) const
inline

Definition at line 27 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by writeArrayDB().

27 { return m_fed; }
int ODTowersToByPassDat::getId ( ) const
inline

Definition at line 21 of file ODTowersToByPassDat.h.

References m_ID.

21 { return m_ID; }
int ODTowersToByPassDat::getStatus ( void  ) const
inline

Definition at line 36 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by writeArrayDB().

36 { return m_sta; }
std::string ODTowersToByPassDat::getTable ( )
inlinevirtual

Implements IODConfig.

Definition at line 18 of file ODTowersToByPassDat.h.

18 { return "TOWERS_TO_BYPASS_DAT"; }
int ODTowersToByPassDat::getTimeCorr ( ) const
inline

Definition at line 33 of file ODTowersToByPassDat.h.

References m_time.

Referenced by writeArrayDB().

33 { return m_time; }
int ODTowersToByPassDat::getTrId ( ) const
inline

Definition at line 24 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by writeArrayDB().

24 { return m_tr; }
int ODTowersToByPassDat::getTTId ( ) const
inline

Definition at line 30 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by writeArrayDB().

30 { return m_tt; }
void ODTowersToByPassDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IODConfig.

Definition at line 34 of file ODTowersToByPassDat.cc.

References alignCSCRings::e.

36 {
37  this->checkConnection();
38 
39  try {
40  m_writeStmt = m_conn->createStatement();
41  m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, fed_id, tr_id, tt_id, time_corr, STATUS ) "
42  "VALUES (:1, :2, :3, :4, :5 , :6 )");
43  } catch (SQLException &e) {
44  throw(std::runtime_error("ODTowersToByPassDat::prepareWrite(): "+e.getMessage()));
45  }
46 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void ODTowersToByPassDat::setFedId ( int  dac)
inline

Definition at line 26 of file ODTowersToByPassDat.h.

References m_fed.

Referenced by fetchData().

26 { m_fed = dac; }
void ODTowersToByPassDat::setId ( int  dac)
inline

Definition at line 20 of file ODTowersToByPassDat.h.

References m_ID.

20 { m_ID = dac; }
void ODTowersToByPassDat::setStatus ( int  dac)
inline

Definition at line 35 of file ODTowersToByPassDat.h.

References m_sta.

Referenced by fetchData().

35 { m_sta = dac; }
void ODTowersToByPassDat::setTimeCorr ( int  dac)
inline

Definition at line 32 of file ODTowersToByPassDat.h.

References m_time.

Referenced by fetchData().

32 { m_time = dac; }
void ODTowersToByPassDat::setTrId ( int  dac)
inline

Definition at line 23 of file ODTowersToByPassDat.h.

References m_tr.

Referenced by fetchData().

23 { m_tr = dac; }
void ODTowersToByPassDat::setTTId ( int  dac)
inline

Definition at line 29 of file ODTowersToByPassDat.h.

References m_tt.

Referenced by fetchData().

29 { m_tt = dac; }
void ODTowersToByPassDat::writeArrayDB ( const std::vector< ODTowersToByPassDat > &  data,
ODTowersToByPassInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 110 of file ODTowersToByPassDat.cc.

References KineDebug3::count(), data, alignCSCRings::e, getFedId(), getStatus(), getTimeCorr(), getTrId(), getTTId(), and o2o::iov.

112 {
113  this->checkConnection();
114 
115  int iovID = iov->fetchID();
116  if (!iovID) { throw(std::runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); }
117 
118 
119  int nrows=data.size();
120  int* ids= new int[nrows];
121  int* xx= new int[nrows];
122  int* yy= new int[nrows];
123  int* zz= new int[nrows];
124  int* ww= new int[nrows];
125  int* st= new int[nrows];
126 
127 
128 
129  ub2* ids_len= new ub2[nrows];
130  ub2* x_len= new ub2[nrows];
131  ub2* y_len= new ub2[nrows];
132  ub2* z_len= new ub2[nrows];
133  ub2* w_len= new ub2[nrows];
134  ub2* st_len= new ub2[nrows];
135 
136  ODTowersToByPassDat dataitem;
137 
138 
139  for (int count = 0; count != (int) data.size(); count++) {
140  dataitem=data[count];
141  ids[count]=iovID;
142  xx[count]=dataitem.getFedId();
143  yy[count]=dataitem.getTrId();
144  zz[count]=dataitem.getTTId();
145  ww[count]=dataitem.getTimeCorr();
146  st[count]=dataitem.getStatus();
147 
148 
149  ids_len[count]=sizeof(ids[count]);
150  x_len[count]=sizeof(xx[count]);
151  y_len[count]=sizeof(yy[count]);
152  z_len[count]=sizeof(zz[count]);
153  w_len[count]=sizeof(ww[count]);
154  st_len[count]=sizeof(st[count]);
155 
156 
157  }
158 
159 
160  try {
161  m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]),ids_len);
162  m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len );
163  m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len );
164  m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len );
165  m_writeStmt->setDataBuffer(5, (dvoid*)ww, OCCIINT , sizeof(ww[0]), w_len );
166  m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len );
167 
168 
169  m_writeStmt->executeArrayUpdate(nrows);
170 
171  delete [] ids;
172  delete [] xx;
173  delete [] yy;
174  delete [] zz;
175  delete [] ww;
176  delete [] st;
177 
178  delete [] ids_len;
179  delete [] x_len;
180  delete [] y_len;
181  delete [] z_len;
182  delete [] w_len;
183  delete [] st_len;
184 
185 
186  } catch (SQLException &e) {
187  throw(std::runtime_error("ODTowersToByPassDat::writeArrayDB(): "+e.getMessage()));
188  }
189 }
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void checkConnection() const
Definition: IDBObject.h:41
void ODTowersToByPassDat::writeDB ( const ODTowersToByPassDat item,
ODTowersToByPassInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 50 of file ODTowersToByPassDat.cc.

References alignCSCRings::e.

52 {
53  this->checkConnection();
54 
55  try {
56  m_writeStmt->setInt(1, item->getId());
57  m_writeStmt->setInt(2, item->getFedId() );
58  m_writeStmt->setInt(3, item->getTrId() );
59  m_writeStmt->setInt(4, item->getTTId() );
60  m_writeStmt->setInt(5, item->getTimeCorr() );
61  m_writeStmt->setInt(6, item->getStatus() );
62 
63  m_writeStmt->executeUpdate();
64  } catch (SQLException &e) {
65  throw(std::runtime_error("ODTowersToByPassDat::writeDB(): "+e.getMessage()));
66  }
67 }
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file ODTowersToByPassDat.h.

Member Data Documentation

int ODTowersToByPassDat::m_fed
private

Definition at line 55 of file ODTowersToByPassDat.h.

Referenced by getFedId(), and setFedId().

int ODTowersToByPassDat::m_ID
private

Definition at line 59 of file ODTowersToByPassDat.h.

Referenced by getId(), and setId().

int ODTowersToByPassDat::m_sta
private

Definition at line 58 of file ODTowersToByPassDat.h.

Referenced by getStatus(), and setStatus().

int ODTowersToByPassDat::m_time
private

Definition at line 57 of file ODTowersToByPassDat.h.

Referenced by getTimeCorr(), and setTimeCorr().

int ODTowersToByPassDat::m_tr
private

Definition at line 54 of file ODTowersToByPassDat.h.

Referenced by getTrId(), and setTrId().

int ODTowersToByPassDat::m_tt
private

Definition at line 56 of file ODTowersToByPassDat.h.

Referenced by getTTId(), and setTTId().