8 using namespace oracle::occi;
17 m_processedEvents = 0;
18 m_problematicEvents = 0;
20 m_problemsGainZero = 0;
21 m_problemsGainSwitch = 0;
34 throw(std::runtime_error)
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO mon_mem_ch_consistency_dat (iov_id, logic_id, "
41 "processed_events, problematic_events, problems_id, problems_gain_zero, problems_gain_switch, task_status) "
42 "VALUES (:iov_id, :logic_id, "
43 ":3, :4, :5, :6, :7, :8)");
45 throw(std::runtime_error(
"MonMemChConsistencyDat::prepareWrite(): "+e.getMessage()));
52 throw(std::runtime_error)
54 this->checkConnection();
57 int iovID =
iov->fetchID();
58 if (!iovID) {
throw(std::runtime_error(
"MonMemChConsistencyDat::writeDB: IOV not in DB")); }
60 int logicID = ecid->getLogicID();
61 if (!logicID) {
throw(std::runtime_error(
"MonMemChConsistencyDat::writeDB: Bad EcalLogicID")); }
64 m_writeStmt->setInt(1, iovID);
65 m_writeStmt->setInt(2, logicID);
67 m_writeStmt->setInt(3, item->getProcessedEvents() );
68 m_writeStmt->setInt(4, item->getProblematicEvents() );
69 m_writeStmt->setInt(5, item->getProblemsID() );
70 m_writeStmt->setInt(6, item->getProblemsGainZero() );
71 m_writeStmt->setInt(7, item->getProblemsGainSwitch() );
72 m_writeStmt->setInt(8, item->getTaskStatus() );
73 m_writeStmt->executeUpdate();
75 throw(std::runtime_error(
"MonMemChConsistencyDat::writeDB(): "+e.getMessage()));
82 throw(std::runtime_error)
84 this->checkConnection();
87 iov->setConnection(m_env, m_conn);
88 int iovID =
iov->fetchID();
96 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
97 "d.processed_events, d.problematic_events, d.problems_id, d.problems_gain_zero, d.problems_gain_switch, d.task_status "
98 "FROM channelview cv JOIN mon_mem_ch_consistency_dat d "
99 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
100 "WHERE d.iov_id = :iov_id");
101 m_readStmt->setInt(1, iovID);
102 ResultSet* rset = m_readStmt->executeQuery();
104 std::pair< EcalLogicID, MonMemChConsistencyDat >
p;
106 while(rset->next()) {
125 throw(std::runtime_error(
"MonMemChConsistencyDat::fetchData(): "+e.getMessage()));
130 throw(std::runtime_error)
132 this->checkConnection();
133 this->checkPrepare();
135 int iovID =
iov->fetchID();
136 if (!iovID) {
throw(std::runtime_error(
"MonMemChConsistencyDat::writeArrayDB: IOV not in DB")); }
139 int nrows=
data->size();
140 int* ids=
new int[nrows];
141 int* iovid_vec=
new int[nrows];
142 int* xx=
new int[nrows];
143 int* yy=
new int[nrows];
144 int* zz=
new int[nrows];
145 int* ww=
new int[nrows];
146 int* uu=
new int[nrows];
147 int* st=
new int[nrows];
149 ub2* ids_len=
new ub2[nrows];
150 ub2* iov_len=
new ub2[nrows];
151 ub2* x_len=
new ub2[nrows];
152 ub2* y_len=
new ub2[nrows];
153 ub2* z_len=
new ub2[nrows];
154 ub2* w_len=
new ub2[nrows];
155 ub2* u_len=
new ub2[nrows];
156 ub2* st_len=
new ub2[nrows];
161 typedef map< EcalLogicID, MonMemChConsistencyDat >::const_iterator CI;
162 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
163 channel = &(
p->first);
165 if (!logicID) {
throw(std::runtime_error(
"MonMemChConsistencyDat::writeArrayDB: Bad EcalLogicID")); }
167 iovid_vec[
count]=iovID;
169 dataitem = &(
p->second);
203 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
204 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
205 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
206 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
207 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
208 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT ,
sizeof(ww[0]), w_len );
209 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT ,
sizeof(uu[0]), u_len );
210 m_writeStmt->setDataBuffer(8, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
213 m_writeStmt->executeArrayUpdate(nrows);
236 throw(std::runtime_error(
"MonMemChConsistencyDat::writeArrayDB(): "+e.getMessage()));
int getProblemsID() const
int getProblemsGainSwitch() const
void setProcessedEvents(int proc)
int getProblemsGainZero() const
int getProblematicEvents() const
oracle::occi::SQLException SQLException
void setProblematicEvents(int prob)
bool getTaskStatus() const
void writeArrayDB(const std::map< EcalLogicID, MonMemChConsistencyDat > *data, MonRunIOV *iov)
void fetchData(std::map< EcalLogicID, MonMemChConsistencyDat > *fillVec, MonRunIOV *iov)
~MonMemChConsistencyDat()
void setProblemsID(int id)
void setTaskStatus(bool status)
oracle::occi::ResultSet ResultSet
void writeDB(const EcalLogicID *ecid, const MonMemChConsistencyDat *item, MonRunIOV *iov)
char data[epos_bytes_allocation]
void setProblemsGainZero(int prob)
void setProblemsGainSwitch(int prob)
void fillMap(Registry *reg, regmap_type &fillme)
int getProcessedEvents() const