21 oracle::occi::Connection* conn):
LMFUnique(env, conn)
32 << std::endl << std::flush;
61 "CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV "
70 for (
int i = 0;
i < 3;
i++) {
72 stmt->setDate(i + 2, t);
80 "CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV "
81 "WHERE LMR_SUB_IOV_ID = :1";
91 for (
int i = 0;
i < 3;
i++) {
92 if (
m_t[
i].isNull()) {
98 throw(std::runtime_error(
m_className +
"::writeDB: LMFIOV not set"));
101 std::string sql =
"INSERT INTO LMF_LMR_SUB_IOV (LMR_SUB_IOV_ID, "
102 "IOV_ID, T1, T2, T3) "
103 "VALUES (LMF_LMR_SUB_IOV_ID_" + sp +
"_SQ.NextVal, :1, :2, :3, :4)";
106 for (
int i = 0;
i < 3;
i++) {
114 for (
int i = 0;
i < 3;
i++) {
115 oracle::occi::Date
t = rset->getDate(
i + 2);
121 throw(std::runtime_error) {
124 return getIOVIDsLaterThan(
t, tinf, 0);
128 throw(std::runtime_error) {
131 return getIOVIDsLaterThan(
t, tinf, howmany);
136 throw(std::runtime_error) {
137 return getIOVIDsLaterThan(tmin,
tmax, 0);
142 throw(std::runtime_error) {
145 std::string sql =
"SELECT * FROM (SELECT LMR_SUB_IOV_ID "
146 "FROM CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV WHERE T3 > :1 ";
148 sql +=
"AND T3 < :2 ORDER BY T3 ASC) ";
150 sql +=
"WHERE ROWNUM <= :3";
153 sql +=
"ORDER BY T3 ASC) ";
155 sql +=
"WHERE ROWNUM <= :2";
159 std::cout <<
"Executing query: " << std::endl << sql << std::endl;
162 if (m_conn !=
NULL) {
165 Statement *stmt = m_conn->createStatement();
166 stmt->setPrefetchRowCount(10000);
168 stmt->setDate(1, dh.
tmToDate(tmin));
172 stmt->setInt(3, howMany);
176 stmt->setInt(2, howMany);
181 while (rset->next() != 0) {
183 std::cout <<
"Getting row " << row++ << std::endl;
185 ret.push_back(rset->getInt(1));
187 stmt->setPrefetchRowCount(0);
188 m_conn->terminateStatement(stmt);
191 throw(std::runtime_error(m_className +
"::getLmrSubIOVLaterThan: " +
195 throw(std::runtime_error(m_className +
"::getLmrSubIOVLaterThan: " +
196 "Connection not set"));
203 std::cout <<
"Done!" << std::endl << std::flush;
tuple ret
prodAgent to be discontinued
void getParameters(ResultSet *rset)
oracle::occi::Environment * m_env
oracle::occi::Connection * m_conn
std::list< int > getIOVIDsLaterThan(const Tm &t)
std::string sequencePostfix(const Tm &t)
oracle::occi::ResultSet ResultSet
std::string setByIDSql(Statement *stmt, int id)
oracle::occi::SQLException SQLException
std::string fetchIdSql(Statement *stmt)
auto const T2 &decltype(t1.eta()) t2
LMFLmrSubIOV & setTimes(const Tm &t1, const Tm &t2, const Tm &t3)
oracle::occi::Statement Statement
void setToString(const std::string s)
oracle::occi::Date tmToDate(const Tm &inTm) const
static const double tmax[3]
std::string writeDBSql(Statement *stmt)
LMFLmrSubIOV & setLMFIOV(const LMFIOV &iov)