16 m_writeStmt =
nullptr;
35 this->checkConnection();
38 m_writeStmt = m_conn->createStatement();
39 m_writeStmt->setSQL(
"INSERT INTO dcu_lvrb_temps_dat (iov_id, logic_id, " 41 "VALUES (:iov_id, :logic_id, " 43 }
catch (SQLException &
e) {
44 throw(std::runtime_error(
std::string(
"DCULVRBTempsDat::prepareWrite(): ")+getOraMessage(&e)));
53 this->checkConnection();
56 int iovID = iov->fetchID();
57 if (!iovID) {
throw(std::runtime_error(
"DCULVRBTempsDat::writeDB: IOV not in DB")); }
59 int logicID = ecid->getLogicID();
60 if (!logicID) {
throw(std::runtime_error(
"DCULVRBTempsDat::writeDB: Bad EcalLogicID")); }
63 m_writeStmt->setInt(1, iovID);
64 m_writeStmt->setInt(2, logicID);
66 m_writeStmt->setFloat(3, item->getT1() );
67 m_writeStmt->setFloat(4, item->getT2() );
68 m_writeStmt->setFloat(5, item->getT3() );
70 m_writeStmt->executeUpdate();
71 }
catch (SQLException &
e) {
72 throw(std::runtime_error(
std::string(
"DCULVRBTempsDat::writeDB(): ")+getOraMessage(&e)));
81 this->checkConnection();
84 iov->setConnection(m_env, m_conn);
85 int iovID = iov->fetchID();
93 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 95 "FROM channelview cv JOIN dcu_lvrb_temps_dat d " 96 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 97 "WHERE d.iov_id = :iov_id");
98 m_readStmt->setInt(1, iovID);
99 ResultSet* rset = m_readStmt->executeQuery();
101 std::pair< EcalLogicID, DCULVRBTempsDat >
p;
103 while(rset->next()) {
109 getOraString(rset,6));
111 dat.
setT1( rset->getFloat(7) );
112 dat.
setT2( rset->getFloat(8) );
113 dat.
setT3( rset->getFloat(9) );
118 }
catch (SQLException &
e) {
119 throw(std::runtime_error(
std::string(
"DCULVRBTempsDat::fetchData(): ")+getOraMessage(&e)));
126 this->checkConnection();
127 this->checkPrepare();
129 int iovID = iov->fetchID();
130 if (!iovID) {
throw(std::runtime_error(
"DCULVRBTempsDat::writeArrayDB: IOV not in DB")); }
133 int nrows=
data->size();
134 int* ids=
new int[nrows];
135 int* iovid_vec=
new int[nrows];
136 float*
xx=
new float[nrows];
137 float*
yy=
new float[nrows];
138 float*
zz=
new float[nrows];
140 ub2* ids_len=
new ub2[nrows];
141 ub2* iov_len=
new ub2[nrows];
142 ub2* x_len=
new ub2[nrows];
143 ub2* y_len=
new ub2[nrows];
144 ub2* z_len=
new ub2[nrows];
150 typedef map< EcalLogicID, DCULVRBTempsDat >::const_iterator CI;
151 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
152 channel = &(
p->first);
154 if (!logicID) {
throw(std::runtime_error(
"DCULVRBTempsDat::writeArrayDB: Bad EcalLogicID")); }
156 iovid_vec[
count]=iovID;
158 dataitem = &(
p->second);
160 float x=dataitem->
getT1();
161 float y=dataitem->
getT2();
162 float z=dataitem->
getT3();
184 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
185 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
186 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
187 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
188 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
191 m_writeStmt->executeArrayUpdate(nrows);
206 }
catch (SQLException &
e) {
207 throw(std::runtime_error(
std::string(
"DCULVRBTempsDat::writeArrayDB(): ")+getOraMessage(&e)));
void writeArrayDB(const std::map< EcalLogicID, DCULVRBTempsDat > *data, DCUIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
~DCULVRBTempsDat() override
char data[epos_bytes_allocation]
void writeDB(const EcalLogicID *ecid, const DCULVRBTempsDat *item, DCUIOV *iov) noexcept(false)
void fetchData(std::map< EcalLogicID, DCULVRBTempsDat > *fillVec, DCUIOV *iov) noexcept(false)