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

#include <ODBadTTDat.h>

Inheritance diagram for ODBadTTDat:
IODConfig IDBObject

Public Member Functions

int getFedId () const
 
int getId () const
 
int getSMId () const
 
int getStatus () const
 
std::string getTable ()
 
int getTRId () const
 
int getTTId () const
 
 ODBadTTDat ()
 
void setFedId (int dac)
 
void setId (int dac)
 
void setSMId (int dac)
 
void setStatus (int dac)
 
void setTRId (int dac)
 
void setTTId (int dac)
 
 ~ODBadTTDat ()
 
- 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< ODBadTTDat > *fillMap, ODBadTTInfo *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeArrayDB (const std::vector< ODBadTTDat > data, ODBadTTInfo *iov) throw (std::runtime_error)
 
void writeDB (const ODBadTTDat *item, ODBadTTInfo *iov) throw (std::runtime_error)
 

Private Attributes

int m_fed
 
int m_ID
 
int m_sm
 
int m_t1
 
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 ODBadTTDat.h.

Constructor & Destructor Documentation

ODBadTTDat::ODBadTTDat ( )

Definition at line 10 of file ODBadTTDat.cc.

References NULL.

11 {
12  m_env = NULL;
13  m_conn = NULL;
14  m_writeStmt = NULL;
15  m_readStmt = NULL;
16 
17  m_sm = 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
ODBadTTDat::~ODBadTTDat ( )

Definition at line 26 of file ODBadTTDat.cc.

27 {
28 }

Member Function Documentation

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

Definition at line 68 of file ODBadTTDat.cc.

References alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setFedId(), setStatus(), setTRId(), 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("ODBadTTDat::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 tr_id, fed_id, tt_id ");
82  m_readStmt->setInt(1, iovID);
83  ResultSet* rset = m_readStmt->executeQuery();
84 
85  // std::vector< ODBadTTDat > p;
86  ODBadTTDat dat;
87  while(rset->next()) {
88  // dat.setId( rset->getInt(1) );
89  dat.setTRId( 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("ODBadTTDat::fetchData(): "+e.getMessage()));
99  }
100 }
void setFedId(int dac)
Definition: ODBadTTDat.h:28
std::string getTable()
Definition: ODBadTTDat.h:17
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setTRId(int dac)
Definition: ODBadTTDat.h:25
void setTTId(int dac)
Definition: ODBadTTDat.h:31
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void setStatus(int dac)
Definition: ODBadTTDat.h:35
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:21
Statement * m_readStmt
Definition: IODConfig.h:37
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int ODBadTTDat::getFedId ( ) const
inline

Definition at line 29 of file ODBadTTDat.h.

References m_fed.

Referenced by writeArrayDB().

29 { return m_fed; }
int ODBadTTDat::getId ( ) const
inline

Definition at line 20 of file ODBadTTDat.h.

References m_ID.

20 { return m_ID; }
int ODBadTTDat::getSMId ( ) const
inline

Definition at line 23 of file ODBadTTDat.h.

References m_sm.

23 { return m_sm; }
int ODBadTTDat::getStatus ( void  ) const
inline

Definition at line 36 of file ODBadTTDat.h.

References m_t1.

Referenced by writeArrayDB().

36 { return m_t1; }
std::string ODBadTTDat::getTable ( )
inlinevirtual

Implements IODConfig.

Definition at line 17 of file ODBadTTDat.h.

17 { return "BAD_TT_DAT"; }
int ODBadTTDat::getTRId ( ) const
inline

Definition at line 26 of file ODBadTTDat.h.

References m_sm.

Referenced by writeArrayDB().

26 { return m_sm; }
int ODBadTTDat::getTTId ( ) const
inline

Definition at line 32 of file ODBadTTDat.h.

References m_tt.

Referenced by writeArrayDB().

32 { return m_tt; }
void ODBadTTDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IODConfig.

