15 m_writeStmt =
nullptr;
38 this->checkConnection();
41 m_writeStmt = m_conn->createStatement();
42 m_writeStmt->setSQL(
"INSERT INTO fe_fgr_per_group_dat (fgr_conf_id, group_id, " 43 " threshold_low, threshold_high, ratio_low, ratio_high, lut_value ) " 44 "VALUES (:fgr_conf_id, :group_id, " 45 ":3, :4, :5, :6, :7 )" );
46 }
catch (SQLException &
e) {
47 throw(std::runtime_error(
std::string(
"FEConfigFgrGroupDat::prepareWrite(): ")+getOraMessage(&e)));
56 this->checkConnection();
59 int iconfID = iconf->fetchID();
60 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrGroupDat::writeDB: ICONF not in DB")); }
67 m_writeStmt->setInt(1, iconfID);
69 m_writeStmt->setInt(2, item->getFgrGroupId());
70 m_writeStmt->setFloat(3, item->getThreshLow());
71 m_writeStmt->setFloat(4, item->getThreshHigh());
72 m_writeStmt->setFloat(5, item->getRatioLow());
73 m_writeStmt->setFloat(6, item->getRatioHigh());
74 m_writeStmt->setInt(7, item->getLUTValue());
76 m_writeStmt->executeUpdate();
77 }
catch (SQLException &
e) {
78 throw(std::runtime_error(
std::string(
"FEConfigFgrGroupDat::writeDB(): ")+getOraMessage(&e)));
87 this->checkConnection();
90 iconf->setConnection(m_env, m_conn);
91 int iconfID = iconf->fetchID();
93 throw(std::runtime_error(
"FEConfigFgrGroupDat::fetchData: ICONF not in DB"));
99 m_readStmt->setSQL(
"SELECT d.group_id, d.threshold_low, d.threshold_high, d.ratio_low, d.ratio_high, d.lut_value " 100 "FROM fe_fgr_per_group_dat d " 101 "WHERE fgr_conf_id = :fgr_conf_id order by d.group_id ");
102 m_readStmt->setInt(1, iconfID);
103 ResultSet* rset = m_readStmt->executeQuery();
105 std::pair< EcalLogicID, FEConfigFgrGroupDat >
p;
108 while(rset->next()) {
123 }
catch (SQLException &
e) {
124 throw(std::runtime_error(
std::string(
"FEConfigFgrGroupDat::fetchData: ")+getOraMessage(&e)));
131 this->checkConnection();
132 this->checkPrepare();
134 int iconfID = iconf->fetchID();
135 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrGroupDat::writeArrayDB: ICONF not in DB")); }
138 int nrows=
data->size();
139 int* ids=
new int[nrows];
140 int* iconfid_vec=
new int[nrows];
141 int*
xx=
new int[nrows];
142 float*
yy=
new float[nrows];
143 float*
zz=
new float[nrows];
144 float*
rr=
new float[nrows];
145 float* ss=
new float[nrows];
146 int*
tt=
new int[nrows];
149 ub2* ids_len=
new ub2[nrows];
150 ub2* iconf_len=
new ub2[nrows];
151 ub2* x_len=
new ub2[nrows];
152 ub2* y_len=
new ub2[nrows];
153 ub2* z_len=
new ub2[nrows];
154 ub2* r_len=
new ub2[nrows];
155 ub2* s_len=
new ub2[nrows];
156 ub2* t_len=
new ub2[nrows];
162 typedef map< EcalLogicID, FEConfigFgrGroupDat >::const_iterator CI;
163 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
168 iconfid_vec[
count]=iconfID;
170 dataitem = &(
p->second);
201 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
202 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len );
203 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
204 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
205 m_writeStmt->setDataBuffer(5, (dvoid*)rr, OCCIFLOAT ,
sizeof(rr[0]), r_len );
206 m_writeStmt->setDataBuffer(6, (dvoid*)ss, OCCIFLOAT ,
sizeof(ss[0]), s_len );
207 m_writeStmt->setDataBuffer(7, (dvoid*)tt, OCCIINT ,
sizeof(tt[0]), t_len );
209 m_writeStmt->executeArrayUpdate(nrows);
212 delete [] iconfid_vec;
229 }
catch (SQLException &
e) {
230 throw(std::runtime_error(
std::string(
"FEConfigFgrGroupDat::writeArrayDB(): ")+getOraMessage(&e)));
void setThreshLow(float x)
void setRatioHigh(float x)
void setThreshHigh(float x)
int getFgrGroupId() const
void prepareWrite() noexcept(false) override
float getRatioLow() const
~FEConfigFgrGroupDat() override
void setFgrGroupId(int x)
void fetchData(std::map< EcalLogicID, FEConfigFgrGroupDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
void setRatioLow(float x)
float getThreshLow() const
float getRatioHigh() const
char data[epos_bytes_allocation]
float getThreshHigh() const
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrGroupDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
void writeDB(const EcalLogicID *ecid, const FEConfigFgrGroupDat *item, FEConfigFgrInfo *iconf) noexcept(false)