Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:52

0001 #ifndef DATEHANDLER_H
0002 #define DATEHANDLER_H
0003 
0004 #include "OnlineDB/Oracle/interface/Oracle.h"
0005 #include "OnlineDB/EcalCondDB/interface/Tm.h"
0006 
0007 class DateHandler {
0008 public:
0009   DateHandler(oracle::occi::Environment* env, oracle::occi::Connection* conn);
0010   ~DateHandler();
0011 
0012   inline Tm getNegInfTm() const { return NEG_INF; }
0013   inline Tm getPlusInfTm() const { return PLUS_INF; }
0014   inline oracle::occi::Date getNegInfDate() const { return NEG_INF_DATE; }
0015   inline oracle::occi::Date getPlusInfDate() const { return PLUS_INF_DATE; }
0016 
0017   /**
0018    *  Get the current system date
0019    */
0020   inline oracle::occi::Date getCurrentDate() { return oracle::occi::Date(oracle::occi::Date::getSystemDate(m_env)); }
0021 
0022   /**
0023    *  The minimum oracle Date
0024    */
0025   inline oracle::occi::Date minDate() { return oracle::occi::Date(m_env, 1970, 1, 1, 0, 0, 0); }
0026 
0027   /**
0028    *  The maximum oracle Date
0029    */
0030   inline oracle::occi::Date maxDate() { return oracle::occi::Date(m_env, 9999, 12, 31, 23, 59, 59); }
0031 
0032   /**
0033    *  Translate a Tm object to a oracle Date object
0034    */
0035   oracle::occi::Date tmToDate(const Tm& inTm) const;
0036 
0037   /**
0038    *  Translate an oracle Date object to a Tm object
0039    */
0040   Tm dateToTm(oracle::occi::Date& date) const;
0041 
0042   DateHandler() = delete;  // hide the default constructor
0043 
0044 private:
0045   oracle::occi::Connection* m_conn;
0046   oracle::occi::Environment* m_env;
0047 
0048   Tm PLUS_INF;
0049   Tm NEG_INF;
0050   oracle::occi::Date PLUS_INF_DATE;
0051   oracle::occi::Date NEG_INF_DATE;
0052 };
0053 
0054 #endif