9 using namespace oracle::occi;
31 throw(std::runtime_error)
33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
37 m_writeStmt->setSQL(
"INSERT INTO fe_config_fgr_dat (fgr_conf_id, logic_id, "
39 "VALUES (:fgr_conf_id, :logic_id, "
42 throw(std::runtime_error(
"FEConfigFgrDat::prepareWrite(): "+e.getMessage()));
48 throw(std::runtime_error)
50 this->checkConnection();
53 int iconfID = iconf->fetchID();
54 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrDat::writeDB: ICONF not in DB")); }
56 int logicID = ecid->getLogicID();
57 if (!logicID) {
throw(std::runtime_error(
"FEConfigFgrDat::writeDB: Bad EcalLogicID")); }
60 m_writeStmt->setInt(1, iconfID);
61 m_writeStmt->setInt(2, logicID);
62 m_writeStmt->setInt(3, item->getFgrGroupId());
64 m_writeStmt->executeUpdate();
66 throw(std::runtime_error(
"FEConfigFgrDat::writeDB(): "+e.getMessage()));
73 throw(std::runtime_error)
75 this->checkConnection();
78 iconf->setConnection(m_env, m_conn);
79 int iconfID = iconf->fetchID();
87 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
89 "FROM channelview cv JOIN fe_config_fgr_dat d "
90 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91 "WHERE fgr_conf_id = :fgr_conf_id");
92 m_readStmt->setInt(1, iconfID);
93 ResultSet* rset = m_readStmt->executeQuery();
95 std::pair< EcalLogicID, FEConfigFgrDat >
p;
111 throw(std::runtime_error(
"FEConfigFgrDat::fetchData: "+e.getMessage()));
116 throw(std::runtime_error)
118 this->checkConnection();
119 this->checkPrepare();
121 int iconfID = iconf->fetchID();
122 if (!iconfID) {
throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB: ICONF not in DB")); }
125 int nrows=
data->size();
126 int* ids=
new int[nrows];
127 int* iconfid_vec=
new int[nrows];
128 int* xx=
new int[nrows];
130 ub2* ids_len=
new ub2[nrows];
131 ub2* iconf_len=
new ub2[nrows];
132 ub2* x_len=
new ub2[nrows];
138 typedef map< EcalLogicID, FEConfigFgrDat >::const_iterator CI;
139 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
140 channel = &(
p->first);
142 if (!logicID) {
throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB: Bad EcalLogicID")); }
144 iconfid_vec[
count]=iconfID;
146 dataitem = &(
p->second);
162 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
163 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
164 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
166 m_writeStmt->executeArrayUpdate(nrows);
169 delete [] iconfid_vec;
177 throw(std::runtime_error(
"FEConfigFgrDat::writeArrayDB(): "+e.getMessage()));
void fetchData(std::map< EcalLogicID, FEConfigFgrDat > *fillMap, FEConfigFgrInfo *iconf)
void writeArrayDB(const std::map< EcalLogicID, FEConfigFgrDat > *data, FEConfigFgrInfo *iconf)
oracle::occi::SQLException SQLException
void setFgrGroupId(int x)
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const FEConfigFgrDat *item, FEConfigFgrInfo *iconf)
int getFgrGroupId() const