#include <LMFLmrSubIOV.h>
Public Member Functions | |
std::list< LMFLmrSubIOV > | fetchByLMFIOV (const LMFIOV &iov) |
std::list< int > | getIOVIDsLaterThan (const Tm &tmin, const Tm &tmax) throw (std::runtime_error) |
std::list< int > | getIOVIDsLaterThan (const Tm &t, int howMany) throw (std::runtime_error) |
std::list< int > | getIOVIDsLaterThan (const Tm &t, const Tm &tmax, int howMany) throw (std::runtime_error) |
std::list< int > | getIOVIDsLaterThan (const Tm &t) throw (std::runtime_error) |
LMFIOV | getLMFIOV () const |
int | getLMFIOVID () const |
Tm | getT1 () |
Tm | getT2 () |
Tm | getT3 () |
Tm | getTime (int i) |
void | getTimes (Tm *t) const |
std::vector< Tm > | getTimes () const |
void | getTimes (Tm *t1, Tm *t2, Tm *t3) const |
LMFLmrSubIOV () | |
LMFLmrSubIOV (EcalDBConnection *c) | |
LMFLmrSubIOV (oracle::occi::Environment *env, oracle::occi::Connection *conn) | |
bool | operator!= (const LMFLmrSubIOV &m) const |
bool | operator== (const LMFLmrSubIOV &m) const |
LMFLmrSubIOV & | setLMFIOV (const LMFIOV &iov) |
LMFLmrSubIOV & | setLMFIOV (int i) |
LMFLmrSubIOV & | setTimes (std::vector< Tm > t) |
LMFLmrSubIOV & | setTimes (Tm *t) |
LMFLmrSubIOV & | setTimes (Tm t1, Tm t2, Tm t3) |
~LMFLmrSubIOV () | |
Private Member Functions | |
std::string | fetchIdSql (Statement *stmt) |
void | getParameters (ResultSet *rset) |
void | init () |
std::string | setByIDSql (Statement *stmt, int id) |
std::string | writeDBSql (Statement *stmt) |
Private Attributes | |
int | m_lmfIOV |
Tm | m_t [3] |
Friends | |
class | EcalCondDBInterface |
Definition at line 13 of file LMFLmrSubIOV.h.
LMFLmrSubIOV::LMFLmrSubIOV | ( | ) |
LMFLmrSubIOV::LMFLmrSubIOV | ( | EcalDBConnection * | c | ) |
LMFLmrSubIOV::LMFLmrSubIOV | ( | oracle::occi::Environment * | env, |
oracle::occi::Connection * | conn | ||
) |
LMFLmrSubIOV::~LMFLmrSubIOV | ( | ) |
Definition at line 26 of file LMFLmrSubIOV.cc.
{ }
std::list<LMFLmrSubIOV> LMFLmrSubIOV::fetchByLMFIOV | ( | const LMFIOV & | iov | ) |
std::string LMFLmrSubIOV::fetchIdSql | ( | Statement * | stmt | ) | [private, virtual] |
Reimplemented from LMFUnique.
Definition at line 52 of file LMFLmrSubIOV.cc.
References gather_cfg::cout, cuy::dh, i, LMFUnique::m_className, IDBObject::m_conn, LMFUnique::m_debug, IDBObject::m_env, m_lmfIOV, m_t, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, and DateHandler::tmToDate().
{ if (!m_lmfIOV) { if (m_debug) { std::cout << m_className << ": LMFIOV not set" << std::endl; } return ""; } std::string sql = "SELECT LMR_SUB_IOV_ID FROM " "CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV " "WHERE " "IOV_ID = :1 AND " "T1 = :2 AND " "T2 = :3 AND " "T3 = :4"; stmt->setSQL(sql); stmt->setInt(1, m_lmfIOV); DateHandler dh(m_env, m_conn); for (int i = 0; i < 3; i++) { oracle::occi::Date t = dh.tmToDate(m_t[i]); stmt->setDate(i + 2, t); } return sql; }
std::list< int > LMFLmrSubIOV::getIOVIDsLaterThan | ( | const Tm & | t, |
int | howMany | ||
) | throw (std::runtime_error) |
Definition at line 127 of file LMFLmrSubIOV.cc.
References Tm::setToString(), and lumiQTWidget::t.
{ Tm tinf; tinf.setToString("9999-12-31 23:59:59"); return getIOVIDsLaterThan(t, tinf, howmany); }
std::list< int > LMFLmrSubIOV::getIOVIDsLaterThan | ( | const Tm & | t, |
const Tm & | tmax, | ||
int | howMany | ||
) | throw (std::runtime_error) |
Definition at line 140 of file LMFLmrSubIOV.cc.
References gather_cfg::cout, cuy::dh, alignCSCRings::e, NULL, run_regression::ret, Tm::setToString(), AlCaHLTBitMon_QueryRunRegistry::string, tmax, and DateHandler::tmToDate().
{ Tm tinf; tinf.setToString("9999-12-31 23:59:59"); std::string sql = "SELECT * FROM (SELECT LMR_SUB_IOV_ID " "FROM CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV WHERE T3 > :1 "; if (tmax != tinf) { sql += "AND T3 < :2 ORDER BY T3 ASC) "; if (howMany > 0) { sql += "WHERE ROWNUM <= :3"; } } else { sql += "ORDER BY T3 ASC) "; if (howMany > 0) { sql += "WHERE ROWNUM <= :2"; } } if (m_debug) { std::cout << "Executing query: " << std::endl << sql << std::endl; } std::list<int> ret; if (m_conn != NULL) { try { DateHandler dh(m_env, m_conn); Statement *stmt = m_conn->createStatement(); stmt->setPrefetchRowCount(10000); stmt->setSQL(sql); stmt->setDate(1, dh.tmToDate(tmin)); if (tmax != tinf) { stmt->setDate(2, dh.tmToDate(tmax)); if (howMany > 0) { stmt->setInt(3, howMany); } } else { if (howMany > 0) { stmt->setInt(2, howMany); } } ResultSet *rset = stmt->executeQuery(); int row = 1; while (rset->next() != 0) { if (m_debug) { std::cout << "Getting row " << row++ << std::endl; } ret.push_back(rset->getInt(1)); } stmt->setPrefetchRowCount(0); m_conn->terminateStatement(stmt); } catch (oracle::occi::SQLException e) { throw(std::runtime_error(m_className + "::getLmrSubIOVLaterThan: " + e.getMessage())); } } else { throw(std::runtime_error(m_className + "::getLmrSubIOVLaterThan: " + "Connection not set")); } if (m_debug) { std::cout << "Sorting..." << std::flush; } ret.sort(); if (m_debug) { std::cout << "Done!" << std::endl << std::flush; } return ret; }
std::list< int > LMFLmrSubIOV::getIOVIDsLaterThan | ( | const Tm & | t | ) | throw (std::runtime_error) |
Definition at line 120 of file LMFLmrSubIOV.cc.
References Tm::setToString(), and lumiQTWidget::t.
Referenced by LMFCorrCoefDat::fetchBetween().
{ Tm tinf; tinf.setToString("9999-12-31 23:59:59"); return getIOVIDsLaterThan(t, tinf, 0); }
std::list< int > LMFLmrSubIOV::getIOVIDsLaterThan | ( | const Tm & | tmin, |
const Tm & | tmax | ||
) | throw (std::runtime_error) |
Definition at line 134 of file LMFLmrSubIOV.cc.
References tmax.
{ return getIOVIDsLaterThan(tmin, tmax, 0); }
LMFIOV LMFLmrSubIOV::getLMFIOV | ( | ) | const [inline] |
Definition at line 32 of file LMFLmrSubIOV.h.
References o2o::iov, IDBObject::m_conn, IDBObject::m_env, m_lmfIOV, and LMFUnique::setByID().
int LMFLmrSubIOV::getLMFIOVID | ( | ) | const [inline] |
void LMFLmrSubIOV::getParameters | ( | ResultSet * | rset | ) | [private, virtual] |
Reimplemented from LMFUnique.
Definition at line 112 of file LMFLmrSubIOV.cc.
References i, m_lmfIOV, m_t, Tm::setToString(), and lumiQTWidget::t.
Tm LMFLmrSubIOV::getT1 | ( | ) | [inline] |
Tm LMFLmrSubIOV::getT2 | ( | ) | [inline] |
Tm LMFLmrSubIOV::getT3 | ( | ) | [inline] |
Tm LMFLmrSubIOV::getTime | ( | int | i | ) | [inline] |
std::vector<Tm> LMFLmrSubIOV::getTimes | ( | ) | const [inline] |
Definition at line 42 of file LMFLmrSubIOV.h.
References m_t, and findQualityFiles::v.
Definition at line 37 of file LMFLmrSubIOV.h.
References m_t.
Referenced by LMFCorrCoefDat::getTimes().
void LMFLmrSubIOV::getTimes | ( | Tm * | t | ) | const [inline] |
void LMFLmrSubIOV::init | ( | void | ) | [private] |
Definition at line 3 of file LMFLmrSubIOV.cc.
References LMFUnique::m_className, m_lmfIOV, and m_t.
Referenced by LMFLmrSubIOV().
bool LMFLmrSubIOV::operator!= | ( | const LMFLmrSubIOV & | m | ) | const [inline] |
bool LMFLmrSubIOV::operator== | ( | const LMFLmrSubIOV & | m | ) | const [inline] |
std::string LMFLmrSubIOV::setByIDSql | ( | Statement * | stmt, |
int | id | ||
) | [private, virtual] |
Reimplemented from LMFUnique.
Definition at line 78 of file LMFLmrSubIOV.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
{ std::string sql = "SELECT IOV_ID, T1, T2, T3 FROM " "CMS_ECAL_LASER_COND.LMF_LMR_SUB_IOV " "WHERE LMR_SUB_IOV_ID = :1"; stmt->setSQL(sql); stmt->setInt(1, id); return sql; }
LMFLmrSubIOV & LMFLmrSubIOV::setLMFIOV | ( | const LMFIOV & | iov | ) |
Definition at line 29 of file LMFLmrSubIOV.cc.
References gather_cfg::cout, LMFUnique::getID(), LMFUnique::m_debug, and m_lmfIOV.
LMFLmrSubIOV& LMFLmrSubIOV::setLMFIOV | ( | int | i | ) |
LMFLmrSubIOV & LMFLmrSubIOV::setTimes | ( | Tm | t1, |
Tm | t2, | ||
Tm | t3 | ||
) |
LMFLmrSubIOV & LMFLmrSubIOV::setTimes | ( | Tm * | t | ) |
LMFLmrSubIOV& LMFLmrSubIOV::setTimes | ( | std::vector< Tm > | t | ) |
std::string LMFLmrSubIOV::writeDBSql | ( | Statement * | stmt | ) | [private, virtual] |
Reimplemented from LMFUnique.
Definition at line 87 of file LMFLmrSubIOV.cc.
References cuy::dh, DateHandler::getPlusInfTm(), i, LMFUnique::m_className, IDBObject::m_conn, IDBObject::m_env, m_lmfIOV, m_t, LMFUnique::sequencePostfix(), AlCaHLTBitMon_QueryRunRegistry::string, and DateHandler::tmToDate().
{ // Validate the data, use infinity-till convention DateHandler dh(m_env, m_conn); for (int i = 0; i < 3; i++) { if (m_t[i].isNull()) { m_t[i] = dh.getPlusInfTm(); } } if (m_lmfIOV == 0) { throw(std::runtime_error(m_className + "::writeDB: LMFIOV not set")); } std::string sp = sequencePostfix(m_t[0]); std::string sql = "INSERT INTO LMF_LMR_SUB_IOV (LMR_SUB_IOV_ID, " "IOV_ID, T1, T2, T3) " "VALUES (LMF_LMR_SUB_IOV_ID_" + sp + "_SQ.NextVal, :1, :2, :3, :4)"; stmt->setSQL(sql); stmt->setInt(1, m_lmfIOV); for (int i = 0; i < 3; i++) { stmt->setDate(i + 2, dh.tmToDate(m_t[i])); } return sql; }
friend class EcalCondDBInterface [friend] |
Reimplemented from LMFUnique.
Definition at line 15 of file LMFLmrSubIOV.h.
int LMFLmrSubIOV::m_lmfIOV [private] |
Definition at line 95 of file LMFLmrSubIOV.h.
Referenced by fetchIdSql(), getLMFIOV(), getLMFIOVID(), getParameters(), init(), operator==(), setLMFIOV(), and writeDBSql().
Tm LMFLmrSubIOV::m_t[3] [private] |
Definition at line 96 of file LMFLmrSubIOV.h.
Referenced by fetchIdSql(), getParameters(), getT1(), getT2(), getT3(), getTime(), getTimes(), init(), operator==(), setTimes(), and writeDBSql().