13 m_writeStmt =
nullptr;
23 this->checkConnection();
26 m_writeStmt = m_conn->createStatement();
28 "INSERT INTO mon_h4_table_position_dat (iov_id, logic_id, " 30 "VALUES (:iov_id, :logic_id, " 32 }
catch (SQLException&
e) {
33 throw(std::runtime_error(
"MonH4TablePositionDat::prepareWrite(): " +
e.getMessage()));
40 this->checkConnection();
43 int iovID = iov->fetchID();
45 throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: IOV not in DB"));
48 int logicID = ecid->getLogicID();
50 throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: Bad EcalLogicID"));
54 m_writeStmt->setInt(1, iovID);
55 m_writeStmt->setInt(2, logicID);
57 m_writeStmt->setFloat(3,
item->getTableX());
58 m_writeStmt->setFloat(4,
item->getTableY());
60 m_writeStmt->executeUpdate();
61 }
catch (SQLException&
e) {
62 throw(std::runtime_error(
"MonH4TablePositionDat::writeDB(): " +
e.getMessage()));
68 this->checkConnection();
71 iov->setConnection(m_env, m_conn);
72 int iovID = iov->fetchID();
80 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 81 "d.table_x, d.table_y " 82 "FROM channelview cv JOIN mon_h4_table_position_dat d " 83 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 84 "WHERE d.iov_id = :iov_id");
85 m_readStmt->setInt(1, iovID);
86 ResultSet* rset = m_readStmt->executeQuery();
88 std::pair<EcalLogicID, MonH4TablePositionDat>
p;
90 while (rset->next()) {
104 }
catch (SQLException&
e) {
105 throw(std::runtime_error(
"MonH4TablePositionDat::fetchData(): " +
e.getMessage()));
111 this->checkConnection();
112 this->checkPrepare();
114 int iovID = iov->fetchID();
116 throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: IOV not in DB"));
119 int nrows =
data->size();
120 int* ids =
new int[nrows];
121 int* iovid_vec =
new int[nrows];
122 float*
xx =
new float[nrows];
123 float*
yy =
new float[nrows];
125 ub2* ids_len =
new ub2[nrows];
126 ub2* iov_len =
new ub2[nrows];
127 ub2* x_len =
new ub2[nrows];
128 ub2* y_len =
new ub2[nrows];
133 typedef map<EcalLogicID, MonH4TablePositionDat>::const_iterator CI;
134 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
135 channel = &(
p->first);
138 throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: Bad EcalLogicID"));
140 ids[
count] = logicID;
141 iovid_vec[
count] = iovID;
143 dataitem = &(
p->second);
161 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
162 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
163 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
164 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
166 m_writeStmt->executeArrayUpdate(nrows);
178 }
catch (SQLException&
e) {
179 throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB(): " +
e.getMessage()));
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)