Definition at line 32 of file ODBadTTDat.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, tr_id, fed_id, tt_id, status ) "
40  "VALUES (:1, :2, :3, :4, :5 )");
41  } catch (SQLException &e) {
42  throw(std::runtime_error("ODBadTTDat::prepareWrite(): "+e.getMessage()));
43  }
44 }
std::string getTable()
Definition: ODBadTTDat.h:17
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
void checkConnection() const
Definition: IDBObject.h:41
void ODBadTTDat::setFedId ( int  dac)
inline

Definition at line 28 of file ODBadTTDat.h.

References m_fed.

Referenced by fetchData().

28 { m_fed = dac; }
void ODBadTTDat::setId ( int  dac)
inline

Definition at line 19 of file ODBadTTDat.h.

References m_ID.

19 { m_ID = dac; }
void ODBadTTDat::setSMId ( int  dac)
inline

Definition at line 22 of file ODBadTTDat.h.

References m_sm.

22 { m_sm = dac; }
void ODBadTTDat::setStatus ( int  dac)
inline

Definition at line 35 of file ODBadTTDat.h.

References m_t1.

Referenced by fetchData().

35 { m_t1 = dac; }
void ODBadTTDat::setTRId ( int  dac)
inline

Definition at line 25 of file ODBadTTDat.h.

References m_sm.

Referenced by fetchData().

25 { m_sm = dac; }
void ODBadTTDat::setTTId ( int  dac)
inline

Definition at line 31 of file ODBadTTDat.h.

References m_tt.

Referenced by fetchData().

31 { m_tt = dac; }
void ODBadTTDat::writeArrayDB ( const std::vector< ODBadTTDat data,
ODBadTTInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 104 of file ODBadTTDat.cc.

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

106 {
107  this->checkConnection();
108 
109  int iovID = iov->fetchID();
110  if (!iovID) { throw(std::runtime_error("ODDelays::writeArrayDB: ODBadTTInfo 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  ODBadTTDat 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.getTRId();
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("ODBadTTDat::writeArrayDB(): "+e.getMessage()));
173  }
174 }
int getTTId() const
Definition: ODBadTTDat.h:32
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getTRId() const
Definition: ODBadTTDat.h:26
int getStatus() const
Definition: ODBadTTDat.h:36
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int getFedId() const
Definition: ODBadTTDat.h:29
void checkConnection() const
Definition: IDBObject.h:41
void ODBadTTDat::writeDB ( const ODBadTTDat item,
ODBadTTInfo iov 
)
throw (std::runtime_error
)
private

Definition at line 48 of file ODBadTTDat.cc.

References alignCSCRings::e.

50 {
51  this->checkConnection();
52 
53  try {
54  m_writeStmt->setInt(1, item->getId());
55  m_writeStmt->setInt(2, item->getTRId());
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("ODBadTTDat::writeDB(): "+e.getMessage()));
63  }
64 }
int getTTId() const
Definition: ODBadTTDat.h:32
Statement * m_writeStmt
Definition: IODConfig.h:36
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:22
int getTRId() const
Definition: ODBadTTDat.h:26
int getId() const
Definition: ODBadTTDat.h:20
int getStatus() const
Definition: ODBadTTDat.h:36
int getFedId() const
Definition: ODBadTTDat.h:29
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 12 of file ODBadTTDat.h.

Member Data Documentation

int ODBadTTDat::m_fed
private

Definition at line 54 of file ODBadTTDat.h.

Referenced by getFedId(), and setFedId().

int ODBadTTDat::m_ID
private

Definition at line 57 of file ODBadTTDat.h.

Referenced by getId(), and setId().

int ODBadTTDat::m_sm
private

Definition at line 53 of file ODBadTTDat.h.

Referenced by getSMId(), getTRId(), setSMId(), and setTRId().

int ODBadTTDat::m_t1
private

Definition at line 56 of file ODBadTTDat.h.

Referenced by getStatus(), and setStatus().

int ODBadTTDat::m_tt
private

Definition at line 55 of file ODBadTTDat.h.

Referenced by getTTId(), and setTTId().