14 m_writeStmt =
nullptr;
29 this->checkConnection();
32 m_writeStmt = m_conn->createStatement();
34 "INSERT INTO fe_weight2_per_group_dat (wei2_conf_id, group_id, "
35 " w0, w1, w2, w3, w4, w5 ) "
36 "VALUES (:wei2_conf_id, :group_id, "
37 ":w0, :w1, :w2, :w3, :w4, :w5 )");
38 }
catch (SQLException&
e) {
39 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::prepareWrite(): " +
e.getMessage()));
46 this->checkConnection();
49 int iconfID = iconf->fetchID();
51 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeDB: ICONF not in DB"));
59 m_writeStmt->setInt(1, iconfID);
61 m_writeStmt->setInt(2,
item->getWeightGroupId());
62 m_writeStmt->setFloat(3,
item->getWeight0());
63 m_writeStmt->setFloat(4,
item->getWeight1());
64 m_writeStmt->setFloat(5,
item->getWeight2());
65 m_writeStmt->setFloat(6,
item->getWeight3());
66 m_writeStmt->setFloat(7,
item->getWeight4());
67 m_writeStmt->setFloat(8,
item->getWeight5());
69 m_writeStmt->executeUpdate();
70 }
catch (SQLException&
e) {
71 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeDB(): " +
e.getMessage()));
77 this->checkConnection();
80 iconf->setConnection(m_env, m_conn);
81 int iconfID = iconf->fetchID();
83 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::fetchData: ICONF not in DB"));
89 "SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4, d.w5 "
90 "FROM fe_weight2_per_group_dat d "
91 "WHERE wei2_conf_id = :wei2_conf_id order by d.group_id ");
92 m_readStmt->setInt(1, iconfID);
93 ResultSet* rset = m_readStmt->executeQuery();
95 std::pair<EcalLogicID, FEConfigOddWeightGroupDat>
p;
98 while (rset->next()) {
114 }
catch (SQLException&
e) {
115 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::fetchData: " +
e.getMessage()));
121 this->checkConnection();
122 this->checkPrepare();
124 int iconfID = iconf->fetchID();
126 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeArrayDB: ICONF not in DB"));
129 int nrows =
data->size();
130 int* ids =
new int[nrows];
131 int* iconfid_vec =
new int[nrows];
132 int*
xx =
new int[nrows];
133 float*
yy =
new float[nrows];
134 float*
zz =
new float[nrows];
135 float*
rr =
new float[nrows];
136 float*
ss =
new float[nrows];
137 float*
tt =
new float[nrows];
138 float* ww =
new float[nrows];
140 ub2* ids_len =
new ub2[nrows];
141 ub2* iconf_len =
new ub2[nrows];
142 ub2* x_len =
new ub2[nrows];
143 ub2* y_len =
new ub2[nrows];
144 ub2* z_len =
new ub2[nrows];
145 ub2* r_len =
new ub2[nrows];
146 ub2* s_len =
new ub2[nrows];
147 ub2* t_len =
new ub2[nrows];
148 ub2* w_len =
new ub2[nrows];
153 typedef map<EcalLogicID, FEConfigOddWeightGroupDat>::const_iterator CI;
154 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
159 iconfid_vec[
count] = iconfID;
161 dataitem = &(
p->second);
180 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
194 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
195 m_writeStmt->setDataBuffer(2, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
196 m_writeStmt->setDataBuffer(3, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
197 m_writeStmt->setDataBuffer(4, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
198 m_writeStmt->setDataBuffer(5, (dvoid*)
rr, OCCIFLOAT,
sizeof(
rr[0]), r_len);
199 m_writeStmt->setDataBuffer(6, (dvoid*)
ss, OCCIFLOAT,
sizeof(
ss[0]), s_len);
200 m_writeStmt->setDataBuffer(7, (dvoid*)
tt, OCCIFLOAT,
sizeof(
tt[0]), t_len);
201 m_writeStmt->setDataBuffer(8, (dvoid*)ww, OCCIFLOAT,
sizeof(ww[0]), w_len);
203 m_writeStmt->executeArrayUpdate(nrows);
206 delete[] iconfid_vec;
225 }
catch (SQLException&
e) {
226 throw(std::runtime_error(
"FEConfigOddWeightGroupDat::writeArrayDB(): " +
e.getMessage()));