15 m_writeStmt =
nullptr;
26 this->checkConnection();
29 m_writeStmt = m_conn->createStatement();
31 "INSERT INTO cali_temp_dat (iov_id, logic_id, " 32 " beta, r25, offset, task_status) " 33 "VALUES (:iov_id, :logic_id, " 35 }
catch (SQLException&
e) {
36 throw(std::runtime_error(
"CaliTempDat::prepareWrite(): " +
e.getMessage()));
41 this->checkConnection();
44 int iovID = iov->fetchID();
46 throw(std::runtime_error(
"CaliTempDat::writeDB: IOV not in DB"));
49 int logicID = ecid->getLogicID();
51 throw(std::runtime_error(
"CaliTempDat::writeDB: Bad EcalLogicID"));
55 m_writeStmt->setInt(1, iovID);
56 m_writeStmt->setInt(2, logicID);
58 m_writeStmt->setFloat(3,
item->getBeta());
59 m_writeStmt->setFloat(4,
item->getR25());
60 m_writeStmt->setFloat(5,
item->getOffset());
61 m_writeStmt->setInt(6,
item->getTaskStatus());
63 m_writeStmt->executeUpdate();
64 }
catch (SQLException&
e) {
65 throw(std::runtime_error(
"CaliTempDat::writeDB(): " +
e.getMessage()));
70 this->checkConnection();
73 iov->setConnection(m_env, m_conn);
74 int iovID = iov->fetchID();
82 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 83 "d.beta, d.r25, d.offset, d.task_status " 84 "FROM channelview cv JOIN cali_temp_dat d " 85 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 86 "WHERE d.iov_id = :iov_id");
87 m_readStmt->setInt(1, iovID);
88 ResultSet* rset = m_readStmt->executeQuery();
90 std::pair<EcalLogicID, CaliTempDat>
p;
92 while (rset->next()) {
100 dat.
setBeta(rset->getFloat(7));
101 dat.
setR25(rset->getFloat(8));
108 }
catch (SQLException&
e) {
109 throw(std::runtime_error(
"CaliTempDat::fetchData(): " +
e.getMessage()));
114 this->checkConnection();
115 this->checkPrepare();
117 int iovID = iov->fetchID();
119 throw(std::runtime_error(
"CaliTempDat::writeArrayDB: IOV not in DB"));
122 int nrows =
data->size();
123 int* ids =
new int[nrows];
124 int* iovid_vec =
new int[nrows];
125 float*
xx =
new float[nrows];
126 float*
yy =
new float[nrows];
127 float*
zz =
new float[nrows];
128 int* st =
new int[nrows];
130 ub2* ids_len =
new ub2[nrows];
131 ub2* iov_len =
new ub2[nrows];
132 ub2* x_len =
new ub2[nrows];
133 ub2* y_len =
new ub2[nrows];
134 ub2* z_len =
new ub2[nrows];
135 ub2* st_len =
new ub2[nrows];
140 typedef map<EcalLogicID, CaliTempDat>::const_iterator CI;
141 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
142 channel = &(
p->first);
145 throw(std::runtime_error(
"CaliTempDat::writeArrayDB: Bad EcalLogicID"));
147 ids[
count] = logicID;
148 iovid_vec[
count] = iovID;
150 dataitem = &(
p->second);
174 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
175 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
176 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
177 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
178 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
179 m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
181 m_writeStmt->executeArrayUpdate(nrows);
198 }
catch (SQLException&
e) {
199 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): " +
e.getMessage()));
void prepareWrite() noexcept(false) override
void fetchData(std::map< EcalLogicID, CaliTempDat > *fillVec, CaliIOV *iov) noexcept(false)
bool getTaskStatus() const
void writeArrayDB(const std::map< EcalLogicID, CaliTempDat > *data, CaliIOV *iov) noexcept(false)
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const CaliTempDat *item, CaliIOV *iov) noexcept(false)
void setTaskStatus(bool s)