8 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()+
" (rec_id, sm_id, fed_id, tt_id, time_offset ) "
40 "VALUES (:1, :2, :3, :4, :5 )");
42 throw(std::runtime_error(
"ODDelaysDat::prepareWrite(): "+e.getMessage()));
49 throw(std::runtime_error)
51 this->checkConnection();
54 m_writeStmt->setInt(1, item->getId());
55 m_writeStmt->setInt(2, item->getSMId());
56 m_writeStmt->setInt(3, item->getFedId() );
57 m_writeStmt->setInt(4, item->getTTId() );
58 m_writeStmt->setInt(5, item->getTimeOffset() );
60 m_writeStmt->executeUpdate();
62 throw(std::runtime_error(
"ODDelaysDat::writeDB(): "+e.getMessage()));
67 throw(std::runtime_error) {
68 iov->setConnection(m_env, m_conn);
69 int iovID =
iov->fetchID();
74 throw(std::runtime_error)
76 this->checkConnection();
84 m_readStmt = m_conn->createStatement();
85 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id");
86 m_readStmt->setInt(1, iovID);
87 ResultSet* rset = m_readStmt->executeQuery();
102 throw(std::runtime_error(
"ODDelaysDat::fetchData(): "+e.getMessage()));
109 throw(std::runtime_error)
111 this->checkConnection();
113 int iovID =
iov->fetchID();
114 if (!iovID) {
throw(std::runtime_error(
"ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); }
117 int nrows=
data.size();
118 int* ids=
new int[nrows];
119 int* xx=
new int[nrows];
120 int* yy=
new int[nrows];
121 int* zz=
new int[nrows];
122 int* st=
new int[nrows];
126 ub2* ids_len=
new ub2[nrows];
127 ub2* x_len=
new ub2[nrows];
128 ub2* y_len=
new ub2[nrows];
129 ub2* z_len=
new ub2[nrows];
130 ub2* st_len=
new ub2[nrows];
135 int n_data= (int)
data.size();
156 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT,
sizeof(ids[0]),ids_len);
157 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
158 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
159 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
160 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
162 m_writeStmt->executeArrayUpdate(nrows);
177 throw(std::runtime_error(
"ODDelaysDat::writeArrayDB(): "+e.getMessage()));
void writeArrayDB(const std::vector< ODDelaysDat > &data, ODFEDelaysInfo *iov)
void setTimeOffset(int dac)
void writeDB(const ODDelaysDat *item, ODFEDelaysInfo *iov)
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]
oracle::occi::SQLException SQLException
int getTimeOffset() const
void fetchData(std::vector< ODDelaysDat > *fillMap, int id)