57 throw(std::runtime_error)
64 "timing_mean, timing_rms , task_status ) "
65 "VALUES (:iov_id, :logic_id, "
66 ":timing_mean, :timing_rms, :task_status )");
68 throw(std::runtime_error(
"ITimingDat::prepareWrite(): "+e.getMessage()));
73 template<
class DATT,
class IOVT>
75 throw(std::runtime_error)
80 int iovID =
iov->fetchID();
81 if (!iovID) {
throw(std::runtime_error(
"ITimingDat::writeDB: IOV not in DB")); }
83 int logicID = ecid->getLogicID();
84 if (!logicID) {
throw(std::runtime_error(
"ITimingDat::writeDB: Bad EcalLogicID")); }
97 throw(std::runtime_error(
"ITimingDat::writeDB(): "+e.getMessage()));
101 template<
class DATT,
class IOVT>
103 throw(std::runtime_error)
106 using oracle::occi::OCCIINT;
107 using oracle::occi::OCCIFLOAT;
112 int iovID =
iov->fetchID();
113 if (!iovID) {
throw(std::runtime_error(
"ITimingDat::writeArrayDB: IOV not in DB")); }
116 int nrows=
data->size();
117 int* ids=
new int[nrows];
118 int* iovid_vec=
new int[nrows];
119 float* xx=
new float[nrows];
120 float* yy=
new float[nrows];
121 int* st=
new int[nrows];
124 ub2* ids_len=
new ub2[nrows];
125 ub2* iov_len=
new ub2[nrows];
126 ub2* x_len=
new ub2[nrows];
127 ub2* y_len=
new ub2[nrows];
128 ub2* st_len=
new ub2[nrows];
132 const DATT* dataitem;
135 typedef typename std::map< EcalLogicID, DATT >::const_iterator CI;
136 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
137 channel = &(
p->first);
139 if (!logicID) {
throw(std::runtime_error(
"ITimingDat::writeArrayDB: Bad EcalLogicID")); }
141 iovid_vec[
count]=iovID;
143 dataitem = &(
p->second);
145 float x=dataitem->getTimingMean();
146 float y=dataitem->getTimingRMS();
147 int statu=dataitem->getTaskStatus();
167 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
168 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
169 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
170 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
171 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
188 throw(std::runtime_error(
"ITimingDat::writeArrayDB(): "+e.getMessage()));
196 template<
class DATT,
class IOVT>
198 throw(std::runtime_error)
204 int iovID =
iov->fetchID();
212 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
213 "d.timing_mean, d.timing_rms, d.task_status "
214 "FROM channelview cv JOIN "+
getTable() +
" d "
215 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
216 "WHERE d.iov_id = :iov_id");
220 std::pair< EcalLogicID, DATT >
p;
222 while(rset->next()) {
230 dat.setTimingMean( rset->getFloat(7) );
231 dat.setTimingRMS( rset->getFloat(8) );
232 dat.setTaskStatus( rset->getInt(9) );
241 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
bool getTaskStatus() const
void setTimingMean(float mean)
oracle::occi::SQLException SQLException
void fetchData(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
float getTimingRMS() const
void setTaskStatus(bool status)
oracle::occi::Statement * m_readStmt
void writeArrayDB(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
void setTimingRMS(float rms)
oracle::occi::SQLException SQLException
oracle::occi::ResultSet ResultSet
oracle::occi::ResultSet ResultSet
void writeDB(const EcalLogicID *ecid, const DATT *item, IOVT *iov)
void checkConnection() const