14 m_writeStmt =
nullptr;
29 this->checkConnection();
32 m_writeStmt = m_conn->createStatement();
34 "INSERT INTO fe_config_param_dat (lin_conf_id, logic_id, "
35 " etsat, ttthreshlow, ttthreshhigh, fg_lowthresh, fg_highthresh, fg_lowratio, fg_highratio ) "
36 "VALUES (:lin_conf_id, :logic_id, "
37 ":etsat, :ttthreshlow, :ttthreshhigh, :fg_lowthresh, :fg_highthresh, :fg_lowratio, :fg_highratio )");
38 }
catch (SQLException&
e) {
39 throw(std::runtime_error(
"FEConfigParamDat::prepareWrite(): " +
e.getMessage()));
46 this->checkConnection();
49 int iconfID = iconf->fetchID();
51 throw(std::runtime_error(
"FEConfigParamDat::writeDB: ICONF not in DB"));
54 int logicID = ecid->getLogicID();
56 throw(std::runtime_error(
"FEConfigParamDat::writeDB: Bad EcalLogicID"));
60 m_writeStmt->setInt(1, iconfID);
61 m_writeStmt->setInt(2, logicID);
62 m_writeStmt->setFloat(3,
item->getETSat());
63 m_writeStmt->setFloat(4,
item->getTTThreshlow());
64 m_writeStmt->setFloat(5,
item->getTTThreshhigh());
65 m_writeStmt->setFloat(6,
item->getFGlowthresh());
66 m_writeStmt->setFloat(7,
item->getFGhighthresh());
67 m_writeStmt->setFloat(8,
item->getFGlowratio());
68 m_writeStmt->setFloat(9,
item->getFGhighratio());
70 m_writeStmt->executeUpdate();
71 }
catch (SQLException&
e) {
72 throw(std::runtime_error(
"FEConfigParamDat::writeDB(): " +
e.getMessage()));
77 this->checkConnection();
80 iconf->setConnection(m_env, m_conn);
81 int iconfID = iconf->fetchID();
89 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
90 " d.etsat, d.ttthreshlow, d.ttthreshhigh, d.fg_lowthresh, d.fg_highthresh, d.fg_lowratio, d.fg_highratio "
91 "FROM channelview cv JOIN fe_config_param_dat d "
92 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
93 "WHERE lin_conf_id = :lin_conf_id");
94 m_readStmt->setInt(1, iconfID);
95 ResultSet* rset = m_readStmt->executeQuery();
97 std::pair<EcalLogicID, FEConfigParamDat>
p;
99 while (rset->next()) {
118 }
catch (SQLException&
e) {
119 throw(std::runtime_error(
"FEConfigParamDat::fetchData: " +
e.getMessage()));
125 this->checkConnection();
126 this->checkPrepare();
128 int iconfID = iconf->fetchID();
130 throw(std::runtime_error(
"FEConfigParamDat::writeArrayDB: ICONF not in DB"));
133 int nrows =
data->size();
134 int* ids =
new int[nrows];
135 int* iov_vec =
new int[nrows];
136 float*
xx =
new float[nrows];
137 float*
yy =
new float[nrows];
138 float*
zz =
new float[nrows];
139 float* ww =
new float[nrows];
140 float* uu =
new float[nrows];
141 float*
tt =
new float[nrows];
142 float* st =
new float[nrows];
144 ub2* ids_len =
new ub2[nrows];
145 ub2* iov_len =
new ub2[nrows];
146 ub2* x_len =
new ub2[nrows];
147 ub2* y_len =
new ub2[nrows];
148 ub2* z_len =
new ub2[nrows];
149 ub2* w_len =
new ub2[nrows];
150 ub2* u_len =
new ub2[nrows];
151 ub2* t_len =
new ub2[nrows];
152 ub2* st_len =
new ub2[nrows];
157 typedef map<EcalLogicID, FEConfigParamDat>::const_iterator CI;
158 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
159 channel = &(
p->first);
162 throw(std::runtime_error(
"FEConfigParamDat::writeArrayDB: Bad EcalLogicID"));
164 ids[
count] = logicID;
165 iov_vec[
count] = iconfID;
167 dataitem = &(
p->second);
200 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]), iov_len);
201 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
202 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
203 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
204 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
205 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIFLOAT,
sizeof(ww[0]), w_len);
206 m_writeStmt->setDataBuffer(7, (dvoid*)uu, OCCIFLOAT,
sizeof(uu[0]), u_len);
207 m_writeStmt->setDataBuffer(8, (dvoid*)
tt, OCCIFLOAT,
sizeof(
tt[0]), t_len);
208 m_writeStmt->setDataBuffer(9, (dvoid*)st, OCCIFLOAT,
sizeof(st[0]), st_len);
210 m_writeStmt->executeArrayUpdate(nrows);
232 }
catch (SQLException&
e) {
233 throw(std::runtime_error(
"FEConfigParamDat::writeArrayDB(): " +
e.getMessage()));