8 using namespace oracle::occi;
30 throw(std::runtime_error)
32 this->checkConnection();
35 m_writeStmt = m_conn->createStatement();
36 m_writeStmt->setSQL(
"INSERT INTO mon_h4_table_position_dat (iov_id, logic_id, "
38 "VALUES (:iov_id, :logic_id, "
41 throw(std::runtime_error(
"MonH4TablePositionDat::prepareWrite(): "+e.getMessage()));
48 throw(std::runtime_error)
50 this->checkConnection();
53 int iovID =
iov->fetchID();
54 if (!iovID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: IOV not in DB")); }
56 int logicID = ecid->getLogicID();
57 if (!logicID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeDB: Bad EcalLogicID")); }
60 m_writeStmt->setInt(1, iovID);
61 m_writeStmt->setInt(2, logicID);
63 m_writeStmt->setFloat(3, item->getTableX() );
64 m_writeStmt->setFloat(4, item->getTableY() );
66 m_writeStmt->executeUpdate();
68 throw(std::runtime_error(
"MonH4TablePositionDat::writeDB(): "+e.getMessage()));
75 throw(std::runtime_error)
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, "
90 "d.table_x, d.table_y "
91 "FROM channelview cv JOIN mon_h4_table_position_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, MonH4TablePositionDat >
p;
114 throw(std::runtime_error(
"MonH4TablePositionDat::fetchData(): "+e.getMessage()));
119 throw(std::runtime_error)
121 this->checkConnection();
122 this->checkPrepare();
124 int iovID =
iov->fetchID();
125 if (!iovID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: IOV not in DB")); }
128 int nrows=
data->size();
129 int* ids=
new int[nrows];
130 int* iovid_vec=
new int[nrows];
131 float* xx=
new float[nrows];
132 float* yy=
new float[nrows];
135 ub2* ids_len=
new ub2[nrows];
136 ub2* iov_len=
new ub2[nrows];
137 ub2* x_len=
new ub2[nrows];
138 ub2* y_len=
new ub2[nrows];
143 typedef map< EcalLogicID, MonH4TablePositionDat >::const_iterator CI;
144 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
145 channel = &(
p->first);
147 if (!logicID) {
throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB: Bad EcalLogicID")); }
149 iovid_vec[
count]=iovID;
151 dataitem = &(
p->second);
170 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
171 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
172 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
173 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
175 m_writeStmt->executeArrayUpdate(nrows);
188 throw(std::runtime_error(
"MonH4TablePositionDat::writeArrayDB(): "+e.getMessage()));
void fetchData(std::map< EcalLogicID, MonH4TablePositionDat > *fillMap, MonRunIOV *iov)
oracle::occi::SQLException SQLException
void writeArrayDB(const std::map< EcalLogicID, MonH4TablePositionDat > *data, MonRunIOV *iov)
void writeDB(const EcalLogicID *ecid, const MonH4TablePositionDat *item, MonRunIOV *iov)
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]