14 m_writeStmt =
nullptr;
23 this->checkConnection();
26 m_writeStmt = m_conn->createStatement();
28 "INSERT INTO fe_config_weight_dat (wei_conf_id, logic_id, " 30 "VALUES (:wei_conf_id, :logic_id, " 32 }
catch (SQLException&
e) {
33 throw(std::runtime_error(
"FEConfigWeightDat::prepareWrite(): " +
e.getMessage()));
40 this->checkConnection();
43 int iconfID = iconf->fetchID();
45 throw(std::runtime_error(
"FEConfigWeightDat::writeDB: ICONF not in DB"));
48 int logicID = ecid->getLogicID();
50 throw(std::runtime_error(
"FEConfigWeightDat::writeDB: Bad EcalLogicID"));
54 m_writeStmt->setInt(1, iconfID);
55 m_writeStmt->setInt(2, logicID);
56 m_writeStmt->setInt(3,
item->getWeightGroupId());
58 m_writeStmt->executeUpdate();
59 }
catch (SQLException&
e) {
60 throw(std::runtime_error(
"FEConfigWeightDat::writeDB(): " +
e.getMessage()));
66 this->checkConnection();
69 iconf->setConnection(m_env, m_conn);
70 int iconfID = iconf->fetchID();
78 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 80 "FROM channelview cv JOIN fe_config_weight_dat d " 81 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 82 "WHERE wei_conf_id = :wei_conf_id");
83 m_readStmt->setInt(1, iconfID);
84 ResultSet* rset = m_readStmt->executeQuery();
86 std::pair<EcalLogicID, FEConfigWeightDat>
p;
88 while (rset->next()) {
101 }
catch (SQLException&
e) {
102 throw(std::runtime_error(
"FEConfigWeightDat::fetchData: " +
e.getMessage()));
108 this->checkConnection();
109 this->checkPrepare();
111 int iconfID = iconf->fetchID();
113 throw(std::runtime_error(
"FEConfigWeightDat::writeArrayDB: ICONF not in DB"));
116 int nrows =
data->size();
117 int* ids =
new int[nrows];
118 int* iconfid_vec =
new int[nrows];
119 int*
xx =
new int[nrows];
121 ub2* ids_len =
new ub2[nrows];
122 ub2* iconf_len =
new ub2[nrows];
123 ub2* x_len =
new ub2[nrows];
128 typedef map<EcalLogicID, FEConfigWeightDat>::const_iterator CI;
129 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
130 channel = &(
p->first);
133 throw(std::runtime_error(
"FEConfigWeightDat::writeArrayDB: Bad EcalLogicID"));
135 ids[
count] = logicID;
136 iconfid_vec[
count] = iconfID;
138 dataitem = &(
p->second);
145 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
153 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
154 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
155 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
157 m_writeStmt->executeArrayUpdate(nrows);
160 delete[] iconfid_vec;
167 }
catch (SQLException&
e) {
168 throw(std::runtime_error(
"FEConfigWeightDat::writeArrayDB(): " +
e.getMessage()));
~FEConfigWeightDat() override
int getWeightGroupId() const
void prepareWrite() noexcept(false) override
void writeArrayDB(const std::map< EcalLogicID, FEConfigWeightDat > *data, FEConfigWeightInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigWeightDat > *fillMap, FEConfigWeightInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const FEConfigWeightDat *item, FEConfigWeightInfo *iconf) noexcept(false)
void setWeightGroupId(int x)