15 m_writeStmt =
nullptr;
25 this->checkConnection();
28 m_writeStmt = m_conn->createStatement();
30 "INSERT INTO dcu_capsule_temp_raw_dat (iov_id, logic_id, " 31 "capsule_temp_adc, capsule_temp_rms) " 32 "VALUES (:iov_id, :logic_id, " 34 }
catch (SQLException&
e) {
35 throw(std::runtime_error(
"DCUCapsuleTempRawDat::prepareWrite(): " +
e.getMessage()));
41 DCUIOV* iov) noexcept(
false) {
42 this->checkConnection();
45 int iovID = iov->fetchID();
47 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeDB: IOV not in DB"));
50 int logicID = ecid->getLogicID();
52 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeDB: Bad EcalLogicID"));
56 m_writeStmt->setInt(1, iovID);
57 m_writeStmt->setInt(2, logicID);
59 m_writeStmt->setFloat(3,
item->getCapsuleTempADC());
60 m_writeStmt->setFloat(4,
item->getCapsuleTempRMS());
62 m_writeStmt->executeUpdate();
63 }
catch (SQLException&
e) {
64 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeDB(): " +
e.getMessage()));
69 DCUIOV* iov) noexcept(
false) {
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.capsule_temp_adc, d.capsule_temp_rms " 84 "FROM channelview cv JOIN dcu_capsule_temp_raw_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, DCUCapsuleTempRawDat>
p;
92 while (rset->next()) {
106 }
catch (SQLException&
e) {
107 throw(std::runtime_error(
"DCUCapsuleTempRawDat::fetchData(): " +
e.getMessage()));
112 DCUIOV* iov) noexcept(
false) {
113 this->checkConnection();
114 this->checkPrepare();
116 int iovID = iov->fetchID();
118 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeArrayDB: IOV not in DB"));
121 int nrows =
data->size();
122 int* ids =
new int[nrows];
123 int* iovid_vec =
new int[nrows];
124 float*
xx =
new float[nrows];
125 float*
yy =
new float[nrows];
127 ub2* ids_len =
new ub2[nrows];
128 ub2* iov_len =
new ub2[nrows];
129 ub2* x_len =
new ub2[nrows];
130 ub2* y_len =
new ub2[nrows];
135 typedef map<EcalLogicID, DCUCapsuleTempRawDat>::const_iterator CI;
136 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
137 channel = &(
p->first);
140 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeArrayDB: Bad EcalLogicID"));
142 ids[
count] = logicID;
143 iovid_vec[
count] = iovID;
145 dataitem = &(
p->second);
163 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
164 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
165 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
166 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
168 m_writeStmt->executeArrayUpdate(nrows);
180 }
catch (SQLException&
e) {
181 throw(std::runtime_error(
"DCUCapsuleTempRawDat::writeArrayDB(): " +
e.getMessage()));
void writeDB(const EcalLogicID *ecid, const DCUCapsuleTempRawDat *item, DCUIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
float getCapsuleTempRMS() const
void writeArrayDB(const std::map< EcalLogicID, DCUCapsuleTempRawDat > *data, DCUIOV *iov) noexcept(false)
float getCapsuleTempADC() const
void fetchData(std::map< EcalLogicID, DCUCapsuleTempRawDat > *fillVec, DCUIOV *iov) noexcept(false)
~DCUCapsuleTempRawDat() override
char data[epos_bytes_allocation]
void setCapsuleTempADC(float adc)
void setCapsuleTempRMS(float rms)