17 m_processedEvents = 0;
18 m_problematicEvents = 0;
37 this->checkConnection();
40 m_writeStmt = m_conn->createStatement();
41 m_writeStmt->setSQL(
"INSERT INTO mon_tt_consistency_dat (iov_id, logic_id, " 42 "processed_events, problematic_events, problems_id, problems_size, problems_LV1, problems_bunch_X, task_status) " 43 "VALUES (:iov_id, :logic_id, " 44 ":3, :4, :5, :6, :7, :8, :9)");
45 }
catch (SQLException &
e) {
46 throw(std::runtime_error(
"MonTTConsistencyDat::prepareWrite(): "+e.getMessage()));
55 this->checkConnection();
58 int iovID = iov->fetchID();
59 if (!iovID) {
throw(std::runtime_error(
"MonTTConsistencyDat::writeDB: IOV not in DB")); }
61 int logicID = ecid->getLogicID();
62 if (!logicID) {
throw(std::runtime_error(
"MonTTConsistencyDat::writeDB: Bad EcalLogicID")); }
65 m_writeStmt->setInt(1, iovID);
66 m_writeStmt->setInt(2, logicID);
68 m_writeStmt->setInt(3, item->getProcessedEvents() );
69 m_writeStmt->setInt(4, item->getProblematicEvents() );
70 m_writeStmt->setInt(5, item->getProblemsID() );
71 m_writeStmt->setInt(6, item->getProblemsSize() );
72 m_writeStmt->setInt(7, item->getProblemsLV1() );
73 m_writeStmt->setInt(8, item->getProblemsBunchX() );
74 m_writeStmt->setInt(9, item->getTaskStatus() );
75 m_writeStmt->executeUpdate();
76 }
catch (SQLException &
e) {
77 throw(std::runtime_error(
"MonTTConsistencyDat::writeDB(): "+e.getMessage()));
86 this->checkConnection();
89 iov->setConnection(m_env, m_conn);
90 int iovID = iov->fetchID();
98 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 99 "d.processed_events, d.problematic_events, d.problems_id, d.problems_size, d.problems_LV1, d.problems_bunch_X, d.task_status " 100 "FROM channelview cv JOIN mon_tt_consistency_dat d " 101 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 102 "WHERE d.iov_id = :iov_id");
103 m_readStmt->setInt(1, iovID);
104 ResultSet* rset = m_readStmt->executeQuery();
106 std::pair< EcalLogicID, MonTTConsistencyDat >
p;
108 while(rset->next()) {
127 }
catch (SQLException &
e) {
128 throw(std::runtime_error(
"MonTTConsistencyDat::fetchData(): "+e.getMessage()));
135 this->checkConnection();
136 this->checkPrepare();
138 int iovID = iov->fetchID();
139 if (!iovID) {
throw(std::runtime_error(
"MonTTConsistencyDat::writeArrayDB: IOV not in DB")); }
142 int nrows=
data->size();
143 int* ids=
new int[nrows];
144 int* iovid_vec=
new int[nrows];
145 int*
xx=
new int[nrows];
146 int*
yy=
new int[nrows];
147 int*
zz=
new int[nrows];
148 int* ww=
new int[nrows];
149 int* uu=
new int[nrows];
150 int*
tt=
new int[nrows];
151 int* st=
new int[nrows];
153 ub2* ids_len=
new ub2[nrows];
154 ub2* iov_len=
new ub2[nrows];
155 ub2* x_len=
new ub2[nrows];
156 ub2* y_len=
new ub2[nrows];
157 ub2* z_len=
new ub2[nrows];
158 ub2* w_len=
new ub2[nrows];
159 ub2* u_len=
new ub2[nrows];
160 ub2* t_len=
new ub2[nrows];
161 ub2* st_len=
new ub2[nrows];
166 typedef map< EcalLogicID, MonTTConsistencyDat >::const_iterator CI;
167 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
168 channel = &(
p->first);
170 if (!logicID) {
throw(std::runtime_error(
"MonTTConsistencyDat::writeArrayDB: Bad EcalLogicID")); }
172 iovid_vec[
count]=iovID;
174 dataitem = &(
p->second);
211 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
212 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
213 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
214 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
215 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
216 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT ,
sizeof(ww[0]), w_len );
217 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT ,
sizeof(uu[0]), u_len );
218 m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIINT ,
sizeof(tt[0]), t_len );
219 m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
222 m_writeStmt->executeArrayUpdate(nrows);
246 }
catch (SQLException &
e) {
247 throw(std::runtime_error(
"MonTTConsistencyDat::writeArrayDB(): "+e.getMessage()));
void setProblematicEvents(int prob)
void writeArrayDB(const std::map< EcalLogicID, MonTTConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
int getProblematicEvents() const
void setProblemsLV1(int LV1)
int getProblemsLV1() const
void setProblemsSize(int size)
int getProblemsID() const
void prepareWrite() noexcept(false)
void setProcessedEvents(int proc)
int getProcessedEvents() const
void setProblemsID(int id)
void setProblemsBunchX(int bunchX)
void fetchData(std::map< EcalLogicID, MonTTConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
bool getTaskStatus() const
void writeDB(const EcalLogicID *ecid, const MonTTConsistencyDat *item, MonRunIOV *iov) noexcept(false)
void setTaskStatus(bool status)
int getProblemsBunchX() const
char data[epos_bytes_allocation]
int getProblemsSize() const