CMS 3D CMS Logo

LMFIOV.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace oracle::occi;
5 
7  //standard
8  m_env = nullptr;
9  m_conn = nullptr;
10  m_className = "LMFIOV";
11  m_ID = 0;
12  // custom
13  m_iov_start = Tm();
14  m_iov_stop = Tm();
15  m_vmin = 0;
16  m_vmax = 0;
17 }
18 
20  //standard
21  setConnection(c->getEnv(), c->getConn());
22  m_className = "LMFIOV";
23  m_ID = 0;
24  // custom
25  m_iov_start = Tm();
26  m_iov_stop = Tm();
27  m_vmin = 0;
28  m_vmax = 0;
29 }
30 
32 
34  m_iov_start = start;
35  return *this;
36 }
37 
39  m_iov_stop = stop;
40  return *this;
41 }
42 
43 LMFIOV &LMFIOV::setIOV(const Tm &start, const Tm &stop) {
44  setStart(start);
45  return setStop(stop);
46 }
47 
48 LMFIOV &LMFIOV::setVmin(int vmin) {
49  m_vmin = vmin;
50  return *this;
51 }
52 
53 LMFIOV &LMFIOV::setVmax(int vmax) {
54  m_vmax = vmax;
55  return *this;
56 }
57 
58 LMFIOV &LMFIOV::setVersions(int vmin, int vmax) {
59  setVmin(vmin);
60  return setVmax(vmax);
61 }
62 
63 Tm LMFIOV::getStart() const { return m_iov_start; }
64 
65 Tm LMFIOV::getStop() const { return m_iov_stop; }
66 
67 int LMFIOV::getVmin() const { return m_vmin; }
68 
69 int LMFIOV::getVmax() const { return m_vmax; }
70 
72  std::string sql =
73  "SELECT IOV_ID FROM CMS_ECAL_LASER_COND.LMF_IOV "
74  "WHERE IOV_START = :1 AND IOV_STOP = :2 AND "
75  "VMIN = :3 AND VMIN = :4";
76  DateHandler dm(m_env, m_conn);
77  stmt->setSQL(sql);
78  stmt->setDate(1, dm.tmToDate(m_iov_start));
79  stmt->setDate(2, dm.tmToDate(m_iov_stop));
80  stmt->setInt(3, m_vmin);
81  stmt->setInt(4, m_vmax);
82  return sql;
83 }
84 
86  std::string sql =
87  "SELECT IOV_START, IOV_STOP, VMIN, VMAX FROM "
88  "CMS_ECAL_LASER_COND.LMF_IOV "
89  "WHERE IOV_ID = :1";
90  stmt->setSQL(sql);
91  stmt->setInt(1, id);
92  return sql;
93 }
94 
96  Date d = rset->getDate(1);
97  DateHandler dh(m_env, m_conn);
98  m_iov_start = dh.dateToTm(d);
99  d = rset->getDate(2);
100  m_iov_stop = dh.dateToTm(d);
101  m_vmin = rset->getInt(3);
102  m_vmax = rset->getInt(4);
103 }
104 
106  LMFIOV *t = new LMFIOV;
107  t->setConnection(m_env, m_conn);
108  return t;
109 }
110 
111 void LMFIOV::dump() const {
112  cout << "################# LMFIOV ######################" << endl;
113  cout << "id : " << m_ID << endl;
114  cout << "Start: " << m_iov_start.str() << endl;
115  cout << "Stop : " << m_iov_stop.str() << endl;
116  cout << "Vers.: " << m_vmin << " - " << m_vmax << endl;
117  cout << "################# LMFIOV ######################" << endl;
118 }
119 
121  // check that everything has been setup
122  std::string seqName = sequencePostfix(m_iov_start);
123  std::string sql =
124  "INSERT INTO LMF_IOV (IOV_ID, IOV_START, IOV_STOP, "
125  "VMIN, VMAX) VALUES "
126  "(lmf_iov_" +
127  seqName + "_sq.NextVal, :1, :2, :3, :4)";
128  stmt->setSQL(sql);
129  DateHandler dm(m_env, m_conn);
130  stmt->setDate(1, dm.tmToDate(m_iov_start));
131  stmt->setDate(2, dm.tmToDate(m_iov_stop));
132  stmt->setInt(3, m_vmin);
133  stmt->setInt(4, m_vmax);
134  if (m_debug) {
135  dump();
136  }
137  return sql;
138 }
Definition: start.py:1
LMFUnique * createObject() const override
Definition: LMFIOV.cc:105
int getVmin() const
Definition: LMFIOV.cc:67
std::string setByIDSql(Statement *stmt, int id) override
Definition: LMFIOV.cc:85
LMFIOV & setVmin(int vmin)
Definition: LMFIOV.cc:48
LMFIOV & setStop(const Tm &stop)
Definition: LMFIOV.cc:38
oracle::occi::ResultSet ResultSet
Definition: LMFUnique.h:23
LMFIOV & setVersions(int vmin, int vmax)
Definition: LMFIOV.cc:58
~LMFIOV() override
Definition: LMFIOV.cc:31
int getVmax() const
Definition: LMFIOV.cc:69
void dump() const override
Definition: LMFIOV.cc:111
void getParameters(ResultSet *rset) override
Definition: LMFIOV.cc:95
LMFIOV & setVmax(int vmax)
Definition: LMFIOV.cc:53
std::string writeDBSql(Statement *stmt) override
Definition: LMFIOV.cc:120
oracle::occi::Statement Statement
Definition: LMFUnique.h:24
std::string fetchIdSql(Statement *stmt) override
Definition: LMFIOV.cc:71
LMFIOV & setStart(const Tm &start)
Definition: LMFIOV.cc:33
Tm getStop() const
Definition: LMFIOV.cc:65
d
Definition: ztail.py:151
Tm getStart() const
Definition: LMFIOV.cc:63
Definition: LMFIOV.h:17
LMFIOV & setIOV(const Tm &start, const Tm &stop)
Definition: LMFIOV.cc:43
dh
Definition: cuy.py:354
LMFIOV()
Definition: LMFIOV.cc:6
Definition: Tm.h:13