13 m_writeStmt =
nullptr;
28 this->checkConnection();
31 m_writeStmt = m_conn->createStatement();
32 m_writeStmt->setSQL(
"INSERT INTO " + getTable() +
33 " (rec_id, fed_id, sample_id, weight_number ) "
34 "VALUES (:1, :2, :3, :4 )");
36 throw(std::runtime_error(
"ODWeightsSamplesDat::prepareWrite(): " +
e.getMessage()));
41 this->checkConnection();
44 m_writeStmt->setInt(1,
item->getId());
45 m_writeStmt->setInt(2,
item->getFedId());
46 m_writeStmt->setInt(3,
item->getSampleId());
47 m_writeStmt->setInt(4,
item->getWeightNumber());
49 m_writeStmt->executeUpdate();
51 throw(std::runtime_error(
"ODWeightsSamplesDat::writeDB(): " +
e.getMessage()));
56 this->checkConnection();
58 iov->setConnection(m_env, m_conn);
59 int iovID = iov->fetchID();
66 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :rec_id order by fed_id, sample_id");
67 m_readStmt->setInt(1, iovID);
68 ResultSet* rset = m_readStmt->executeQuery();
72 while (rset->next()) {
82 throw(std::runtime_error(
"ODWeightsSamplesDat::fetchData(): " +
e.getMessage()));
87 this->checkConnection();
90 m_readStmt->setSQL(
"SELECT * FROM " + getTable() +
" WHERE rec_id = :1 order by fed_id, sample_id");
91 m_readStmt->setInt(1,
p->getId());
92 ResultSet* rset = m_readStmt->executeQuery();
94 while (rset->next()) {
95 p->setFedId(rset->getInt(2));
96 p->setSampleId(rset->getInt(3));
97 p->setWeightNumber(rset->getInt(4));
101 throw(std::runtime_error(
"ODWeightsSamplesDat::fetchData(): " +
e.getMessage()));
109 this->checkConnection();
111 int iovID = iov->fetchID();
113 throw(std::runtime_error(
"ODDelays::writeArrayDB: ODFEDelaysInfo not in DB"));
116 int nrows =
data.size();
117 int* ids =
new int[nrows];
118 int*
xx =
new int[nrows];
119 int*
yy =
new int[nrows];
120 int*
zz =
new int[nrows];
122 ub2* ids_len =
new ub2[nrows];
123 ub2* x_len =
new ub2[nrows];
124 ub2* y_len =
new ub2[nrows];
125 ub2* z_len =
new ub2[nrows];
144 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len);
145 m_writeStmt->setDataBuffer(2, (dvoid*)
xx, OCCIINT,
sizeof(
xx[0]), x_len);
146 m_writeStmt->setDataBuffer(3, (dvoid*)
yy, OCCIINT,
sizeof(
yy[0]), y_len);
147 m_writeStmt->setDataBuffer(4, (dvoid*)
zz, OCCIINT,
sizeof(
zz[0]), z_len);
149 m_writeStmt->executeArrayUpdate(nrows);
162 throw(std::runtime_error(
"ODWeightsSamplesDat::writeArrayDB(): " +
e.getMessage()));