16 m_writeStmt =
nullptr;
33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
37 m_writeStmt->setSQL(
"INSERT INTO dcu_idark_dat (iov_id, logic_id, " 39 "VALUES (:iov_id, :logic_id, " 41 }
catch (SQLException &
e) {
42 throw(std::runtime_error(
std::string(
"DCUIDarkDat::prepareWrite(): ")+getOraMessage(&e)));
51 this->checkConnection();
54 int iovID = iov->fetchID();
55 if (!iovID) {
throw(std::runtime_error(
"DCUIDarkDat::writeDB: IOV not in DB")); }
57 int logicID = ecid->getLogicID();
58 if (!logicID) {
throw(std::runtime_error(
"DCUIDarkDat::writeDB: Bad EcalLogicID")); }
61 m_writeStmt->setInt(1, iovID);
62 m_writeStmt->setInt(2, logicID);
64 m_writeStmt->setFloat(3, item->getAPDIDark() );
66 m_writeStmt->executeUpdate();
67 }
catch (SQLException &
e) {
68 throw(std::runtime_error(
std::string(
"DCUIDarkDat::writeDB(): ")+getOraMessage(&e)));
77 this->checkConnection();
80 iov->setConnection(m_env, m_conn);
81 int iovID = iov->fetchID();
89 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 91 "FROM channelview cv JOIN dcu_idark_dat d " 92 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 93 "WHERE d.iov_id = :iov_id");
94 m_readStmt->setInt(1, iovID);
95 ResultSet* rset = m_readStmt->executeQuery();
97 std::pair< EcalLogicID, DCUIDarkDat >
p;
105 getOraString(rset,6));
112 }
catch (SQLException &
e) {
113 throw(std::runtime_error(
std::string(
"DCUIDarkDat::fetchData(): ")+getOraMessage(&e)));
119 this->checkConnection();
120 this->checkPrepare();
122 int iovID = iov->fetchID();
123 if (!iovID) {
throw(std::runtime_error(
"DCUIDarkDat::writeArrayDB: IOV not in DB")); }
126 int nrows=
data->size();
127 int* ids=
new int[nrows];
128 int* iovid_vec=
new int[nrows];
129 float*
xx=
new float[nrows];
131 ub2* ids_len=
new ub2[nrows];
132 ub2* iov_len=
new ub2[nrows];
133 ub2* x_len=
new ub2[nrows];
138 typedef map< EcalLogicID, DCUIDarkDat >::const_iterator CI;
139 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
140 channel = &(
p->first);
142 if (!logicID) {
throw(std::runtime_error(
"DCUIDarkDat::writeArrayDB: Bad EcalLogicID")); }
144 iovid_vec[
count]=iovID;
146 dataitem = &(
p->second);
163 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
164 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
165 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
167 m_writeStmt->executeArrayUpdate(nrows);
178 }
catch (SQLException &
e) {
179 throw(std::runtime_error(
std::string(
"DCUIDarkDat::writeArrayDB(): ")+getOraMessage(&e)));
void setAPDIDark(float i)
void writeArrayDB(const std::map< EcalLogicID, DCUIDarkDat > *data, DCUIOV *iov) noexcept(false)
void writeDB(const EcalLogicID *ecid, const DCUIDarkDat *item, DCUIOV *iov) noexcept(false)
void fetchData(std::map< EcalLogicID, DCUIDarkDat > *fillVec, DCUIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
char data[epos_bytes_allocation]
float getAPDIDark() const