63 "timing_mean, timing_rms , task_status ) " 64 "VALUES (:iov_id, :logic_id, " 65 ":timing_mean, :timing_rms, :task_status )");
66 }
catch (SQLException &
e) {
67 throw(std::runtime_error(
"ITimingDat::prepareWrite(): "+e.getMessage()));
72 template<
class DATT,
class IOVT>
78 int iovID = iov->fetchID();
79 if (!iovID) {
throw(std::runtime_error(
"ITimingDat::writeDB: IOV not in DB")); }
81 int logicID = ecid->getLogicID();
82 if (!logicID) {
throw(std::runtime_error(
"ITimingDat::writeDB: Bad EcalLogicID")); }
94 }
catch (SQLException &
e) {
95 throw(std::runtime_error(
"ITimingDat::writeDB(): "+e.getMessage()));
99 template<
class DATT,
class IOVT>
102 using oracle::occi::OCCIINT;
103 using oracle::occi::OCCIFLOAT;
108 int iovID = iov->fetchID();
109 if (!iovID) {
throw(std::runtime_error(
"ITimingDat::writeArrayDB: IOV not in DB")); }
112 int nrows=
data->size();
113 int* ids=
new int[nrows];
114 int* iovid_vec=
new int[nrows];
115 float*
xx=
new float[nrows];
116 float*
yy=
new float[nrows];
117 int* st=
new int[nrows];
120 ub2* ids_len=
new ub2[nrows];
121 ub2* iov_len=
new ub2[nrows];
122 ub2* x_len=
new ub2[nrows];
123 ub2* y_len=
new ub2[nrows];
124 ub2* st_len=
new ub2[nrows];
128 const DATT* dataitem;
131 typedef typename std::map< EcalLogicID, DATT >::const_iterator CI;
132 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
133 channel = &(
p->first);
135 if (!logicID) {
throw(std::runtime_error(
"ITimingDat::writeArrayDB: Bad EcalLogicID")); }
137 iovid_vec[
count]=iovID;
139 dataitem = &(
p->second);
141 float x=dataitem->getTimingMean();
142 float y=dataitem->getTimingRMS();
143 int statu=dataitem->getTaskStatus();
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 );
166 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
167 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
183 }
catch (SQLException &
e) {
184 throw(std::runtime_error(
"ITimingDat::writeArrayDB(): "+e.getMessage()));
192 template<
class DATT,
class IOVT>
199 int iovID = iov->fetchID();
207 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 208 "d.timing_mean, d.timing_rms, d.task_status " 209 "FROM channelview cv JOIN "+
getTable() +
" d " 210 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 211 "WHERE d.iov_id = :iov_id");
215 std::pair< EcalLogicID, DATT >
p;
217 while(rset->next()) {
225 dat.setTimingMean( rset->getFloat(7) );
226 dat.setTimingRMS( rset->getFloat(8) );
227 dat.setTaskStatus( rset->getInt(9) );
235 }
catch (SQLException &
e) {
236 throw(std::runtime_error(
"ITimingDat::fetchData(): "+e.getMessage()));
oracle::occi::Environment * m_env
void setTable(std::string x)
oracle::occi::Statement * m_writeStmt
oracle::occi::Connection * m_conn
float getTimingMean() const
void fetchData(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
bool getTaskStatus() const
void checkPrepare() noexcept(false)
void setTimingMean(float mean)
void writeDB(const EcalLogicID *ecid, const DATT *item, IOVT *iov) noexcept(false)
void checkConnection() const noexcept(false)
void prepareWrite() noexcept(false)
float getTimingRMS() const
void writeArrayDB(const std::map< EcalLogicID, DATT > *data, IOVT *iov) noexcept(false)
void setTaskStatus(bool status)
oracle::occi::Statement * m_readStmt
void setTimingRMS(float rms)
oracle::occi::SQLException SQLException
char data[epos_bytes_allocation]
oracle::occi::ResultSet ResultSet