15 m_writeStmt =
nullptr;
33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
37 m_writeStmt->setSQL(
"INSERT INTO fe_config_sliding_dat (sli_conf_id, logic_id, " 39 "VALUES (:sli_conf_id, :logic_id, " 41 }
catch (SQLException &
e) {
42 throw(std::runtime_error(
std::string(
"FEConfigSlidingDat::prepareWrite(): ")+getOraMessage(&e)));
51 this->checkConnection();
54 int iconfID = iconf->fetchID();
55 if (!iconfID) {
throw(std::runtime_error(
"FEConfigSlidingDat::writeDB: ICONF not in DB")); }
57 int logicID = ecid->getLogicID();
58 if (!logicID) {
throw(std::runtime_error(
"FEConfigSlidingDat::writeDB: Bad EcalLogicID")); }
61 m_writeStmt->setInt(1, iconfID);
62 m_writeStmt->setInt(2, logicID);
63 m_writeStmt->setFloat(3, item->getSliding());
65 m_writeStmt->executeUpdate();
66 }
catch (SQLException &
e) {
67 throw(std::runtime_error(
std::string(
"FEConfigSlidingDat::writeDB(): ")+getOraMessage(&e)));
76 this->checkConnection();
79 iconf->setConnection(m_env, m_conn);
80 int iconfID = iconf->fetchID();
88 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 90 "FROM channelview cv JOIN fe_config_sliding_dat d " 91 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 92 "WHERE sli_conf_id = :sli_conf_id");
93 m_readStmt->setInt(1, iconfID);
94 ResultSet* rset = m_readStmt->executeQuery();
96 std::pair< EcalLogicID, FEConfigSlidingDat >
p;
104 getOraString(rset,6));
111 }
catch (SQLException &
e) {
112 throw(std::runtime_error(
std::string(
"FEConfigSlidingDat::fetchData: ")+getOraMessage(&e)));
119 this->checkConnection();
120 this->checkPrepare();
122 int iconfID = iconf->fetchID();
123 if (!iconfID) {
throw(std::runtime_error(
"FEConfigSlidingDat::writeArrayDB: ICONF not in DB")); }
126 int nrows=
data->size();
127 int*
ids=
new int[nrows];
128 int* iconfid_vec=
new int[nrows];
129 float*
xx=
new float[nrows];
132 ub2* ids_len=
new ub2[nrows];
133 ub2* iconf_len=
new ub2[nrows];
134 ub2* x_len=
new ub2[nrows];
140 typedef map< EcalLogicID, FEConfigSlidingDat >::const_iterator CI;
141 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
142 channel = &(
p->first);
144 if (!logicID) {
throw(std::runtime_error(
"FEConfigSlidingDat::writeArrayDB: Bad EcalLogicID")); }
146 iconfid_vec[
count]=iconfID;
148 dataitem = &(
p->second);
166 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
167 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
168 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
170 m_writeStmt->executeArrayUpdate(nrows);
173 delete [] iconfid_vec;
180 }
catch (SQLException &
e) {
181 throw(std::runtime_error(
std::string(
"FEConfigSlidingDat::writeArrayDB(): ")+getOraMessage(&e)));
void writeDB(const EcalLogicID *ecid, const FEConfigSlidingDat *item, FEConfigSlidingInfo *iconf) noexcept(false)
void prepareWrite() noexcept(false) override
~FEConfigSlidingDat() override
void writeArrayDB(const std::map< EcalLogicID, FEConfigSlidingDat > *data, FEConfigSlidingInfo *iconf) noexcept(false)
void setSliding(float mean)
char data[epos_bytes_allocation]
void fetchData(std::map< EcalLogicID, FEConfigSlidingDat > *fillMap, FEConfigSlidingInfo *iconf) noexcept(false)