14 m_writeStmt =
nullptr;
34 this->checkConnection();
37 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
" INSERT INTO " + getTable() +
39 " (iov_id, logic_id, "
40 " qpll_error, optical_link, data_timeout, dcc_header, event_number, bx_number, "
41 " even_parity, odd_parity, block_size, almost_full_fifo, full_fifo, "
42 " forced_full_supp ) "
43 " VALUES (:iov_id, :logic_id, "
44 " :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12 ) ");
45 }
catch (SQLException&
e) {
46 throw(std::runtime_error(
"MODDCCDetailsDat::prepareWrite(): " +
e.getMessage()));
51 this->checkConnection();
54 int iovID = iov->fetchID();
56 throw(std::runtime_error(
"MODDCCDetailsDat::writeDB: IOV not in DB"));
59 int logicID = ecid->getLogicID();
61 throw(std::runtime_error(
"MODDCCDetailsDat::writeDB: Bad EcalLogicID"));
65 m_writeStmt->setInt(1, iovID);
66 m_writeStmt->setInt(2, logicID);
67 m_writeStmt->setInt(3,
item->getQPLL());
68 m_writeStmt->setInt(4,
item->getOpticalLink());
69 m_writeStmt->setInt(5,
item->getDataTimeout());
70 m_writeStmt->setInt(6,
item->getHeader());
71 m_writeStmt->setInt(7,
item->getEventNumber());
72 m_writeStmt->setInt(8,
item->getBXNumber());
73 m_writeStmt->setInt(9,
item->getEvenParity());
74 m_writeStmt->setInt(10,
item->getOddParity());
75 m_writeStmt->setInt(11,
item->getBlockSize());
76 m_writeStmt->setInt(12,
item->getAlmostFullFIFO());
77 m_writeStmt->setInt(13,
item->getFullFIFO());
78 m_writeStmt->setInt(14,
item->getForcedFullSupp());
80 m_writeStmt->executeUpdate();
81 }
catch (SQLException&
e) {
82 throw(std::runtime_error(
"MODDCCDetailsDat::writeDB(): " +
e.getMessage()));
87 this->checkConnection();
90 iov->setConnection(m_env, m_conn);
91 int iovID = iov->fetchID();
99 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
100 " d.qpll_error, d.optical_link, d.data_timeout, d.dcc_header, d.event_number, d.bx_number, d.even_parity, "
101 "d.odd_parity, d.block_size, d.almost_full_fifo, d.full_fifo, d.forced_full_supp "
102 "FROM channelview cv JOIN " +
105 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
106 "WHERE d.iov_id = :iov_id");
107 m_readStmt->setInt(1, iovID);
108 ResultSet* rset = m_readStmt->executeQuery();
110 std::pair<EcalLogicID, MODDCCDetailsDat>
p;
112 while (rset->next()) {
136 }
catch (SQLException&
e) {
137 throw(std::runtime_error(
"MODDCCDetailsDat::fetchData(): " +
e.getMessage()));
143 this->checkConnection();
144 this->checkPrepare();
146 int iovID = iov->fetchID();
148 throw(std::runtime_error(
"MODDCCDetailsDat::writeArrayDB: IOV not in DB"));
151 int nrows =
data->size();
152 int* ids =
new int[nrows];
153 int* iovid_vec =
new int[nrows];
154 int* xx1 =
new int[nrows];
155 int* xx2 =
new int[nrows];
156 int* xx3 =
new int[nrows];
157 int* xx4 =
new int[nrows];
158 int* xx5 =
new int[nrows];
159 int* xx6 =
new int[nrows];
160 int* xx7 =
new int[nrows];
161 int* xx8 =
new int[nrows];
162 int* xx9 =
new int[nrows];
163 int* xx10 =
new int[nrows];
164 int* xx11 =
new int[nrows];
165 int* xx12 =
new int[nrows];
167 ub2* ids_len =
new ub2[nrows];
168 ub2* iov_len =
new ub2[nrows];
169 ub2* x1_len =
new ub2[nrows];
170 ub2* x2_len =
new ub2[nrows];
171 ub2* x3_len =
new ub2[nrows];
172 ub2* x4_len =
new ub2[nrows];
173 ub2* x5_len =
new ub2[nrows];
174 ub2* x6_len =
new ub2[nrows];
175 ub2* x7_len =
new ub2[nrows];
176 ub2* x8_len =
new ub2[nrows];
177 ub2* x9_len =
new ub2[nrows];
178 ub2* x10_len =
new ub2[nrows];
179 ub2* x11_len =
new ub2[nrows];
180 ub2* x12_len =
new ub2[nrows];
185 typedef map<EcalLogicID, MODDCCDetailsDat>::const_iterator CI;
186 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
187 channel = &(
p->first);
190 throw(std::runtime_error(
"MODDCCDetailsDat::writeArrayDB: Bad EcalLogicID"));
192 ids[
count] = logicID;
193 iovid_vec[
count] = iovID;
195 dataitem = &(
p->second);
243 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]), iov_len);
244 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
245 m_writeStmt->setDataBuffer(3, (dvoid*)xx1, OCCIINT,
sizeof(xx1[0]), x1_len);
246 m_writeStmt->setDataBuffer(4, (dvoid*)xx2, OCCIINT,
sizeof(xx2[0]), x2_len);
247 m_writeStmt->setDataBuffer(5, (dvoid*)xx3, OCCIINT,
sizeof(xx3[0]), x3_len);
248 m_writeStmt->setDataBuffer(6, (dvoid*)xx4, OCCIINT,
sizeof(xx4[0]), x4_len);
249 m_writeStmt->setDataBuffer(7, (dvoid*)xx5, OCCIINT,
sizeof(xx5[0]), x5_len);
250 m_writeStmt->setDataBuffer(8, (dvoid*)xx6, OCCIINT,
sizeof(xx6[0]), x6_len);
251 m_writeStmt->setDataBuffer(9, (dvoid*)xx7, OCCIINT,
sizeof(xx7[0]), x7_len);
252 m_writeStmt->setDataBuffer(10, (dvoid*)xx8, OCCIINT,
sizeof(xx8[0]), x8_len);
253 m_writeStmt->setDataBuffer(11, (dvoid*)xx9, OCCIINT,
sizeof(xx9[0]), x9_len);
254 m_writeStmt->setDataBuffer(12, (dvoid*)xx10, OCCIINT,
sizeof(xx10[0]), x10_len);
255 m_writeStmt->setDataBuffer(13, (dvoid*)xx11, OCCIINT,
sizeof(xx11[0]), x11_len);
256 m_writeStmt->setDataBuffer(14, (dvoid*)xx12, OCCIINT,
sizeof(xx12[0]), x12_len);
258 m_writeStmt->executeArrayUpdate(nrows);
290 }
catch (SQLException&
e) {
291 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): " +
e.getMessage()));