14 m_writeStmt =
nullptr;
28 this->checkConnection();
31 m_writeStmt = m_conn->createStatement();
33 "INSERT INTO fe_fgr_per_group_dat (fgr_conf_id, group_id, " 34 " threshold_low, threshold_high, ratio_low, ratio_high, lut_value ) " 35 "VALUES (:fgr_conf_id, :group_id, " 36 ":3, :4, :5, :6, :7 )");
37 }
catch (SQLException&
e) {
38 throw(std::runtime_error(
"FEConfigFgrGroupDat::prepareWrite(): " +
e.getMessage()));
45 this->checkConnection();
48 int iconfID = iconf->fetchID();
50 throw(std::runtime_error(
"FEConfigFgrGroupDat::writeDB: ICONF not in DB"));
58 m_writeStmt->setInt(1, iconfID);
60 m_writeStmt->setInt(2,
item->getFgrGroupId());
61 m_writeStmt->setFloat(3,
item->getThreshLow());
62 m_writeStmt->setFloat(4,
item->getThreshHigh());
63 m_writeStmt->setFloat(5,
item->getRatioLow());
64 m_writeStmt->setFloat(6,
item->getRatioHigh());
65 m_writeStmt->setInt(7,
item->getLUTValue());
67 m_writeStmt->executeUpdate();
68 }
catch (SQLException&
e) {
69 throw(std::runtime_error(
"FEConfigFgrGroupDat::writeDB(): " +
e.getMessage()));
75 this->checkConnection();
78 iconf->setConnection(m_env, m_conn);
79 int iconfID = iconf->fetchID();
81 throw(std::runtime_error(
"FEConfigFgrGroupDat::fetchData: ICONF not in DB"));
87 "SELECT d.group_id, d.threshold_low, d.threshold_high, d.ratio_low, d.ratio_high, d.lut_value " 88 "FROM fe_fgr_per_group_dat d " 89 "WHERE fgr_conf_id = :fgr_conf_id order by d.group_id ");
90 m_readStmt->setInt(1, iconfID);
91 ResultSet* rset = m_readStmt->executeQuery();
93 std::pair<EcalLogicID, FEConfigFgrGroupDat>
p;
96 while (rset->next()) {
111 }
catch (SQLException&
e) {
112 throw(std::runtime_error(
"FEConfigFgrGroupDat::fetchData: " +
e.getMessage()));
118 this->checkConnection();
119 this->checkPrepare();
121 int iconfID = iconf->fetchID();
123 throw(std::runtime_error(
"FEConfigFgrGroupDat::writeArrayDB: ICONF not in DB"));
126 int nrows =
data->size();
127 int* ids =
new int[nrows];
128 int* iconfid_vec =
new int[nrows];
129 int*
xx =
new int[nrows];
130 float*
yy =
new float[nrows];
131 float*
zz =
new float[nrows];
132 float*
rr =
new float[nrows];
133 float*
ss =
new float[nrows];
134 int*
tt =
new int[nrows];
136 ub2* ids_len =
new ub2[nrows];
137 ub2* iconf_len =
new ub2[nrows];
138 ub2* x_len =
new ub2[nrows];
139 ub2* y_len =
new ub2[nrows];
140 ub2* z_len =
new ub2[nrows];
141 ub2* r_len =
new ub2[nrows];
142 ub2* s_len =
new ub2[nrows];
143 ub2* t_len =
new ub2[nrows];
148 typedef map<EcalLogicID, FEConfigFgrGroupDat>::const_iterator CI;
149 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
154 iconfid_vec[
count] = iconfID;
156 dataitem = &(
p->second);
173 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
186 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
187 m_writeStmt->setDataBuffer(2, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
188 m_writeStmt->setDataBuffer(3, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
189 m_writeStmt->setDataBuffer(4, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
190 m_writeStmt->setDataBuffer(5, (dvoid*)
rr, OCCIFLOAT,
sizeof(
rr[0]), r_len);
191 m_writeStmt->setDataBuffer(6, (dvoid*)
ss, OCCIFLOAT,
sizeof(
ss[0]), s_len);
192 m_writeStmt->setDataBuffer(7, (dvoid*)
tt, OCCIINT,
sizeof(
tt[0]), t_len);
194 m_writeStmt->executeArrayUpdate(nrows);
197 delete[] iconfid_vec;
214 }
catch (SQLException&
e) {
215 throw(std::runtime_error(
"FEConfigFgrGroupDat::writeArrayDB(): " +
e.getMessage()));
void setThreshLow(float x)
int getFgrGroupId() const
float getRatioHigh() const
void setRatioHigh(float x)
void setThreshHigh(float x)
float getRatioLow() const
float getThreshHigh() const
void prepareWrite() noexcept(false) override
~FEConfigFgrGroupDat() override
void setFgrGroupId(int x)
void fetchData(std::map< EcalLogicID, FEConfigFgrGroupDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
void setRatioLow(float x)
float getThreshLow() const
char data[epos_bytes_allocation]
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrGroupDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
void writeDB(const EcalLogicID *ecid, const FEConfigFgrGroupDat *item, FEConfigFgrInfo *iconf) noexcept(false)