14 m_writeStmt =
nullptr;
26 this->checkConnection();
29 m_writeStmt = m_conn->createStatement();
30 m_writeStmt->setSQL(
"INSERT INTO " + getTable() +
31 " (fgr_conf_id, logic_id, " 32 " fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) " 33 "VALUES (:fgr_conf_id, :logic_id, " 34 " :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )");
35 }
catch (SQLException&
e) {
36 throw(std::runtime_error(
"FEConfigFgrParamDat::prepareWrite(): " +
e.getMessage()));
43 this->checkConnection();
46 int iconfID = iconf->fetchID();
48 throw(std::runtime_error(
"FEConfigFgrParamDat::writeDB: ICONF not in DB"));
51 int logicID = ecid->getLogicID();
53 throw(std::runtime_error(
"FEConfigFgrParamDat::writeDB: Bad EcalLogicID"));
57 m_writeStmt->setInt(1, iconfID);
58 m_writeStmt->setInt(2, logicID);
59 m_writeStmt->setFloat(3,
item->getFGlowthresh());
60 m_writeStmt->setFloat(4,
item->getFGhighthresh());
61 m_writeStmt->setFloat(5,
item->getFGlowratio());
62 m_writeStmt->setFloat(6,
item->getFGhighratio());
64 m_writeStmt->executeUpdate();
65 }
catch (SQLException&
e) {
66 throw(std::runtime_error(
"FEConfigFgrParamDat::writeDB(): " +
e.getMessage()));
72 this->checkConnection();
75 iconf->setConnection(m_env, m_conn);
76 int iconfID = iconf->fetchID();
84 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 85 " d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio " 86 "FROM channelview cv JOIN " +
89 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 90 "WHERE fgr_conf_id = :fgr_conf_id");
91 m_readStmt->setInt(1, iconfID);
92 ResultSet* rset = m_readStmt->executeQuery();
94 std::pair<EcalLogicID, FEConfigFgrParamDat>
p;
96 while (rset->next()) {
112 }
catch (SQLException&
e) {
113 throw(std::runtime_error(
"FEConfigFgrParamDat::fetchData: " +
e.getMessage()));
119 this->checkConnection();
120 this->checkPrepare();
122 int iconfID = iconf->fetchID();
124 throw(std::runtime_error(
"FEConfigFgrParamDat::writeArrayDB: ICONF not in DB"));
127 int nrows =
data->size();
128 int* ids =
new int[nrows];
129 int* iov_vec =
new int[nrows];
130 float* ww =
new float[nrows];
131 float* uu =
new float[nrows];
132 float*
tt =
new float[nrows];
133 float* st =
new float[nrows];
135 ub2* ids_len =
new ub2[nrows];
136 ub2* iov_len =
new ub2[nrows];
137 ub2* w_len =
new ub2[nrows];
138 ub2* u_len =
new ub2[nrows];
139 ub2* t_len =
new ub2[nrows];
140 ub2* st_len =
new ub2[nrows];
145 typedef map<EcalLogicID, FEConfigFgrParamDat>::const_iterator CI;
146 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
147 channel = &(
p->first);
150 throw(std::runtime_error(
"FEConfigFgrParamDat::writeArrayDB: Bad EcalLogicID"));
152 ids[
count] = logicID;
153 iov_vec[
count] = iconfID;
155 dataitem = &(
p->second);
179 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]), iov_len);
180 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
181 m_writeStmt->setDataBuffer(3, (dvoid*)ww, OCCIFLOAT,
sizeof(ww[0]), w_len);
182 m_writeStmt->setDataBuffer(4, (dvoid*)uu, OCCIFLOAT,
sizeof(uu[0]), u_len);
183 m_writeStmt->setDataBuffer(5, (dvoid*)
tt, OCCIFLOAT,
sizeof(
tt[0]), t_len);
184 m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIFLOAT,
sizeof(st[0]), st_len);
186 m_writeStmt->executeArrayUpdate(nrows);
202 }
catch (SQLException&
e) {
203 throw(std::runtime_error(
"FEConfigFgrParamDat::writeArrayDB(): " +
e.getMessage()));
void fetchData(std::map< EcalLogicID, FEConfigFgrParamDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
~FEConfigFgrParamDat() override
void setFGhighratio(float x)
void setFGlowthresh(float x)
void writeDB(const EcalLogicID *ecid, const FEConfigFgrParamDat *item, FEConfigFgrInfo *iconf) noexcept(false)
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrParamDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
float getFGhighratio() const
void prepareWrite() noexcept(false) override
void setFGlowratio(float x)
char data[epos_bytes_allocation]
float getFGlowthresh() const
float getFGlowratio() const
void setFGhighthresh(float x)
float getFGhighthresh() const