9 using namespace oracle::occi;
33 throw(std::runtime_error)
35 this->checkConnection();
38 m_writeStmt = m_conn->createStatement();
39 m_writeStmt->setSQL(
"INSERT INTO "+getTable()+
" (lut_conf_id, logic_id, "
40 " etsat, ttthreshlow, ttthreshhigh ) "
41 "VALUES (:lut_conf_id, :logic_id, "
42 ":etsat, :ttthreshlow, :ttthreshhigh )" );
44 throw(std::runtime_error(
"FEConfigLUTParamDat::prepareWrite(): "+e.getMessage()));
51 throw(std::runtime_error)
53 this->checkConnection();
56 int iconfID = iconf->fetchID();
57 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB: ICONF not in DB")); }
59 int logicID = ecid->getLogicID();
60 if (!logicID) {
throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB: Bad EcalLogicID")); }
63 m_writeStmt->setInt(1, iconfID);
64 m_writeStmt->setInt(2, logicID);
65 m_writeStmt->setFloat(3, item->getETSat());
66 m_writeStmt->setFloat(4, item->getTTThreshlow());
67 m_writeStmt->setFloat(5, item->getTTThreshhigh());
69 m_writeStmt->executeUpdate();
71 throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB(): "+e.getMessage()));
78 throw(std::runtime_error)
80 this->checkConnection();
83 iconf->setConnection(m_env, m_conn);
84 int iconfID = iconf->fetchID();
92 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
93 " d.etsat, d.ttthreshlow, d.ttthreshhigh "
94 "FROM channelview cv JOIN "+getTable()+
" d "
95 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
96 "WHERE lut_conf_id = :lut_conf_id");
97 m_readStmt->setInt(1, iconfID);
98 ResultSet* rset = m_readStmt->executeQuery();
100 std::pair< EcalLogicID, FEConfigLUTParamDat >
p;
102 while(rset->next()) {
120 throw(std::runtime_error(
"FEConfigLUTParamDat::fetchData: "+e.getMessage()));
125 throw(std::runtime_error)
127 this->checkConnection();
128 this->checkPrepare();
130 int iconfID = iconf->fetchID();
131 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB: ICONF not in DB")); }
134 int nrows=
data->size();
135 int* ids=
new int[nrows];
136 int* iov_vec=
new int[nrows];
137 float* xx=
new float[nrows];
138 float* yy=
new float[nrows];
139 float* zz=
new float[nrows];
142 ub2* ids_len=
new ub2[nrows];
143 ub2* iov_len=
new ub2[nrows];
144 ub2* x_len=
new ub2[nrows];
145 ub2* y_len=
new ub2[nrows];
146 ub2* z_len=
new ub2[nrows];
152 typedef map< EcalLogicID, FEConfigLUTParamDat >::const_iterator CI;
153 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
154 channel = &(
p->first);
156 if (!logicID) {
throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB: Bad EcalLogicID")); }
158 iov_vec[
count]=iconfID;
160 dataitem = &(
p->second);
183 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]),iov_len);
184 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
185 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIFLOAT ,
sizeof(xx[0]), x_len );
186 m_writeStmt->setDataBuffer(4, (dvoid*)yy, OCCIFLOAT ,
sizeof(yy[0]), y_len );
187 m_writeStmt->setDataBuffer(5, (dvoid*)zz, OCCIFLOAT ,
sizeof(zz[0]), z_len );
189 m_writeStmt->executeArrayUpdate(nrows);
204 throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB(): "+e.getMessage()));
float getTTThreshhigh() const
void fetchData(std::map< EcalLogicID, FEConfigLUTParamDat > *fillMap, FEConfigLUTInfo *iconf)
oracle::occi::SQLException SQLException
void writeArrayDB(const std::map< EcalLogicID, FEConfigLUTParamDat > *data, FEConfigLUTInfo *iconf)
float getTTThreshlow() const
void writeDB(const EcalLogicID *ecid, const FEConfigLUTParamDat *item, FEConfigLUTInfo *iconf)
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]
void setTTThreshhigh(float x)
void setTTThreshlow(float x)