8 using namespace oracle::occi;
13 m_writeStmt =
nullptr;
16 m_processedEvents = 0;
17 m_problematicEvents = 0;
28 this->checkConnection();
31 m_writeStmt = m_conn->createStatement();
33 "INSERT INTO mon_mem_tt_consistency_dat (iov_id, logic_id, "
34 "processed_events, problematic_events, problems_id, problems_size, problems_LV1, problems_bunch_X, "
36 "VALUES (:iov_id, :logic_id, "
37 ":3, :4, :5, :6, :7, :8, :9)");
38 }
catch (SQLException&
e) {
39 throw(std::runtime_error(
"MonMemTTConsistencyDat::prepareWrite(): " + e.getMessage()));
46 this->checkConnection();
49 int iovID = iov->fetchID();
51 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeDB: IOV not in DB"));
54 int logicID = ecid->getLogicID();
56 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeDB: Bad EcalLogicID"));
60 m_writeStmt->setInt(1, iovID);
61 m_writeStmt->setInt(2, logicID);
63 m_writeStmt->setInt(3,
item->getProcessedEvents());
64 m_writeStmt->setInt(4,
item->getProblematicEvents());
65 m_writeStmt->setInt(5,
item->getProblemsID());
66 m_writeStmt->setInt(6,
item->getProblemsSize());
67 m_writeStmt->setInt(7,
item->getProblemsLV1());
68 m_writeStmt->setInt(8,
item->getProblemsBunchX());
69 m_writeStmt->setInt(9,
item->getTaskStatus());
70 m_writeStmt->executeUpdate();
71 }
catch (SQLException&
e) {
72 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeDB(): " + e.getMessage()));
78 this->checkConnection();
81 iov->setConnection(m_env, m_conn);
82 int iovID = iov->fetchID();
90 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91 "d.processed_events, d.problematic_events, d.problems_id, d.problems_size, d.problems_LV1, d.problems_bunch_X, "
93 "FROM channelview cv JOIN mon_mem_tt_consistency_dat d "
94 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
95 "WHERE d.iov_id = :iov_id");
96 m_readStmt->setInt(1, iovID);
97 ResultSet* rset = m_readStmt->executeQuery();
99 std::pair<EcalLogicID, MonMemTTConsistencyDat>
p;
101 while (rset->next()) {
120 }
catch (SQLException&
e) {
121 throw(std::runtime_error(
"MonMemTTConsistencyDat::fetchData(): " + e.getMessage()));
127 this->checkConnection();
128 this->checkPrepare();
130 int iovID = iov->fetchID();
132 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeArrayDB: IOV not in DB"));
135 int nrows =
data->size();
136 int* ids =
new int[nrows];
137 int* iovid_vec =
new int[nrows];
138 int* xx =
new int[nrows];
139 int* yy =
new int[nrows];
140 int* zz =
new int[nrows];
141 int* ww =
new int[nrows];
142 int* uu =
new int[nrows];
143 int*
tt =
new int[nrows];
144 int* st =
new int[nrows];
146 ub2* ids_len =
new ub2[nrows];
147 ub2* iov_len =
new ub2[nrows];
148 ub2* x_len =
new ub2[nrows];
149 ub2* y_len =
new ub2[nrows];
150 ub2* z_len =
new ub2[nrows];
151 ub2* w_len =
new ub2[nrows];
152 ub2* u_len =
new ub2[nrows];
153 ub2* t_len =
new ub2[nrows];
154 ub2* st_len =
new ub2[nrows];
159 typedef map<EcalLogicID, MonMemTTConsistencyDat>::const_iterator CI;
160 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
161 channel = &(
p->first);
164 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeArrayDB: Bad EcalLogicID"));
166 ids[
count] = logicID;
167 iovid_vec[
count] = iovID;
169 dataitem = &(
p->second);
202 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
203 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
204 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len);
205 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT,
sizeof(yy[0]), y_len);
206 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT,
sizeof(zz[0]), z_len);
207 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT,
sizeof(ww[0]), w_len);
208 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIINT,
sizeof(uu[0]), u_len);
209 m_writeStmt->setDataBuffer(8, (dvoid*)tt, OCCIINT,
sizeof(tt[0]), t_len);
210 m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
212 m_writeStmt->executeArrayUpdate(nrows);
234 }
catch (SQLException&
e) {
235 throw(std::runtime_error(
"MonMemTTConsistencyDat::writeArrayDB(): " + e.getMessage()));
void writeDB(const EcalLogicID *ecid, const MonMemTTConsistencyDat *item, MonRunIOV *iov) noexcept(false)
void setProblemsID(int id)
~MonMemTTConsistencyDat() override
int getProblematicEvents() const
int getProcessedEvents() const
void setProblemsBunchX(int bunchX)
int getProblemsLV1() const
void setProblematicEvents(int prob)
int getProblemsBunchX() const
int getProblemsSize() const
void fetchData(std::map< EcalLogicID, MonMemTTConsistencyDat > *fillVec, MonRunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
static std::vector< std::string > checklist dat
void setProcessedEvents(int proc)
void setProblemsLV1(int LV1)
void setTaskStatus(bool status)
char data[epos_bytes_allocation]
void setProblemsSize(int size)
int getProblemsID() const
void writeArrayDB(const std::map< EcalLogicID, MonMemTTConsistencyDat > *data, MonRunIOV *iov) noexcept(false)
bool getTaskStatus() const