14 m_writeStmt =
nullptr;
25 this->checkConnection();
28 m_writeStmt = m_conn->createStatement();
29 m_writeStmt->setSQL(
"INSERT INTO " + getTable() +
30 " (lut_conf_id, logic_id, " 31 " etsat, ttthreshlow, ttthreshhigh ) " 32 "VALUES (:lut_conf_id, :logic_id, " 33 ":etsat, :ttthreshlow, :ttthreshhigh )");
34 }
catch (SQLException&
e) {
35 throw(std::runtime_error(
"FEConfigLUTParamDat::prepareWrite(): " +
e.getMessage()));
42 this->checkConnection();
45 int iconfID = iconf->fetchID();
47 throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB: ICONF not in DB"));
50 int logicID = ecid->getLogicID();
52 throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB: Bad EcalLogicID"));
56 m_writeStmt->setInt(1, iconfID);
57 m_writeStmt->setInt(2, logicID);
58 m_writeStmt->setFloat(3,
item->getETSat());
59 m_writeStmt->setFloat(4,
item->getTTThreshlow());
60 m_writeStmt->setFloat(5,
item->getTTThreshhigh());
62 m_writeStmt->executeUpdate();
63 }
catch (SQLException&
e) {
64 throw(std::runtime_error(
"FEConfigLUTParamDat::writeDB(): " +
e.getMessage()));
70 this->checkConnection();
73 iconf->setConnection(m_env, m_conn);
74 int iconfID = iconf->fetchID();
82 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 83 " d.etsat, d.ttthreshlow, d.ttthreshhigh " 84 "FROM channelview cv JOIN " +
87 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 88 "WHERE lut_conf_id = :lut_conf_id");
89 m_readStmt->setInt(1, iconfID);
90 ResultSet* rset = m_readStmt->executeQuery();
92 std::pair<EcalLogicID, FEConfigLUTParamDat>
p;
94 while (rset->next()) {
109 }
catch (SQLException&
e) {
110 throw(std::runtime_error(
"FEConfigLUTParamDat::fetchData: " +
e.getMessage()));
116 this->checkConnection();
117 this->checkPrepare();
119 int iconfID = iconf->fetchID();
121 throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB: ICONF not in DB"));
124 int nrows =
data->size();
125 int* ids =
new int[nrows];
126 int* iov_vec =
new int[nrows];
127 float*
xx =
new float[nrows];
128 float*
yy =
new float[nrows];
129 float*
zz =
new float[nrows];
131 ub2* ids_len =
new ub2[nrows];
132 ub2* iov_len =
new ub2[nrows];
133 ub2* x_len =
new ub2[nrows];
134 ub2* y_len =
new ub2[nrows];
135 ub2* z_len =
new ub2[nrows];
140 typedef map<EcalLogicID, FEConfigLUTParamDat>::const_iterator CI;
141 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
142 channel = &(
p->first);
145 throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB: Bad EcalLogicID"));
147 ids[
count] = logicID;
148 iov_vec[
count] = iconfID;
150 dataitem = &(
p->second);
171 m_writeStmt->setDataBuffer(1, (dvoid*)iov_vec, OCCIINT,
sizeof(iov_vec[0]), iov_len);
172 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
173 m_writeStmt->setDataBuffer(3, (dvoid*)
xx, OCCIFLOAT,
sizeof(
xx[0]), x_len);
174 m_writeStmt->setDataBuffer(4, (dvoid*)
yy, OCCIFLOAT,
sizeof(
yy[0]), y_len);
175 m_writeStmt->setDataBuffer(5, (dvoid*)
zz, OCCIFLOAT,
sizeof(
zz[0]), z_len);
177 m_writeStmt->executeArrayUpdate(nrows);
191 }
catch (SQLException&
e) {
192 throw(std::runtime_error(
"FEConfigLUTParamDat::writeArrayDB(): " +
e.getMessage()));
float getTTThreshlow() const
void prepareWrite() noexcept(false) override
~FEConfigLUTParamDat() override
float getTTThreshhigh() const
void writeDB(const EcalLogicID *ecid, const FEConfigLUTParamDat *item, FEConfigLUTInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigLUTParamDat > *fillMap, FEConfigLUTInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]
void setTTThreshhigh(float x)
void writeArrayDB(const std::map< EcalLogicID, FEConfigLUTParamDat > *data, FEConfigLUTInfo *iconf) noexcept(false)
void setTTThreshlow(float x)