15 m_writeStmt =
nullptr;
34 this->checkConnection();
37 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
"INSERT INTO "+getTable()+
" (tim_conf_id, logic_id, " 39 "time_par1, time_par2 ) VALUES (:tim_conf_id, :logic_id, :time_par1, :time_par2 )" );
40 }
catch (SQLException &
e) {
41 throw(std::runtime_error(
std::string(
"FEConfigTimingDat::prepareWrite(): ")+getOraMessage(&e)));
49 this->checkConnection();
52 int iconfID = iconf->fetchID();
53 if (!iconfID) {
throw(std::runtime_error(
"FEConfigTimingDat::writeDB: ICONF not in DB")); }
55 int logicID = ecid->getLogicID();
56 if (!logicID) {
throw(std::runtime_error(
"FEConfigTimingDat::writeDB: Bad EcalLogicID")); }
59 m_writeStmt->setInt(1, iconfID);
60 m_writeStmt->setInt(2, logicID);
61 m_writeStmt->setInt(3, item->getTimingPar1());
62 m_writeStmt->setInt(4, item->getTimingPar2());
64 m_writeStmt->executeUpdate();
65 }
catch (SQLException &
e) {
66 throw(std::runtime_error(
std::string(
"FEConfigTimingDat::writeDB(): ")+getOraMessage(&e)));
75 this->checkConnection();
78 iconf->setConnection(m_env, m_conn);
79 int iconfID = iconf->fetchID();
86 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 87 "d.time_par1, d.time_par2 " 88 "FROM channelview cv JOIN " +getTable() +
" d ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 89 "WHERE tim_conf_id = :tim_conf_id");
90 m_readStmt->setInt(1, iconfID);
91 ResultSet* rset = m_readStmt->executeQuery();
93 std::pair< EcalLogicID, FEConfigTimingDat >
p;
101 getOraString(rset,6));
109 }
catch (SQLException &
e) {
110 throw(std::runtime_error(
std::string(
"FEConfigTimingDat::fetchData: ")+getOraMessage(&e)));
117 this->checkConnection();
118 this->checkPrepare();
120 int iconfID = iconf->fetchID();
121 if (!iconfID) {
throw(std::runtime_error(
"FEConfigTimingDat::writeArrayDB: tim_conf_id not in DB")); }
124 int nrows=
data->size();
125 int*
ids=
new int[nrows];
126 int* iconfid_vec=
new int[nrows];
127 int*
xx=
new int[nrows];
128 int*
yy=
new int[nrows];
130 ub2* ids_len=
new ub2[nrows];
131 ub2* iconf_len=
new ub2[nrows];
132 ub2* x_len=
new ub2[nrows];
133 ub2* y_len=
new ub2[nrows];
138 typedef map< EcalLogicID, FEConfigTimingDat >::const_iterator CI;
139 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
140 channel = &(
p->first);
142 if (!logicID) {
throw(std::runtime_error(
"FEConfigTimingDat::writeArrayDB: Bad EcalLogicID")); }
144 iconfid_vec[
count]=iconfID;
146 dataitem = &(
p->second);
165 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
166 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
167 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
168 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
170 m_writeStmt->executeArrayUpdate(nrows);
173 delete [] iconfid_vec;
182 }
catch (SQLException &
e) {
183 throw(std::runtime_error(
std::string(
"FEConfigTimingDat::writeArrayDB(): ")+getOraMessage(&e)));
void writeDB(const EcalLogicID *ecid, const FEConfigTimingDat *item, FEConfigTimingInfo *iconf) noexcept(false)
void setTimingPar2(int x)
void prepareWrite() noexcept(false) override
void writeArrayDB(const std::map< EcalLogicID, FEConfigTimingDat > *data, FEConfigTimingInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigTimingDat > *fillMap, FEConfigTimingInfo *iconf) noexcept(false)
int getTimingPar2() const
void setTimingPar1(int x)
int getTimingPar1() const
~FEConfigTimingDat() override
char data[epos_bytes_allocation]