14 m_writeStmt =
nullptr;
32 this->checkConnection();
35 m_writeStmt = m_conn->createStatement();
36 m_writeStmt->setSQL(
"INSERT INTO mon_h4_table_position_dat (iov_id, logic_id, " 38 "VALUES (:iov_id, :logic_id, " 40 }
catch (SQLException &
e) {
41 throw(std::runtime_error(
std::string(
"MonH4TablePositionDat::prepareWrite(): ")+getOraMessage(&e)));
50 this->checkConnection();
53 int iovID = iov->fetchID();
54 if (!iovID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: IOV not in DB")); }
56 int logicID = ecid->getLogicID();
57 if (!logicID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: Bad EcalLogicID")); }
60 m_writeStmt->setInt(1, iovID);
61 m_writeStmt->setInt(2, logicID);
63 m_writeStmt->setFloat(3, item->getTableX() );
64 m_writeStmt->setFloat(4, item->getTableY() );
66 m_writeStmt->executeUpdate();
67 }
catch (SQLException &
e) {
68 throw(std::runtime_error(
std::string(
"MonH4TablePositionDat::writeDB(): ")+getOraMessage(&e)));
77 this->checkConnection();
80 iov->setConnection(m_env, m_conn);
81 int iovID = iov->fetchID();
89 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 90 "d.table_x, d.table_y " 91 "FROM channelview cv JOIN mon_h4_table_position_dat d " 92 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 93 "WHERE d.iov_id = :iov_id");
94 m_readStmt->setInt(1, iovID);
95 ResultSet* rset = m_readStmt->executeQuery();
97 std::pair< EcalLogicID, MonH4TablePositionDat >
p;
105 getOraString(rset,6));
113 }
catch (SQLException &
e) {
114 throw(std::runtime_error(
std::string(
"MonH4TablePositionDat::fetchData(): ")+getOraMessage(&e)));
121 this->checkConnection();
122 this->checkPrepare();
124 int iovID = iov->fetchID();
125 if (!iovID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: IOV not in DB")); }
128 int nrows=
data->size();
129 int* ids=
new int[nrows];
130 int* iovid_vec=
new int[nrows];
131 float*
xx=
new float[nrows];
132 float*
yy=
new float[nrows];
135 ub2* ids_len=
new ub2[nrows];
136 ub2* iov_len=
new ub2[nrows];
137 ub2* x_len=
new ub2[nrows];
138 ub2* y_len=
new ub2[nrows];
143 typedef map< EcalLogicID, MonH4TablePositionDat >::const_iterator CI;
144 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
145 channel = &(
p->first);
147 if (!logicID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: Bad EcalLogicID")); }
149 iovid_vec[
count]=iovID;
151 dataitem = &(
p->second);
170 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
171 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
172 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
173 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
175 m_writeStmt->executeArrayUpdate(nrows);
187 }
catch (SQLException &
e) {
188 throw(std::runtime_error(
std::string(
"MonH4TablePositionDat::writeArrayDB(): ")+getOraMessage(&e)));
void writeArrayDB(const std::map< EcalLogicID, MonH4TablePositionDat > *data, MonRunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
void fetchData(std::map< EcalLogicID, MonH4TablePositionDat > *fillMap, MonRunIOV *iov) noexcept(false)
~MonH4TablePositionDat() override
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const MonH4TablePositionDat *item, MonRunIOV *iov) noexcept(false)