15 m_writeStmt =
nullptr;
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO "+ getTable()+
" (fgr_conf_id, logic_id, " 41 " fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) " 42 "VALUES (:fgr_conf_id, :logic_id, " 43 " :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )" );
44 }
catch (SQLException &
e) {
45 throw(std::runtime_error(
std::string(
"FEConfigFgrParamDat::prepareWrite(): ")+getOraMessage(&e)));
54 this->checkConnection();
57 int iconfID = iconf->fetchID();
58 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrParamDat::writeDB: ICONF not in DB")); }
60 int logicID = ecid->getLogicID();
61 if (!logicID) {
throw(std::runtime_error(
"FEConfigFgrParamDat::writeDB: Bad EcalLogicID")); }
64 m_writeStmt->setInt(1, iconfID);
65 m_writeStmt->setInt(2, logicID);
66 m_writeStmt->setFloat(3, item->getFGlowthresh());
67 m_writeStmt->setFloat(4, item->getFGhighthresh());
68 m_writeStmt->setFloat(5, item->getFGlowratio());
69 m_writeStmt->setFloat(6, item->getFGhighratio());
71 m_writeStmt->executeUpdate();
72 }
catch (SQLException &
e) {
73 throw(std::runtime_error(
std::string(
"FEConfigFgrParamDat::writeDB(): ")+getOraMessage(&e)));
82 this->checkConnection();
85 iconf->setConnection(m_env, m_conn);
86 int iconfID = iconf->fetchID();
94 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 95 " d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio " 96 "FROM channelview cv JOIN "+ getTable() +
" d " 97 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 98 "WHERE fgr_conf_id = :fgr_conf_id");
99 m_readStmt->setInt(1, iconfID);
100 ResultSet* rset = m_readStmt->executeQuery();
102 std::pair< EcalLogicID, FEConfigFgrParamDat >
p;
104 while(rset->next()) {
110 getOraString(rset,6));
120 }
catch (SQLException &
e) {
121 throw(std::runtime_error(
std::string(
"FEConfigFgrParamDat::fetchData: ")+getOraMessage(&e)));
128 this->checkConnection();
129 this->checkPrepare();
131 int iconfID = iconf->fetchID();
132 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrParamDat::writeArrayDB: ICONF not in DB")); }
135 int nrows=
data->size();
136 int*
ids=
new int[nrows];
137 int* iov_vec=
new int[nrows];
138 float* ww=
new float[nrows];
139 float* uu=
new float[nrows];
140 float*
tt=
new float[nrows];
141 float* st=
new float[nrows];
143 ub2* ids_len=
new ub2[nrows];
144 ub2* iov_len=
new ub2[nrows];
145 ub2* w_len=
new ub2[nrows];
146 ub2* u_len=
new ub2[nrows];
147 ub2* t_len=
new ub2[nrows];
148 ub2* st_len=
new ub2[nrows];
153 typedef map< EcalLogicID, FEConfigFgrParamDat >::const_iterator CI;
154 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
155 channel = &(
p->first);
157 if (!logicID) {
throw(std::runtime_error(
"FEConfigFgrParamDat::writeArrayDB: Bad EcalLogicID")); }
159 iov_vec[
count]=iconfID;
161 dataitem = &(
p->second);
187 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]),iov_len);
188 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
189 m_writeStmt->setDataBuffer(3, (dvoid*)ww, OCCIFLOAT ,
sizeof(ww[0]), w_len );
190 m_writeStmt->setDataBuffer(4, (dvoid*)uu, OCCIFLOAT ,
sizeof(uu[0]), u_len );
191 m_writeStmt->setDataBuffer(5, (dvoid*)tt, OCCIFLOAT ,
sizeof(tt[0]), t_len );
192 m_writeStmt->setDataBuffer(6, (dvoid*)st, OCCIFLOAT ,
sizeof(st[0]), st_len );
195 m_writeStmt->executeArrayUpdate(nrows);
211 }
catch (SQLException &
e) {
212 throw(std::runtime_error(
std::string(
"FEConfigFgrParamDat::writeArrayDB(): ")+getOraMessage(&e)));
float getFGlowthresh() const
void fetchData(std::map< EcalLogicID, FEConfigFgrParamDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
float getFGhighthresh() const
~FEConfigFgrParamDat() override
void setFGhighratio(float x)
void setFGlowthresh(float x)
float getFGhighratio() const
void writeDB(const EcalLogicID *ecid, const FEConfigFgrParamDat *item, FEConfigFgrInfo *iconf) noexcept(false)
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrParamDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
void prepareWrite() noexcept(false) override
float getFGlowratio() const
void setFGlowratio(float x)
char data[epos_bytes_allocation]
void setFGhighthresh(float x)