00001 #ifndef ECALDBCONNECTION_HH 00002 #define ECALDBCONNECTION_HH 00003 00004 #include "OnlineDB/Oracle/interface/Oracle.h" 00005 #include <string> 00006 #include <stdexcept> 00007 00008 #include "OnlineDB/EcalCondDB/interface/DateHandler.h" 00009 00010 00015 class EcalDBConnection { 00016 public: 00017 00018 /******************\ 00019 - public methods - 00020 \******************/ 00021 00026 EcalDBConnection( std::string host, 00027 std::string sid, 00028 std::string user, 00029 std::string pass, 00030 int port = 1521 ) 00031 throw(std::runtime_error); 00032 00033 00034 00039 EcalDBConnection( std::string sid, 00040 std::string user, 00041 std::string pass ) 00042 throw(std::runtime_error); 00043 00044 00045 00049 virtual ~EcalDBConnection(); 00050 00054 inline oracle::occi::Statement* createStatement() 00055 { 00056 return conn->createStatement(); 00057 } 00058 00059 inline void terminateStatement(oracle::occi::Statement* stmt) 00060 { 00061 conn->terminateStatement(stmt); 00062 } 00063 00067 inline void commit() { conn->commit(); } 00068 inline void rollback() { conn->rollback(); } 00069 00073 inline oracle::occi::Clob getClobLocator() 00074 { 00075 return oracle::occi::Clob(conn); 00076 } 00077 00078 protected: 00079 00080 /***********************\ 00081 - protected variables - 00082 \***********************/ 00083 00084 oracle::occi::Environment* env; 00085 oracle::occi::Connection* conn; 00086 oracle::occi::Statement* stmt; 00087 00088 std::string host; 00089 int port; 00090 std::string sid; 00091 std::string user; 00092 std::string pass; 00093 00094 }; 00095 00096 #endif