9 using namespace oracle::occi;
42 throw(std::runtime_error)
44 this->checkConnection();
47 m_writeStmt = m_conn->createStatement();
48 m_writeStmt->setSQL(
" INSERT INTO "+getTable()+
" (iov_id, logic_id, "
49 " qpll_error, optical_link, data_timeout, dcc_header, event_number, bx_number, "
50 " even_parity, odd_parity, block_size, almost_full_fifo, full_fifo, "
51 " forced_full_supp ) "
52 " VALUES (:iov_id, :logic_id, "
53 " :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12 ) ");
55 throw(std::runtime_error(
"MODDCCDetailsDat::prepareWrite(): "+e.getMessage()));
62 throw(std::runtime_error)
64 this->checkConnection();
67 int iovID =
iov->fetchID();
68 if (!iovID) {
throw(std::runtime_error(
"MODDCCDetailsDat::writeDB: IOV not in DB")); }
70 int logicID = ecid->getLogicID();
71 if (!logicID) {
throw(std::runtime_error(
"MODDCCDetailsDat::writeDB: Bad EcalLogicID")); }
74 m_writeStmt->setInt(1, iovID);
75 m_writeStmt->setInt(2, logicID);
76 m_writeStmt->setInt(3, item->getQPLL() );
77 m_writeStmt->setInt(4, item->getOpticalLink() );
78 m_writeStmt->setInt(5, item->getDataTimeout() );
79 m_writeStmt->setInt(6, item->getHeader() );
80 m_writeStmt->setInt(7, item->getEventNumber() );
81 m_writeStmt->setInt(8, item->getBXNumber() );
82 m_writeStmt->setInt(9, item->getEvenParity() );
83 m_writeStmt->setInt(10, item->getOddParity() );
84 m_writeStmt->setInt(11, item->getBlockSize() );
85 m_writeStmt->setInt(12, item->getAlmostFullFIFO() );
86 m_writeStmt->setInt(13, item->getFullFIFO() );
87 m_writeStmt->setInt(14, item->getForcedFullSupp() );
89 m_writeStmt->executeUpdate();
91 throw(std::runtime_error(
"MODDCCDetailsDat::writeDB(): "+e.getMessage()));
98 throw(std::runtime_error)
100 this->checkConnection();
103 iov->setConnection(m_env, m_conn);
104 int iovID =
iov->fetchID();
112 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
113 " d.qpll_error, d.optical_link, d.data_timeout, d.dcc_header, d.event_number, d.bx_number, d.even_parity, d.odd_parity, d.block_size, d.almost_full_fifo, d.full_fifo, d.forced_full_supp "
114 "FROM channelview cv JOIN "+getTable()+
" d "
115 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
116 "WHERE d.iov_id = :iov_id");
117 m_readStmt->setInt(1, iovID);
118 ResultSet* rset = m_readStmt->executeQuery();
120 std::pair< EcalLogicID, MODDCCDetailsDat >
p;
122 while(rset->next()) {
130 dat.
setQPLL( rset->getInt(7) );
147 throw(std::runtime_error(
"MODDCCDetailsDat::fetchData(): "+e.getMessage()));
152 throw(std::runtime_error)
154 this->checkConnection();
155 this->checkPrepare();
157 int iovID =
iov->fetchID();
158 if (!iovID) {
throw(std::runtime_error(
"MODDCCDetailsDat::writeArrayDB: IOV not in DB")); }
161 int nrows=
data->size();
162 int* ids=
new int[nrows];
163 int* iovid_vec=
new int[nrows];
164 int* xx1=
new int[nrows];
165 int* xx2=
new int[nrows];
166 int* xx3=
new int[nrows];
167 int* xx4=
new int[nrows];
168 int* xx5=
new int[nrows];
169 int* xx6=
new int[nrows];
170 int* xx7=
new int[nrows];
171 int* xx8=
new int[nrows];
172 int* xx9=
new int[nrows];
173 int* xx10=
new int[nrows];
174 int* xx11=
new int[nrows];
175 int* xx12=
new int[nrows];
177 ub2* ids_len=
new ub2[nrows];
178 ub2* iov_len=
new ub2[nrows];
179 ub2* x1_len=
new ub2[nrows];
180 ub2* x2_len=
new ub2[nrows];
181 ub2* x3_len=
new ub2[nrows];
182 ub2* x4_len=
new ub2[nrows];
183 ub2* x5_len=
new ub2[nrows];
184 ub2* x6_len=
new ub2[nrows];
185 ub2* x7_len=
new ub2[nrows];
186 ub2* x8_len=
new ub2[nrows];
187 ub2* x9_len=
new ub2[nrows];
188 ub2* x10_len=
new ub2[nrows];
189 ub2* x11_len=
new ub2[nrows];
190 ub2* x12_len=
new ub2[nrows];
195 typedef map< EcalLogicID, MODDCCDetailsDat >::const_iterator CI;
196 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
197 channel = &(
p->first);
199 if (!logicID) {
throw(std::runtime_error(
"MODDCCDetailsDat::writeArrayDB: Bad EcalLogicID")); }
201 iovid_vec[
count]=iovID;
203 dataitem = &(
p->second);
253 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
254 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
255 m_writeStmt->setDataBuffer(3, (dvoid*)xx1, OCCIINT ,
sizeof(xx1[0]), x1_len );
256 m_writeStmt->setDataBuffer(4, (dvoid*)xx2, OCCIINT ,
sizeof(xx2[0]), x2_len );
257 m_writeStmt->setDataBuffer(5, (dvoid*)xx3, OCCIINT ,
sizeof(xx3[0]), x3_len );
258 m_writeStmt->setDataBuffer(6, (dvoid*)xx4, OCCIINT ,
sizeof(xx4[0]), x4_len );
259 m_writeStmt->setDataBuffer(7, (dvoid*)xx5, OCCIINT ,
sizeof(xx5[0]), x5_len );
260 m_writeStmt->setDataBuffer(8, (dvoid*)xx6, OCCIINT ,
sizeof(xx6[0]), x6_len );
261 m_writeStmt->setDataBuffer(9, (dvoid*)xx7, OCCIINT ,
sizeof(xx7[0]), x7_len );
262 m_writeStmt->setDataBuffer(10, (dvoid*)xx8, OCCIINT ,
sizeof(xx8[0]), x8_len );
263 m_writeStmt->setDataBuffer(11, (dvoid*)xx9, OCCIINT ,
sizeof(xx9[0]), x9_len );
264 m_writeStmt->setDataBuffer(12, (dvoid*)xx10, OCCIINT ,
sizeof(xx10[0]), x10_len );
265 m_writeStmt->setDataBuffer(13, (dvoid*)xx11, OCCIINT ,
sizeof(xx11[0]), x11_len );
266 m_writeStmt->setDataBuffer(14, (dvoid*)xx12, OCCIINT ,
sizeof(xx12[0]), x12_len );
268 m_writeStmt->executeArrayUpdate(nrows);
303 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): "+e.getMessage()));
void writeDB(const EcalLogicID *ecid, const MODDCCDetailsDat *item, MODRunIOV *iov)
void fetchData(std::map< EcalLogicID, MODDCCDetailsDat > *fillMap, MODRunIOV *iov)
void setEventNumber(int x)
void setEvenParity(int x)
int getEventNumber() const
oracle::occi::SQLException SQLException
int getAlmostFullFIFO() const
void setDataTimeout(int x)
int getDataTimeout() const
int getForcedFullSupp() const
int getOpticalLink() const
void writeArrayDB(const std::map< EcalLogicID, MODDCCDetailsDat > *data, MODRunIOV *iov)
oracle::occi::ResultSet ResultSet
void setForcedFullSupp(int x)
void setAlmostFullFIFO(int x)
void fillMap(Registry *reg, regmap_type &fillme)
int getEvenParity() const
void setOpticalLink(int x)