14 m_writeStmt =
nullptr;
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO "+getTable()+
" (rec_id, fed_id, sample_id, weight_number ) " 41 "VALUES (:1, :2, :3, :4 )");
43 throw(std::runtime_error(
std::string(
"ODWeightsSamplesDat::prepareWrite(): ")+getOraMessage(&e)));
52 this->checkConnection();
55 m_writeStmt->setInt(1, item->getId());
56 m_writeStmt->setInt(2, item->getFedId() );
57 m_writeStmt->setInt(3, item->getSampleId() );
58 m_writeStmt->setInt(4, item->getWeightNumber() );
60 m_writeStmt->executeUpdate();
62 throw(std::runtime_error(
std::string(
"ODWeightsSamplesDat::writeDB(): ")+getOraMessage(&e)));
71 this->checkConnection();
73 iov->setConnection(m_env, m_conn);
74 int iovID = iov->fetchID();
81 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :rec_id order by fed_id, sample_id");
82 m_readStmt->setInt(1, iovID);
83 ResultSet* rset = m_readStmt->executeQuery();
98 throw(std::runtime_error(
std::string(
"ODWeightsSamplesDat::fetchData(): ")+getOraMessage(&e)));
106 this->checkConnection();
109 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :1 order by fed_id, sample_id");
110 m_readStmt->setInt(1,
p->getId());
111 ResultSet* rset = m_readStmt->executeQuery();
113 while(rset->next()) {
114 p->setFedId( rset->getInt(2) );
115 p->setSampleId( rset->getInt(3) );
116 p->setWeightNumber( rset->getInt(4) );
120 throw(std::runtime_error(
std::string(
"ODWeightsSamplesDat::fetchData(): ")+getOraMessage(&e)));
129 this->checkConnection();
131 int iovID = iov->fetchID();
132 if (!iovID) {
throw(std::runtime_error(
"ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); }
135 int nrows=
data.size();
136 int* ids=
new int[nrows];
137 int*
xx=
new int[nrows];
138 int*
yy=
new int[nrows];
139 int*
zz=
new int[nrows];
141 ub2* ids_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];
166 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT,
sizeof(ids[0]),ids_len);
167 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
168 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
169 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
172 m_writeStmt->executeArrayUpdate(nrows);
185 throw(std::runtime_error(
std::string(
"ODWeightsSamplesDat::writeArrayDB(): ")+getOraMessage(&e)));
void setWeightNumber(int dac)
void prepareWrite() noexcept(false) override
int getWeightNumber() const
void writeArrayDB(const std::vector< ODWeightsSamplesDat > &data, ODFEWeightsInfo *iov) noexcept(false)
void fetchData(std::vector< ODWeightsSamplesDat > *fillMap, ODFEWeightsInfo *iov) noexcept(false)
void writeDB(const ODWeightsSamplesDat *item, ODFEWeightsInfo *iov) noexcept(false)
char data[epos_bytes_allocation]
oracle::occi::SQLException SQLException
void setSampleId(int dac)
~ODWeightsSamplesDat() override