14 m_writeStmt =
nullptr;
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO mon_led1_dat (iov_id, logic_id, " 41 "vpt_mean, vpt_rms, vpt_over_pn_mean, vpt_over_pn_rms, task_status) " 42 "VALUES (:iov_id, :logic_id, " 43 ":vpt_mean, :vpt_rms, :vpt_over_pn_mean, :vpt_over_pn_rms, :task_status)");
44 }
catch (SQLException &
e) {
45 throw(std::runtime_error(
std::string(
"MonLed1Dat::prepareWrite(): ")+getOraMessage(&e)));
54 this->checkConnection();
57 int iovID = iov->fetchID();
58 if (!iovID) {
throw(std::runtime_error(
"MonLed1Dat::writeDB: IOV not in DB")); }
60 int logicID = ecid->getLogicID();
61 if (!logicID) {
throw(std::runtime_error(
"MonLed1Dat::writeDB: Bad EcalLogicID")); }
64 m_writeStmt->setInt(1, iovID);
65 m_writeStmt->setInt(2, logicID);
67 m_writeStmt->setFloat(3, item->getVPTMean() );
68 m_writeStmt->setFloat(4, item->getVPTRMS() );
69 m_writeStmt->setFloat(5, item->getVPTOverPNMean() );
70 m_writeStmt->setFloat(6, item->getVPTOverPNRMS() );
71 m_writeStmt->setInt(7, item->getTaskStatus() );
73 m_writeStmt->executeUpdate();
74 }
catch (SQLException &
e) {
75 throw(std::runtime_error(
std::string(
"MonLed1Dat::writeDB(): ")+getOraMessage(&e)));
84 this->checkConnection();
88 iov->setConnection(m_env, m_conn);
89 int iovID = iov->fetchID();
97 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 98 "d.vpt_mean, d.vpt_rms, d.vpt_over_pn_mean, d.vpt_over_pn_rms, d.task_status " 99 "FROM channelview cv JOIN mon_led1_dat d " 100 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 101 "WHERE d.iov_id = :iov_id");
102 m_readStmt->setInt(1, iovID);
103 ResultSet* rset = m_readStmt->executeQuery();
105 std::pair< EcalLogicID, MonLed1Dat >
p;
107 while(rset->next()) {
113 getOraString(rset,6));
125 }
catch (SQLException &
e) {
126 throw(std::runtime_error(
std::string(
"MonLed1Dat::fetchData(): ")+getOraMessage(&e)));
133 this->checkConnection();
134 this->checkPrepare();
136 int iovID = iov->fetchID();
137 if (!iovID) {
throw(std::runtime_error(
"MonLed1Dat::writeArrayDB: IOV not in DB")); }
140 int nrows=
data->size();
141 int* ids=
new int[nrows];
142 int* iovid_vec=
new int[nrows];
143 float*
xx=
new float[nrows];
144 float*
yy=
new float[nrows];
145 float*
zz=
new float[nrows];
146 float* ww=
new float[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* st_len=
new ub2[nrows];
160 typedef map< EcalLogicID, MonLed1Dat >::const_iterator CI;
161 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
162 channel = &(
p->first);
164 if (!logicID) {
throw(std::runtime_error(
"MonLed1Dat::writeArrayDB: Bad EcalLogicID")); }
166 iovid_vec[
count]=iovID;
168 dataitem = &(
p->second);
199 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
200 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
201 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
202 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
203 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
204 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT ,
sizeof(ww[0]), w_len );
205 m_writeStmt->setDataBuffer(7, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
208 m_writeStmt->executeArrayUpdate(nrows);
228 }
catch (SQLException &
e) {
229 throw(std::runtime_error(
std::string(
"MonLed1Dat::writeArrayDB(): ")+getOraMessage(&e)));
bool getTaskStatus() const
float getVPTOverPNRMS() const
float getVPTOverPNMean() const
void prepareWrite() noexcept(false) override
void writeDB(const EcalLogicID *ecid, const MonLed1Dat *item, MonRunIOV *iov) noexcept(false)
void setVPTOverPNMean(float mean)
void setTaskStatus(bool status)
void writeArrayDB(const std::map< EcalLogicID, MonLed1Dat > *data, MonRunIOV *iov) noexcept(false)
void setVPTRMS(float rms)
char data[epos_bytes_allocation]
void fetchData(std::map< EcalLogicID, MonLed1Dat > *fillMap, MonRunIOV *iov) noexcept(false)
void setVPTMean(float mean)
void setVPTOverPNRMS(float rms)