15 m_writeStmt =
nullptr;
30 this->checkConnection();
33 m_writeStmt = m_conn->createStatement();
35 "INSERT INTO fe_weight2_per_group_dat (wei2_conf_id, group_id, " 36 " w0, w1, w2, w3, w4, w5 ) " 37 "VALUES (:wei2_conf_id, :group_id, " 38 ":w0, :w1, :w2, :w3, :w4, :w5 )");
39 }
catch (SQLException&
e) {
40 throw cms::Exception(
"SQLException") <<
"FEConfigOddWeightGroupDat::prepareWrite(): " <<
e.getMessage();
47 this->checkConnection();
50 int iconfID = iconf->fetchID();
52 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeDB: ICONF not in DB"));
60 m_writeStmt->setInt(1, iconfID);
62 m_writeStmt->setInt(2,
item->getWeightGroupId());
63 m_writeStmt->setFloat(3,
item->getWeight0());
64 m_writeStmt->setFloat(4,
item->getWeight1());
65 m_writeStmt->setFloat(5,
item->getWeight2());
66 m_writeStmt->setFloat(6,
item->getWeight3());
67 m_writeStmt->setFloat(7,
item->getWeight4());
68 m_writeStmt->setFloat(8,
item->getWeight5());
70 m_writeStmt->executeUpdate();
71 }
catch (SQLException&
e) {
72 throw cms::Exception(
"SQLException") <<
"FEConfigOddWeightGroupDat::writeDB(): " <<
e.getMessage();
78 this->checkConnection();
81 iconf->setConnection(m_env, m_conn);
82 int iconfID = iconf->fetchID();
84 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::fetchData: ICONF not in DB"));
90 "SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4, d.w5 " 91 "FROM fe_weight2_per_group_dat d " 92 "WHERE wei2_conf_id = :wei2_conf_id order by d.group_id ");
93 m_readStmt->setInt(1, iconfID);
94 ResultSet* rset = m_readStmt->executeQuery();
96 std::pair<EcalLogicID, FEConfigOddWeightGroupDat>
p;
99 while (rset->next()) {
115 }
catch (SQLException&
e) {
116 throw cms::Exception(
"SQLException") <<
"FEConfigOddWeightGroupDat::fetchData: " <<
e.getMessage();
122 this->checkConnection();
123 this->checkPrepare();
125 int iconfID = iconf->fetchID();
127 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeArrayDB: ICONF not in DB"));
130 int nrows =
data->size();
131 int* ids =
new int[nrows];
132 int* iconfid_vec =
new int[nrows];
133 int*
xx =
new int[nrows];
134 float*
yy =
new float[nrows];
135 float*
zz =
new float[nrows];
136 float*
rr =
new float[nrows];
137 float*
ss =
new float[nrows];
138 float*
tt =
new float[nrows];
139 float*
ww =
new float[nrows];
141 ub2* ids_len =
new ub2[nrows];
142 ub2* iconf_len =
new ub2[nrows];
143 ub2* x_len =
new ub2[nrows];
144 ub2* y_len =
new ub2[nrows];
145 ub2* z_len =
new ub2[nrows];
146 ub2* r_len =
new ub2[nrows];
147 ub2* s_len =
new ub2[nrows];
148 ub2* t_len =
new ub2[nrows];
149 ub2* w_len =
new ub2[nrows];
154 typedef map<EcalLogicID, FEConfigOddWeightGroupDat>::const_iterator CI;
155 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
160 iconfid_vec[
count] = iconfID;
162 dataitem = &(
p->second);
181 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
195 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
196 m_writeStmt->setDataBuffer(2, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
197 m_writeStmt->setDataBuffer(3, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
198 m_writeStmt->setDataBuffer(4, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
199 m_writeStmt->setDataBuffer(5, (dvoid*)
rr, OCCIFLOAT,
sizeof(
rr[0]), r_len);
200 m_writeStmt->setDataBuffer(6, (dvoid*)
ss, OCCIFLOAT,
sizeof(
ss[0]), s_len);
201 m_writeStmt->setDataBuffer(7, (dvoid*)
tt, OCCIFLOAT,
sizeof(
tt[0]), t_len);
202 m_writeStmt->setDataBuffer(8, (dvoid*)
ww, OCCIFLOAT,
sizeof(
ww[0]), w_len);
204 m_writeStmt->executeArrayUpdate(nrows);
207 delete[] iconfid_vec;
226 }
catch (SQLException&
e) {
227 throw cms::Exception(
"SQLException") <<
"FEConfigOddWeightGroupDat::writeArrayDB(): " <<
e.getMessage();
FEConfigOddWeightGroupDat()
void writeDB(const EcalLogicID *ecid, const FEConfigOddWeightGroupDat *item, FEConfigOddWeightInfo *iconf) noexcept(false)
~FEConfigOddWeightGroupDat() override
void setWeightGroupId(int x)
char data[epos_bytes_allocation]
void writeArrayDB(const std::map< EcalLogicID, FEConfigOddWeightGroupDat > *data, FEConfigOddWeightInfo *iconf) noexcept(false)
int getWeightGroupId() const
void fetchData(std::map< EcalLogicID, FEConfigOddWeightGroupDat > *fillMap, FEConfigOddWeightInfo *iconf) noexcept(false)
void prepareWrite() noexcept(false) override