32 this->checkConnection();
35 m_writeStmt = m_conn->createStatement();
36 m_writeStmt->setSQL(
"INSERT INTO OD_CCS_FE_dat (iov_id, logic_id, " 38 "VALUES (:iov_id, :logic_id, " 40 }
catch (SQLException &
e) {
41 throw(std::runtime_error(
"MODCCSFEDat::prepareWrite(): "+e.getMessage()));
50 this->checkConnection();
53 int iovID = iov->fetchID();
54 if (!iovID) {
throw(std::runtime_error(
"MODCCSFEDat::writeDB: IOV not in DB")); }
56 int logicID = ecid->getLogicID();
57 if (!logicID) {
throw(std::runtime_error(
"MODCCSFEDat::writeDB: Bad EcalLogicID")); }
60 m_writeStmt->setInt(1, iovID);
61 m_writeStmt->setInt(2, logicID);
62 m_writeStmt->setInt(3, item->getWord() );
64 m_writeStmt->executeUpdate();
65 }
catch (SQLException &
e) {
66 throw(std::runtime_error(
"MODCCSFEDat::writeDB(): "+e.getMessage()));
75 this->checkConnection();
78 iov->setConnection(m_env, m_conn);
79 int iovID = iov->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 OD_CCS_FE_dat d " 90 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 91 "WHERE d.iov_id = :iov_id");
92 m_readStmt->setInt(1, iovID);
93 ResultSet* rset = m_readStmt->executeQuery();
95 std::pair< EcalLogicID, MODCCSFEDat >
p;
105 dat.
setWord( rset->getInt(7) );
110 }
catch (SQLException &
e) {
111 throw(std::runtime_error(
"MODCCSFEDat::fetchData(): "+e.getMessage()));
118 this->checkConnection();
119 this->checkPrepare();
121 int iovID = iov->fetchID();
122 if (!iovID) {
throw(std::runtime_error(
"MODCCSFEDat::writeArrayDB: IOV not in DB")); }
125 int nrows=
data->size();
126 int* ids=
new int[nrows];
127 int* iovid_vec=
new int[nrows];
128 int*
xx=
new int[nrows];
130 ub2* ids_len=
new ub2[nrows];
131 ub2* iov_len=
new ub2[nrows];
132 ub2* x_len=
new ub2[nrows];
137 typedef map< EcalLogicID, MODCCSFEDat >::const_iterator CI;
138 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
139 channel = &(
p->first);
141 if (!logicID) {
throw(std::runtime_error(
"MODCCSFEDat::writeArrayDB: Bad EcalLogicID")); }
143 iovid_vec[
count]=iovID;
145 dataitem = &(
p->second);
161 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
162 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
163 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
165 m_writeStmt->executeArrayUpdate(nrows);
178 }
catch (SQLException &
e) {
179 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): "+e.getMessage()));
void writeDB(const EcalLogicID *ecid, const MODCCSFEDat *item, MODRunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false)
void writeArrayDB(const std::map< EcalLogicID, MODCCSFEDat > *data, MODRunIOV *iov) noexcept(false)
void fetchData(std::map< EcalLogicID, MODCCSFEDat > *fillMap, MODRunIOV *iov) noexcept(false)
char data[epos_bytes_allocation]