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
FEConfigBadTTDat Class Reference

#include <FEConfigBadTTDat.h>

Inheritance diagram for FEConfigBadTTDat:
IODConfig IDBObject

Public Member Functions

 FEConfigBadTTDat ()
 
int getFedId () const
 
int getId () const
 
int getStatus () const
 
std::string getTable ()
 
int getTCCId () const
 
int getTTId () const
 
void setFedId (int x)
 
void setId (int dac)
 
void setStatus (int dac)
 
void setTCCId (int dac)
 
void setTTId (int dac)
 
 ~FEConfigBadTTDat ()
 
- 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< FEConfigBadTTDat > *fillMap, FEConfigBadTTInfo *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::vector< FEConfigBadTTDat > &data, FEConfigBadTTInfo *iov) throw (std::runtime_error)
 
void writeDB (const FEConfigBadTTDat *item, FEConfigBadTTInfo *iov) throw (std::runtime_error)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_t1
 
int m_tcc
 
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 10 of file FEConfigBadTTDat.h.

Constructor & Destructor Documentation

FEConfigBadTTDat::FEConfigBadTTDat ( )

Definition at line 10 of file FEConfigBadTTDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17  m_tcc = 0;
18  m_fed = 0;
19  m_tt = 0;
20  m_t1 = 0;
21 
22 }
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
FEConfigBadTTDat::~FEConfigBadTTDat ( )

Definition at line 26 of file FEConfigBadTTDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 68 of file FEConfigBadTTDat.cc.

References alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setStatus(), setTCCId(), and setTTId().

70 {
71  this->checkConnection();
72 
73  iov->setConnection(m_env, m_conn);
74  int iovID = iov->fetchID();
75  if (!iovID) {
76  // throw(std::runtime_error("FEConfigBadTTDat::writeDB: IOV not in DB"));
77  return;
78  }
79 
80  try {
81  m_readStmt->setSQL("SELECT * FROM " + getTable() + " WHERE rec_id = :rec_id order by tcc_id, fed_id, tt_id ");
82  m_readStmt->setInt(1, iovID);
83  ResultSet* rset = m_readStmt->executeQuery();
84 
85  // std::vector< FEConfigBadTTDat > p;
86  FEConfigBadTTDat dat;
87  while(rset->next()) {
88  // dat.setId( rset->getInt(1) );
89  dat.setTCCId( rset->getInt(2) );
90  dat.setFedId( rset->getInt(3) );
91  dat.setTTId( rset->getInt(4) );
92  dat.setStatus( rset->getInt(5) );
93 
94  p->push_back( dat);
95 
96  }
97  } catch (SQLException &e) {
98  throw(std::runtime_error("FEConfigBadTTDat::fetchData(): "+e.getMessage()));
99  }
100 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTCCId(int dac)
void setFedId(int x)
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setStatus(int dac)
void setTTId(int dac)
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
Statement * m_readStmt
Definition: IODConfig.h:37
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
std::string getTable()
void checkConnection() const
Definition: IDBObject.h:41
int FEConfigBadTTDat::getFedId ( ) const
inline

Definition at line 23 of file FEConfigBadTTDat.h.

References m_fed.

Referenced by writeArrayDB().

23 { return m_fed; }
int FEConfigBadTTDat::getId ( ) const
inline

Definition at line 20 of file FEConfigBadTTDat.h.

References m_ID.

20 { return m_ID; }
int FEConfigBadTTDat::getStatus ( void  ) const
inline

Definition at line 33 of file FEConfigBadTTDat.h.

References m_t1.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

33 { return m_t1; }
std::string FEConfigBadTTDat::getTable ( )
inlinevirtual

Implements IODConfig.

Definition at line 17 of file FEConfigBadTTDat.h.

17 { return "FE_CONFIG_BadTT_DAT"; }
int FEConfigBadTTDat::getTCCId ( ) const
inline

Definition at line 26 of file FEConfigBadTTDat.h.

References m_tcc.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

26 { return m_tcc; }
int FEConfigBadTTDat::getTTId ( ) const
inline

Definition at line 29 of file FEConfigBadTTDat.h.

References m_tt.

Referenced by popcon::EcalTPGBadTTHandler::getNewObjects(), and writeArrayDB().

29 { return m_tt; }
void FEConfigBadTTDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IODConfig.

Definition at line 32 of file FEConfigBadTTDat.cc.

References alignCSCRings::e.

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

Definition at line 22 of file FEConfigBadTTDat.h.

References m_fed, and x.

Referenced by fetchData().

void FEConfigBadTTDat::setId ( int  dac)
inline

Definition at line 19 of file FEConfigBadTTDat.h.

References m_ID.

19 { m_ID = dac; }
void FEConfigBadTTDat::setStatus ( int  dac)
inline

Definition at line 32 of file FEConfigBadTTDat.h.

References m_t1.

Referenced by fetchData().

32 { m_t1 = dac; }
void FEConfigBadTTDat::setTCCId ( int  dac)
inline

Definition at line 25 of file FEConfigBadTTDat.h.

References m_tcc.

Referenced by fetchData().

25 { m_tcc = dac; }
void FEConfigBadTTDat::setTTId ( int  dac)
inline

Definition at line 28 of file FEConfigBadTTDat.h.

References m_tt.

Referenced by fetchData().

28 { m_tt = dac; }
void FEConfigBadTTDat::writeArrayDB ( const std::vector< FEConfigBadTTDat > &  data,
FEConfigBadTTInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 104 of file FEConfigBadTTDat.cc.

References prof2calltree::count, data, alignCSCRings::e, getFedId(), getStatus(), getTCCId(), getTTId(), and o2o::iov.

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

Definition at line 48 of file FEConfigBadTTDat.cc.

References alignCSCRings::e.

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

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 12 of file FEConfigBadTTDat.h.

Member Data Documentation

int FEConfigBadTTDat::m_fed
private

Definition at line 51 of file FEConfigBadTTDat.h.

Referenced by getFedId(), and setFedId().

int FEConfigBadTTDat::m_ID
private

Definition at line 54 of file FEConfigBadTTDat.h.

Referenced by getId(), and setId().

int FEConfigBadTTDat::m_t1
private

Definition at line 53 of file FEConfigBadTTDat.h.

Referenced by getStatus(), and setStatus().

int FEConfigBadTTDat::m_tcc
private

Definition at line 50 of file FEConfigBadTTDat.h.

Referenced by getTCCId(), and setTCCId().

int FEConfigBadTTDat::m_tt
private

Definition at line 52 of file FEConfigBadTTDat.h.

Referenced by getTTId(), and setTTId().