CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
EcalDBConnection Class Reference

#include <EcalDBConnection.h>

Inheritance diagram for EcalDBConnection:
EcalCondDBInterface EcalTPGDBApp

Public Member Functions

void commit ()
 
oracle::occi::Statement * createStatement ()
 
 EcalDBConnection (std::string host, std::string sid, std::string user, std::string pass, int port=1521) noexcept(false)
 
 EcalDBConnection (std::string sid, std::string user, std::string pass) noexcept(false)
 
oracle::occi::Clob getClobLocator ()
 
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void rollback ()
 
void terminateStatement (oracle::occi::Statement *stmt)
 
virtual ~EcalDBConnection () noexcept(false)
 

Protected Attributes

oracle::occi::Connection * conn
 
oracle::occi::Environment * env
 
std::string host
 
std::string pass
 
int port
 
std::string sid
 
oracle::occi::Statement * stmt
 
std::string user
 

Detailed Description

A wrapper class for the oracle Connection and Environment classes along with any OCCI-dependent methods that are useful for any database

Definition at line 16 of file EcalDBConnection.h.

Constructor & Destructor Documentation

EcalDBConnection::EcalDBConnection ( std::string  host,
std::string  sid,
std::string  user,
std::string  pass,
int  port = 1521 
)
noexcept

Constructor Makes a connection to an oracle database without TNS_ADMIN

EcalDBConnection::EcalDBConnection ( std::string  sid,
std::string  user,
std::string  pass 
)
noexcept

Constructor Makes a connection to an oracle database using TNS_ADMIN

EcalDBConnection::~EcalDBConnection ( )
virtualnoexcept

Destructor

Definition at line 61 of file EcalDBConnection.cc.

References web.browse_db::env, and AlCaHLTBitMon_QueryRunRegistry::string.

61  {
62  //Close database conection and terminate environment
63  try {
64  conn->terminateStatement(stmt);
65  env->terminateConnection(conn);
66  Environment::terminateEnvironment(env);
67  } catch (SQLException &e) {
68  throw(std::runtime_error(std::string("ERROR: Destructor Failed: ") + getOraMessage(&e)));
69  }
70 }
oracle::occi::Environment * env
oracle::occi::Connection * conn
oracle::occi::Statement * stmt

Member Function Documentation

void EcalDBConnection::commit ( )
inline

Tranaction manaagement

Definition at line 70 of file EcalDBConnection.h.

References conn.

70 { conn->commit(); }
oracle::occi::Connection * conn
oracle::occi::Statement* EcalDBConnection::createStatement ( )
inline

Get a new Statement

Definition at line 55 of file EcalDBConnection.h.

References conn, and gather_cfg::cout.

56  {
57  std::cout << "Creating statement" << std::endl;
58  return conn->createStatement();
59  }
oracle::occi::Connection * conn
oracle::occi::Clob EcalDBConnection::getClobLocator ( )
inline

Get a new clob locator

Definition at line 76 of file EcalDBConnection.h.

References conn.

77  {
78  return oracle::occi::Clob(conn);
79  }
oracle::occi::Connection * conn
oracle::occi::Connection* EcalDBConnection::getConn ( ) const
inline

Definition at line 82 of file EcalDBConnection.h.

References conn, and env.

Referenced by LMFCorrCoefDat::LMFCorrCoefDat(), LMFDefFabric::LMFDefFabric(), LMFIOV::LMFIOV(), and LMFUnique::LMFUnique().

82 { return conn; };
oracle::occi::Connection * conn
oracle::occi::Environment* EcalDBConnection::getEnv ( ) const
inline

Definition at line 81 of file EcalDBConnection.h.

References env.

Referenced by LMFCorrCoefDat::LMFCorrCoefDat(), LMFDefFabric::LMFDefFabric(), LMFIOV::LMFIOV(), and LMFUnique::LMFUnique().

81 { return env; };
oracle::occi::Environment * env
void EcalDBConnection::rollback ( )
inline

Definition at line 71 of file EcalDBConnection.h.

References conn.

71 { conn->rollback(); }
oracle::occi::Connection * conn
void EcalDBConnection::terminateStatement ( oracle::occi::Statement *  stmt)
inline

Definition at line 61 of file EcalDBConnection.h.

References conn, and gather_cfg::cout.

62  {
63  std::cout << "Creating statement" << std::endl;
64  conn->terminateStatement(stmt);
65  }
oracle::occi::Connection * conn
oracle::occi::Statement * stmt

Member Data Documentation

oracle::occi::Connection* EcalDBConnection::conn
protected
oracle::occi::Environment* EcalDBConnection::env
protected
std::string EcalDBConnection::host
protected

Definition at line 94 of file EcalDBConnection.h.

std::string EcalDBConnection::pass
protected

Definition at line 98 of file EcalDBConnection.h.

int EcalDBConnection::port
protected
std::string EcalDBConnection::sid
protected

Definition at line 96 of file EcalDBConnection.h.

oracle::occi::Statement* EcalDBConnection::stmt
protected
std::string EcalDBConnection::user
protected