CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/OnlineDB/EcalCondDB/interface/EcalDBConnection.h

Go to the documentation of this file.
00001 #ifndef ECALDBCONNECTION_HH
00002 #define ECALDBCONNECTION_HH
00003 
00004 #include "OnlineDB/Oracle/interface/Oracle.h"
00005 #include <string>
00006 #include <stdexcept>
00007 #include <iostream>
00008 
00009 #include "OnlineDB/EcalCondDB/interface/DateHandler.h"
00010 
00011 
00016 class EcalDBConnection {
00017  public:
00018 
00019   /******************\
00020   -  public methods  -
00021   \******************/
00022 
00027   EcalDBConnection( std::string host,
00028                     std::string sid,
00029                     std::string user,
00030                     std::string pass,
00031                     int port = 1521 )
00032     throw(std::runtime_error);
00033 
00034 
00035 
00040   EcalDBConnection( std::string sid,
00041                     std::string user,
00042                     std::string pass )
00043     throw(std::runtime_error);
00044   
00045 
00046 
00050   virtual ~EcalDBConnection() throw(std::runtime_error);
00051 
00055   inline oracle::occi::Statement* createStatement()
00056     {
00057       std::cout << "Creating statement" << std::endl;
00058       return conn->createStatement();
00059     }
00060 
00061   inline void terminateStatement(oracle::occi::Statement* stmt)
00062     {
00063       std::cout << "Creating statement" << std::endl;
00064       conn->terminateStatement(stmt);
00065     }
00066 
00070   inline void commit() { conn->commit(); }
00071   inline void rollback() { conn->rollback(); }
00072 
00076   inline oracle::occi::Clob getClobLocator()
00077     {
00078       return oracle::occi::Clob(conn);
00079     }
00080 
00081   oracle::occi::Environment* getEnv() const { return env; };
00082   oracle::occi::Connection* getConn() const { return conn; };
00083 
00084  protected:
00085   
00086   /***********************\
00087   -  protected variables  -
00088   \***********************/
00089 
00090   oracle::occi::Environment* env;
00091   oracle::occi::Connection* conn;
00092   oracle::occi::Statement* stmt;
00093 
00094   std::string host;
00095   int port;
00096   std::string sid;
00097   std::string user;
00098   std::string pass;
00099 
00100 };
00101 
00102 #endif