9 using namespace oracle::occi;
14 m_writeStmt =
nullptr;
23 this->checkConnection();
26 m_writeStmt = m_conn->createStatement();
28 "INSERT INTO OD_CCS_TR_dat (iov_id, logic_id, "
30 "VALUES (:iov_id, :logic_id, "
32 }
catch (SQLException&
e) {
33 throw(std::runtime_error(
"MODCCSTRDat::prepareWrite(): " + e.getMessage()));
38 this->checkConnection();
41 int iovID = iov->fetchID();
43 throw(std::runtime_error(
"MODCCSTRDat::writeDB: IOV not in DB"));
46 int logicID = ecid->getLogicID();
48 throw(std::runtime_error(
"MODCCSTRDat::writeDB: Bad EcalLogicID"));
52 m_writeStmt->setInt(1, iovID);
53 m_writeStmt->setInt(2, logicID);
54 m_writeStmt->setFloat(3,
item->getWord());
56 m_writeStmt->executeUpdate();
57 }
catch (SQLException&
e) {
58 throw(std::runtime_error(
"MODCCSTRDat::writeDB(): " + e.getMessage()));
63 this->checkConnection();
66 iov->setConnection(m_env, m_conn);
67 int iovID = iov->fetchID();
75 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
77 "FROM channelview cv JOIN OD_CCS_TR_dat d "
78 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
79 "WHERE d.iov_id = :iov_id");
80 m_readStmt->setInt(1, iovID);
81 ResultSet* rset = m_readStmt->executeQuery();
83 std::pair<EcalLogicID, MODCCSTRDat>
p;
85 while (rset->next()) {
98 }
catch (SQLException&
e) {
99 throw(std::runtime_error(
"MODCCSTRDat::fetchData(): " + e.getMessage()));
104 this->checkConnection();
105 this->checkPrepare();
107 int iovID = iov->fetchID();
109 throw(std::runtime_error(
"MODCCSTRDat::writeArrayDB: IOV not in DB"));
112 int nrows =
data->size();
113 int* ids =
new int[nrows];
114 int* iovid_vec =
new int[nrows];
115 int* xx =
new int[nrows];
117 ub2* ids_len =
new ub2[nrows];
118 ub2* iov_len =
new ub2[nrows];
119 ub2* x_len =
new ub2[nrows];
124 typedef map<EcalLogicID, MODCCSTRDat>::const_iterator CI;
125 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
126 channel = &(
p->first);
129 throw(std::runtime_error(
"MODCCSTRDat::writeArrayDB: Bad EcalLogicID"));
131 ids[
count] = logicID;
132 iovid_vec[
count] = iovID;
134 dataitem = &(
p->second);
149 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
150 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
151 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len);
153 m_writeStmt->executeArrayUpdate(nrows);
163 }
catch (SQLException&
e) {
164 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): " + e.getMessage()));
void prepareWrite() noexcept(false) override
void fetchData(std::map< EcalLogicID, MODCCSTRDat > *fillMap, MODRunIOV *iov) noexcept(false)
void writeDB(const EcalLogicID *ecid, const MODCCSTRDat *item, MODRunIOV *iov) noexcept(false)
void writeArrayDB(const std::map< EcalLogicID, MODCCSTRDat > *data, MODRunIOV *iov) noexcept(false)
static std::vector< std::string > checklist dat
char data[epos_bytes_allocation]