CMS 3D CMS Logo

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