39 this->checkConnection();
42 m_writeStmt = m_conn->createStatement();
43 m_writeStmt->setSQL(
"INSERT INTO fe_config_lin_dat (lin_conf_id, logic_id, " 44 " multx12, multx6, multx1, shift12, shift6, shift1 ) " 45 "VALUES (:lin_conf_id, :logic_id, " 46 ":multx12, :multx6, :multx1, :shift12, :shift6, :shift1 )" );
48 throw(std::runtime_error(
"FEConfigLinDat::prepareWrite(): "+e.getMessage()));
57 this->checkConnection();
60 int iconfID = iconf->fetchID();
61 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLinDat::writeDB: ICONF not in DB")); }
63 int logicID = ecid->getLogicID();
64 if (!logicID) {
throw(std::runtime_error(
"FEConfigLinDat::writeDB: Bad EcalLogicID")); }
67 m_writeStmt->setInt(1, iconfID);
68 m_writeStmt->setInt(2, logicID);
69 m_writeStmt->setInt(3, item->getMultX12());
70 m_writeStmt->setInt(4, item->getMultX6());
71 m_writeStmt->setInt(5, item->getMultX1());
72 m_writeStmt->setInt(6, item->getShift12());
73 m_writeStmt->setInt(7, item->getShift6());
74 m_writeStmt->setInt(8, item->getShift1());
76 m_writeStmt->executeUpdate();
78 throw(std::runtime_error(
"FEConfigLinDat::writeDB(): "+e.getMessage()));
87 this->checkConnection();
90 iconf->setConnection(m_env, m_conn);
91 int iconfID = iconf->fetchID();
99 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 100 "d.multx12, d.multx6, d.multx1, d.shift12, d.shift6, d.shift1 " 101 "FROM channelview cv JOIN fe_config_lin_dat d " 102 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 103 "WHERE lin_conf_id = :lin_conf_id");
104 m_readStmt->setInt(1, iconfID);
105 ResultSet* rset = m_readStmt->executeQuery();
107 std::pair< EcalLogicID, FEConfigLinDat >
p;
109 while(rset->next()) {
128 throw(std::runtime_error(
"FEConfigLinDat::fetchData: "+e.getMessage()));
135 this->checkConnection();
136 this->checkPrepare();
138 int iconfID = iconf->fetchID();
139 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLinDat::writeArrayDB: ICONF not in DB")); }
142 int nrows=
data->size();
143 int* ids=
new int[nrows];
144 int* iconfid_vec=
new int[nrows];
145 int*
xx=
new int[nrows];
146 int*
yy=
new int[nrows];
147 int*
zz=
new int[nrows];
148 int* ww=
new int[nrows];
149 int*
rr=
new int[nrows];
150 int* ss=
new int[nrows];
152 ub2* ids_len=
new ub2[nrows];
153 ub2* iconf_len=
new ub2[nrows];
154 ub2* x_len=
new ub2[nrows];
155 ub2* y_len=
new ub2[nrows];
156 ub2* z_len=
new ub2[nrows];
157 ub2* w_len=
new ub2[nrows];
158 ub2* r_len=
new ub2[nrows];
159 ub2* s_len=
new ub2[nrows];
165 typedef map< EcalLogicID, FEConfigLinDat >::const_iterator CI;
166 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
167 channel = &(
p->first);
169 if (!logicID) {
throw(std::runtime_error(
"FEConfigLinDat::writeArrayDB: Bad EcalLogicID")); }
171 iconfid_vec[
count]=iconfID;
173 dataitem = &(
p->second);
204 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
205 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
206 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
207 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
208 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
209 m_writeStmt->setDataBuffer(6, (dvoid*)ww, OCCIINT ,
sizeof(ww[0]), w_len );
210 m_writeStmt->setDataBuffer(7, (dvoid*)rr, OCCIINT ,
sizeof(rr[0]), r_len );
211 m_writeStmt->setDataBuffer(8, (dvoid*)ss, OCCIINT ,
sizeof(ss[0]), s_len );
213 m_writeStmt->executeArrayUpdate(nrows);
216 delete [] iconfid_vec;
234 throw(std::runtime_error(
"FEConfigLinDat::writeArrayDB(): "+e.getMessage()));
oracle::occi::SQLException SQLException
void prepareWrite() noexcept(false)
void writeDB(const EcalLogicID *ecid, const FEConfigLinDat *item, FEConfigLinInfo *iconf) noexcept(false)
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]
void writeArrayDB(const std::map< EcalLogicID, FEConfigLinDat > *data, FEConfigLinInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigLinDat > *fillMap, FEConfigLinInfo *iconf) noexcept(false)