9 using namespace oracle::occi;
14 m_writeStmt =
nullptr;
23 this->checkConnection();
26 m_writeStmt = m_conn->createStatement();
28 "INSERT INTO fe_config_fgr_dat (fgr_conf_id, logic_id, "
30 "VALUES (:fgr_conf_id, :logic_id, "
32 }
catch (SQLException&
e) {
33 throw(std::runtime_error(
"FEConfigFgrDat::prepareWrite(): " + e.getMessage()));
40 this->checkConnection();
43 int iconfID = iconf->fetchID();
45 throw(std::runtime_error(
"FEConfigFgrDat::writeDB: ICONF not in DB"));
48 int logicID = ecid->getLogicID();
50 throw(std::runtime_error(
"FEConfigFgrDat::writeDB: Bad EcalLogicID"));
54 m_writeStmt->setInt(1, iconfID);
55 m_writeStmt->setInt(2, logicID);
56 m_writeStmt->setInt(3,
item->getFgrGroupId());
58 m_writeStmt->executeUpdate();
59 }
catch (SQLException&
e) {
60 throw(std::runtime_error(
"FEConfigFgrDat::writeDB(): " + e.getMessage()));
65 this->checkConnection();
68 iconf->setConnection(m_env, m_conn);
69 int iconfID = iconf->fetchID();
77 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
79 "FROM channelview cv JOIN fe_config_fgr_dat d "
80 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
81 "WHERE fgr_conf_id = :fgr_conf_id");
82 m_readStmt->setInt(1, iconfID);
83 ResultSet* rset = m_readStmt->executeQuery();
85 std::pair<EcalLogicID, FEConfigFgrDat>
p;
87 while (rset->next()) {
100 }
catch (SQLException&
e) {
101 throw(std::runtime_error(
"FEConfigFgrDat::fetchData: " + e.getMessage()));
107 this->checkConnection();
108 this->checkPrepare();
110 int iconfID = iconf->fetchID();
112 throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB: ICONF not in DB"));
115 int nrows =
data->size();
116 int* ids =
new int[nrows];
117 int* iconfid_vec =
new int[nrows];
118 int* xx =
new int[nrows];
120 ub2* ids_len =
new ub2[nrows];
121 ub2* iconf_len =
new ub2[nrows];
122 ub2* x_len =
new ub2[nrows];
127 typedef map<EcalLogicID, FEConfigFgrDat>::const_iterator CI;
128 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
129 channel = &(
p->first);
132 throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB: Bad EcalLogicID"));
134 ids[
count] = logicID;
135 iconfid_vec[
count] = iconfID;
137 dataitem = &(
p->second);
144 iconf_len[
count] =
sizeof(iconfid_vec[
count]);
152 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]), iconf_len);
153 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
154 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len);
156 m_writeStmt->executeArrayUpdate(nrows);
159 delete[] iconfid_vec;
166 }
catch (SQLException&
e) {
167 throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB(): " + e.getMessage()));
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrDat > *data, FEConfigFgrInfo *iconf) noexcept(false)
void prepareWrite() noexcept(false) override
~FEConfigFgrDat() override
void writeDB(const EcalLogicID *ecid, const FEConfigFgrDat *item, FEConfigFgrInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigFgrDat > *fillMap, FEConfigFgrInfo *iconf) noexcept(false)
void setFgrGroupId(int x)
static std::vector< std::string > checklist dat
char data[epos_bytes_allocation]
int getFgrGroupId() const