CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/OnlineDB/EcalCondDB/interface/IDataItem.h

Go to the documentation of this file.
00001 #ifndef IDATAITEM_H
00002 #define IDATAITEM_H
00003 
00004 #include "OnlineDB/EcalCondDB/interface/IDBObject.h"
00005 #include "OnlineDB/EcalCondDB/interface/ITag.h"
00006 #include "OnlineDB/EcalCondDB/interface/IIOV.h"
00007 #include "OnlineDB/EcalCondDB/interface/EcalLogicID.h"
00008 
00009 #include <stdexcept>
00010 #include <map>
00011 #include "OnlineDB/Oracle/interface/Oracle.h"
00012 
00016 class IDataItem : public IDBObject {
00017 
00018  public:
00019 
00020   virtual std::string getTable() =0;
00021   
00022 
00023  protected:
00024   oracle::occi::Statement* m_writeStmt;
00025   oracle::occi::Statement* m_readStmt;
00026 
00027   inline void checkPrepare() 
00028     throw(std::runtime_error) 
00029     {
00030       if (m_writeStmt == NULL) {
00031         throw(std::runtime_error("Write statement not prepared"));
00032       }
00033     }
00034 
00035   inline void terminateWriteStatement()
00036     throw(std::runtime_error)
00037   {
00038     if (m_writeStmt != NULL) {
00039       m_conn->terminateStatement(m_writeStmt);
00040     } else {
00041       std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
00042     }
00043   }
00044 
00045 
00046   inline void createReadStatement()
00047     throw(std::runtime_error)
00048   {
00049       m_readStmt=m_conn->createStatement();
00050   }
00051 
00052   inline void setPrefetchRowCount(int ncount)
00053     throw(std::runtime_error)
00054   {
00055     m_readStmt->setPrefetchRowCount(ncount);
00056   }
00057 
00058   inline void terminateReadStatement()
00059     throw(std::runtime_error)
00060   {
00061     if (m_readStmt != NULL) {
00062       m_conn->terminateStatement(m_readStmt);
00063     } else {
00064       std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
00065     }
00066   }
00067 
00068 
00069 
00070   // Prepare a statement for writing operations
00071   virtual void prepareWrite() 
00072     throw(std::runtime_error) =0;
00073 
00074 
00075 };
00076 
00077 #endif