56 " (iov_id, logic_id, " 57 "timing_mean, timing_rms , task_status ) " 58 "VALUES (:iov_id, :logic_id, " 59 ":timing_mean, :timing_rms, :task_status )");
60 }
catch (SQLException&
e) {
61 throw(std::runtime_error(
"ITimingDat::prepareWrite(): " + e.getMessage()));
65 template <
class DATT,
class IOVT>
70 int iovID = iov->fetchID();
72 throw(std::runtime_error(
"ITimingDat::writeDB: IOV not in DB"));
75 int logicID = ecid->getLogicID();
77 throw(std::runtime_error(
"ITimingDat::writeDB: Bad EcalLogicID"));
89 }
catch (SQLException&
e) {
90 throw(std::runtime_error(
"ITimingDat::writeDB(): " + e.getMessage()));
94 template <
class DATT,
class IOVT>
96 using oracle::occi::OCCIFLOAT;
97 using oracle::occi::OCCIINT;
102 int iovID = iov->fetchID();
104 throw(std::runtime_error(
"ITimingDat::writeArrayDB: IOV not in DB"));
107 int nrows =
data->size();
108 int*
ids =
new int[nrows];
109 int* iovid_vec =
new int[nrows];
110 float*
xx =
new float[nrows];
111 float*
yy =
new float[nrows];
112 int* st =
new int[nrows];
114 ub2* ids_len =
new ub2[nrows];
115 ub2* iov_len =
new ub2[nrows];
116 ub2* x_len =
new ub2[nrows];
117 ub2* y_len =
new ub2[nrows];
118 ub2* st_len =
new ub2[nrows];
121 const DATT* dataitem;
124 typedef typename std::map<EcalLogicID, DATT>::const_iterator CI;
125 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
126 channel = &(
p->first);
129 throw(std::runtime_error(
"ITimingDat::writeArrayDB: Bad EcalLogicID"));
131 ids[
count] = logicID;
132 iovid_vec[
count] = iovID;
134 dataitem = &(
p->second);
136 float x = dataitem->getTimingMean();
137 float y = dataitem->getTimingRMS();
138 int statu = dataitem->getTaskStatus();
155 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
156 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
157 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT,
sizeof(xx[0]), x_len);
158 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT,
sizeof(yy[0]), y_len);
159 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
175 }
catch (SQLException&
e) {
176 throw(std::runtime_error(
"ITimingDat::writeArrayDB(): " + e.getMessage()));
180 template <
class DATT,
class IOVT>
186 int iovID = iov->fetchID();
194 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 195 "d.timing_mean, d.timing_rms, d.task_status " 196 "FROM channelview cv JOIN " +
199 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 200 "WHERE d.iov_id = :iov_id");
204 std::pair<EcalLogicID, DATT>
p;
206 while (rset->next()) {
214 dat.setTimingMean(rset->getFloat(7));
215 dat.setTimingRMS(rset->getFloat(8));
216 dat.setTaskStatus(rset->getInt(9));
222 }
catch (SQLException&
e) {
223 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)
std::string getTable() override
void writeDB(const EcalLogicID *ecid, const DATT *item, IOVT *iov) noexcept(false)
void checkConnection() const noexcept(false)
void prepareWrite() noexcept(false) override
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