13 m_writeStmt =
nullptr;
25 this->checkConnection();
28 m_writeStmt = m_conn->createStatement();
29 m_writeStmt->setSQL(
"INSERT INTO " + getTable() +
30 " (rec_id, sm_id, fed_id, tt_id, time_offset ) " 31 "VALUES (:1, :2, :3, :4, :5 )");
33 throw(std::runtime_error(
"ODDelaysDat::prepareWrite(): " +
e.getMessage()));
38 this->checkConnection();
41 m_writeStmt->setInt(1,
item->getId());
42 m_writeStmt->setInt(2,
item->getSMId());
43 m_writeStmt->setInt(3,
item->getFedId());
44 m_writeStmt->setInt(4,
item->getTTId());
45 m_writeStmt->setInt(5,
item->getTimeOffset());
47 m_writeStmt->executeUpdate();
49 throw(std::runtime_error(
"ODDelaysDat::writeDB(): " +
e.getMessage()));
54 iov->setConnection(m_env, m_conn);
55 int iovID = iov->fetchID();
60 this->checkConnection();
68 m_readStmt = m_conn->createStatement();
69 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id");
70 m_readStmt->setInt(1, iovID);
71 ResultSet* rset = m_readStmt->executeQuery();
75 while (rset->next()) {
85 throw(std::runtime_error(
"ODDelaysDat::fetchData(): " +
e.getMessage()));
92 this->checkConnection();
94 int iovID = iov->fetchID();
96 throw(std::runtime_error(
"ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
99 int nrows =
data.size();
100 int* ids =
new int[nrows];
101 int*
xx =
new int[nrows];
102 int*
yy =
new int[nrows];
103 int*
zz =
new int[nrows];
104 int* st =
new int[nrows];
106 ub2* ids_len =
new ub2[nrows];
107 ub2* x_len =
new ub2[nrows];
108 ub2* y_len =
new ub2[nrows];
109 ub2* z_len =
new ub2[nrows];
110 ub2* st_len =
new ub2[nrows];
132 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
133 m_writeStmt->setDataBuffer(2, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
134 m_writeStmt->setDataBuffer(3, (dvoid*)
yy, OCCIINT,
sizeof(
yy[0]), y_len);
135 m_writeStmt->setDataBuffer(4, (dvoid*)
zz, OCCIINT,
sizeof(
zz[0]), z_len);
136 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT,
sizeof(st[0]), st_len);
138 m_writeStmt->executeArrayUpdate(nrows);
153 throw(std::runtime_error(
"ODDelaysDat::writeArrayDB(): " +
e.getMessage()));
void writeDB(const ODDelaysDat *item, ODFEDelaysInfo *iov) noexcept(false)
void setTimeOffset(int dac)
void fetchData(std::vector< ODDelaysDat > *fillMap, int id) noexcept(false)
int getTimeOffset() const
void prepareWrite() noexcept(false) override
void writeArrayDB(const std::vector< ODDelaysDat > &data, ODFEDelaysInfo *iov) noexcept(false)
char data[epos_bytes_allocation]
oracle::occi::SQLException SQLException