File indexing completed on 2024-04-06 12:22:52
0001 #ifndef ECALDBCONNECTION_HH
0002 #define ECALDBCONNECTION_HH
0003
0004 #include "OnlineDB/Oracle/interface/Oracle.h"
0005 #include <string>
0006 #include <stdexcept>
0007 #include <iostream>
0008
0009 #include "OnlineDB/EcalCondDB/interface/DateHandler.h"
0010
0011
0012
0013
0014
0015 class EcalDBConnection {
0016 public:
0017
0018
0019
0020
0021
0022
0023
0024
0025 EcalDBConnection(std::string host, std::string sid, std::string user, std::string pass, int port = 1521) noexcept(
0026 false);
0027
0028
0029
0030
0031
0032 EcalDBConnection(std::string sid, std::string user, std::string pass) noexcept(false);
0033
0034
0035
0036
0037 virtual ~EcalDBConnection() noexcept(false);
0038
0039
0040
0041
0042 inline oracle::occi::Statement* createStatement() {
0043 std::cout << "Creating statement" << std::endl;
0044 return conn->createStatement();
0045 }
0046
0047 inline void terminateStatement(oracle::occi::Statement* stmt) {
0048 std::cout << "Creating statement" << std::endl;
0049 conn->terminateStatement(stmt);
0050 }
0051
0052
0053
0054
0055 inline void commit() { conn->commit(); }
0056 inline void rollback() { conn->rollback(); }
0057
0058
0059
0060
0061 inline oracle::occi::Clob getClobLocator() { return oracle::occi::Clob(conn); }
0062
0063 oracle::occi::Environment* getEnv() const { return env; };
0064 oracle::occi::Connection* getConn() const { return conn; };
0065
0066 protected:
0067
0068
0069
0070
0071 oracle::occi::Environment* env;
0072 oracle::occi::Connection* conn;
0073 oracle::occi::Statement* stmt;
0074
0075 std::string host;
0076 int port;
0077 std::string sid;
0078 std::string user;
0079 std::string pass;
0080 };
0081
0082 #endif