8 using namespace oracle::occi;
35 throw(std::runtime_error)
37 this->checkConnection();
40 m_writeStmt = m_conn->createStatement();
41 m_writeStmt->setSQL(
"INSERT INTO "+getTable()+
" (rec_id, sm_id, fed_id, tt_id, cry_id, low, mid, high) "
42 "VALUES (:1, :2, :3, :4, :5, :6, :7, :8 )");
44 throw(std::runtime_error(
"ODPedestalOffsetsDat::prepareWrite(): "+e.getMessage()));
51 throw(std::runtime_error)
53 this->checkConnection();
56 m_writeStmt->setInt(1, item->getId());
57 m_writeStmt->setInt(2, item->getSMId());
58 m_writeStmt->setInt(3, item->getFedId() );
59 m_writeStmt->setInt(4, item->getTTId() );
60 m_writeStmt->setInt(5, item->getCrystalId() );
61 m_writeStmt->setInt(6, item->getLow() );
62 m_writeStmt->setInt(7, item->getMid() );
63 m_writeStmt->setInt(8, item->getHigh() );
65 m_writeStmt->executeUpdate();
67 throw(std::runtime_error(
"ODPedestalOffsetsDat::writeDB(): "+e.getMessage()));
74 throw(std::runtime_error)
76 this->checkConnection();
78 iov->setConnection(m_env, m_conn);
79 int iovID =
iov->fetchID();
86 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id, cry_id");
87 m_readStmt->setInt(1, iovID);
88 ResultSet* rset = m_readStmt->executeQuery();
98 dat.
setLow( rset->getInt(6) );
99 dat.
setMid( rset->getInt(7) );
100 dat.
setHigh( rset->getInt(8) );
108 throw(std::runtime_error(
"ODPedestalOffsetsDat::fetchData(): "+e.getMessage()));
115 throw(std::runtime_error)
117 this->checkConnection();
119 int iovID =
iov->fetchID();
120 if (!iovID) {
throw(std::runtime_error(
"ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); }
123 int nrows=
data.size();
124 int* ids=
new int[nrows];
125 int* xx=
new int[nrows];
126 int* yy=
new int[nrows];
127 int* zz=
new int[nrows];
128 int* st=
new int[nrows];
129 int* xx1=
new int[nrows];
130 int* yy1=
new int[nrows];
131 int* zz1=
new int[nrows];
134 ub2* ids_len=
new ub2[nrows];
135 ub2* x_len=
new ub2[nrows];
136 ub2* y_len=
new ub2[nrows];
137 ub2* z_len=
new ub2[nrows];
138 ub2* st_len=
new ub2[nrows];
139 ub2* x1_len=
new ub2[nrows];
140 ub2* y1_len=
new ub2[nrows];
141 ub2* z1_len=
new ub2[nrows];
145 int n_data= (int)
data.size();
172 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT,
sizeof(ids[0]),ids_len);
173 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
174 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
175 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
176 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT ,
sizeof(st[0]), st_len );
177 m_writeStmt->setDataBuffer(6, (dvoid*)xx1, OCCIINT ,
sizeof(xx1[0]), x1_len );
178 m_writeStmt->setDataBuffer(7, (dvoid*)yy1, OCCIINT ,
sizeof(yy1[0]), y1_len );
179 m_writeStmt->setDataBuffer(8, (dvoid*)zz1, OCCIINT ,
sizeof(zz1[0]), z1_len );
182 m_writeStmt->executeArrayUpdate(nrows);
203 throw(std::runtime_error(
"ODPedestalOffsetsDat::writeArrayDB(): "+e.getMessage()));
void writeArrayDB(const std::vector< ODPedestalOffsetsDat > &data, ODFEPedestalOffsetInfo *iov)
void fetchData(std::vector< ODPedestalOffsetsDat > *fillMap, ODFEPedestalOffsetInfo *iov)
void setCrystalId(int dac)
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
char data[epos_bytes_allocation]
oracle::occi::SQLException SQLException
void writeDB(const ODPedestalOffsetsDat *item, ODFEPedestalOffsetInfo *iov)