38 this->checkConnection();
41 m_writeStmt = m_conn->createStatement();
42 m_writeStmt->setSQL(
"INSERT INTO fe_weight_per_group_dat (wei_conf_id, group_id, " 43 " w0, w1, w2, w3, w4 ) " 44 "VALUES (:wei_conf_id, :group_id, " 45 ":w0, :w1, :w2, :w3, :w4 )" );
46 }
catch (SQLException &
e) {
47 throw(std::runtime_error(
"FEConfigWeightGroupDat::prepareWrite(): "+e.getMessage()));
56 this->checkConnection();
59 int iconfID = iconf->fetchID();
60 if (!iconfID) {
throw(std::runtime_error(
"FEConfigWeightGroupDat::writeDB: ICONF not in DB")); }
67 m_writeStmt->setInt(1, iconfID);
69 m_writeStmt->setInt(2, item->getWeightGroupId());
70 m_writeStmt->setFloat(3, item->getWeight0());
71 m_writeStmt->setFloat(4, item->getWeight1());
72 m_writeStmt->setFloat(5, item->getWeight2());
73 m_writeStmt->setFloat(6, item->getWeight3());
74 m_writeStmt->setFloat(7, item->getWeight4());
76 m_writeStmt->executeUpdate();
77 }
catch (SQLException &
e) {
78 throw(std::runtime_error(
"FEConfigWeightGroupDat::writeDB(): "+e.getMessage()));
87 this->checkConnection();
90 iconf->setConnection(m_env, m_conn);
91 int iconfID = iconf->fetchID();
93 throw(std::runtime_error(
"FEConfigWeightGroupDat::fetchData: ICONF not in DB"));
99 m_readStmt->setSQL(
"SELECT d.group_id, d.w0, d.w1, d.w2, d.w3, d.w4 " 100 "FROM fe_weight_per_group_dat d " 101 "WHERE wei_conf_id = :wei_conf_id order by d.group_id ");
102 m_readStmt->setInt(1, iconfID);
103 ResultSet* rset = m_readStmt->executeQuery();
105 std::pair< EcalLogicID, FEConfigWeightGroupDat >
p;
108 while(rset->next()) {
123 }
catch (SQLException &
e) {
124 throw(std::runtime_error(
"FEConfigWeightGroupDat::fetchData: "+e.getMessage()));
131 this->checkConnection();
132 this->checkPrepare();
134 int iconfID = iconf->fetchID();
135 if (!iconfID) {
throw(std::runtime_error(
"FEConfigWeightGroupDat::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 float*
tt=
new float[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, FEConfigWeightGroupDat >::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, OCCIFLOAT ,
sizeof(tt[0]), t_len );
209 m_writeStmt->executeArrayUpdate(nrows);
212 delete [] iconfid_vec;
229 }
catch (SQLException &
e) {
230 throw(std::runtime_error(
"FEConfigWeightGroupDat::writeArrayDB(): "+e.getMessage()));
void fetchData(std::map< EcalLogicID, FEConfigWeightGroupDat > *fillMap, FEConfigWeightInfo *iconf) noexcept(false)
int getWeightGroupId() const
~FEConfigWeightGroupDat()
void writeArrayDB(const std::map< EcalLogicID, FEConfigWeightGroupDat > *data, FEConfigWeightInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const FEConfigWeightGroupDat *item, FEConfigWeightInfo *iconf) noexcept(false)
void setWeightGroupId(int x)
void prepareWrite() noexcept(false)