14 m_writeStmt =
nullptr;
24 this->checkConnection();
27 m_writeStmt = m_conn->createStatement();
28 m_writeStmt->setSQL(
"INSERT INTO " + getTable() +
29 " (tim_conf_id, logic_id, " 30 "time_par1, time_par2 ) VALUES (:tim_conf_id, :logic_id, :time_par1, :time_par2 )");
31 }
catch (SQLException&
e) {
32 throw(std::runtime_error(
"FEConfigTimingDat::prepareWrite(): " + e.getMessage()));
39 this->checkConnection();
42 int iconfID = iconf->fetchID();
44 throw(std::runtime_error(
"FEConfigTimingDat::writeDB: ICONF not in DB"));
47 int logicID = ecid->getLogicID();
49 throw(std::runtime_error(
"FEConfigTimingDat::writeDB: Bad EcalLogicID"));
53 m_writeStmt->setInt(1, iconfID);
54 m_writeStmt->setInt(2, logicID);
55 m_writeStmt->setInt(3,
item->getTimingPar1());
56 m_writeStmt->setInt(4,
item->getTimingPar2());
58 m_writeStmt->executeUpdate();
59 }
catch (SQLException&
e) {
60 throw(std::runtime_error(
"FEConfigTimingDat::writeDB(): " + e.getMessage()));
66 this->checkConnection();
69 iconf->setConnection(m_env, m_conn);
70 int iconfID = iconf->fetchID();
77 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 78 "d.time_par1, d.time_par2 " 79 "FROM channelview cv JOIN " +
81 " d ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 82 "WHERE tim_conf_id = :tim_conf_id");
83 m_readStmt->setInt(1, iconfID);
84 ResultSet* rset = m_readStmt->executeQuery();
86 std::pair<EcalLogicID, FEConfigTimingDat>
p;
88 while (rset->next()) {
102 }
catch (SQLException&
e) {
103 throw(std::runtime_error(
"FEConfigTimingDat::fetchData: " + e.getMessage()));
109 this->checkConnection();
110 this->checkPrepare();
112 int iconfID = iconf->fetchID();
114 throw(std::runtime_error(
"FEConfigTimingDat::writeArrayDB: tim_conf_id not in DB"));
117 int nrows =
data->size();
118 int*
ids =
new int[nrows];
119 int* iconfid_vec =
new int[nrows];
120 int*
xx =
new int[nrows];
121 int*
yy =
new int[nrows];
123 ub2* ids_len =
new ub2[nrows];
124 ub2* iconf_len =
new ub2[nrows];
125 ub2* x_len =
new ub2[nrows];
126 ub2* y_len =
new ub2[nrows];
131 typedef map<EcalLogicID, FEConfigTimingDat>::const_iterator CI;
132 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
133 channel = &(
p->first);
136 throw(std::runtime_error(
"FEConfigTimingDat::writeArrayDB: Bad EcalLogicID"));
138 ids[
count] = logicID;
139 iconfid_vec[
count] = iconfID;
141 dataitem = &(
p->second);
150 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
159 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
160 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
161 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len);
162 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT,
sizeof(yy[0]), y_len);
164 m_writeStmt->executeArrayUpdate(nrows);
167 delete[] iconfid_vec;
176 }
catch (SQLException&
e) {
177 throw(std::runtime_error(
"FEConfigTimingDat::writeArrayDB(): " + e.getMessage()));
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]