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 15 of file EcalDBConnection.h.

Constructor & Destructor Documentation

◆ EcalDBConnection() [1/2]

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() [2/2]

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::~EcalDBConnection ( )
virtualnoexcept

Destructor

Definition at line 50 of file EcalDBConnection.cc.

50  {
51  //Close database conection and terminate environment
52  try {
53  conn->terminateStatement(stmt);
54  env->terminateConnection(conn);
55  Environment::terminateEnvironment(env);
56  } catch (SQLException &e) {
57  throw(std::runtime_error("ERROR: Destructor Failed: " + e.getMessage()));
58  }
59 }

References SiStripCommissioningClient_cfg::conn, MillePedeFileConverter_cfg::e, and web.browse_db::env.

Member Function Documentation

◆ commit()

void EcalDBConnection::commit ( )
inline

Tranaction manaagement

Definition at line 55 of file EcalDBConnection.h.

55 { conn->commit(); }

References conn.

◆ createStatement()

oracle::occi::Statement* EcalDBConnection::createStatement ( )
inline

Get a new Statement

Definition at line 42 of file EcalDBConnection.h.

42  {
43  std::cout << "Creating statement" << std::endl;
44  return conn->createStatement();
45  }

References conn, and gather_cfg::cout.

◆ getClobLocator()

oracle::occi::Clob EcalDBConnection::getClobLocator ( )
inline

Get a new clob locator

Definition at line 61 of file EcalDBConnection.h.

61 { return oracle::occi::Clob(conn); }

References conn.

◆ getConn()

oracle::occi::Connection* EcalDBConnection::getConn ( ) const
inline

Definition at line 64 of file EcalDBConnection.h.

64 { return conn; };

References conn.

◆ getEnv()

oracle::occi::Environment* EcalDBConnection::getEnv ( ) const
inline

Definition at line 63 of file EcalDBConnection.h.

63 { return env; };

References env.

◆ rollback()

void EcalDBConnection::rollback ( )
inline

Definition at line 56 of file EcalDBConnection.h.

56 { conn->rollback(); }

References conn.

◆ terminateStatement()

void EcalDBConnection::terminateStatement ( oracle::occi::Statement *  stmt)
inline

Definition at line 47 of file EcalDBConnection.h.

47  {
48  std::cout << "Creating statement" << std::endl;
49  conn->terminateStatement(stmt);
50  }

References conn, gather_cfg::cout, and stmt.

Member Data Documentation

◆ conn

oracle::occi::Connection* EcalDBConnection::conn
protected

◆ env

oracle::occi::Environment* EcalDBConnection::env
protected

◆ host

std::string EcalDBConnection::host
protected

Definition at line 75 of file EcalDBConnection.h.

◆ pass

std::string EcalDBConnection::pass
protected

Definition at line 79 of file EcalDBConnection.h.

◆ port

int EcalDBConnection::port
protected

Definition at line 76 of file EcalDBConnection.h.

◆ sid

std::string EcalDBConnection::sid
protected

Definition at line 77 of file EcalDBConnection.h.

◆ stmt

oracle::occi::Statement* EcalDBConnection::stmt
protected

Definition at line 73 of file EcalDBConnection.h.

Referenced by terminateStatement().

◆ user

std::string EcalDBConnection::user
protected
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalDBConnection::stmt
oracle::occi::Statement * stmt
Definition: EcalDBConnection.h:73
EcalDBConnection::env
oracle::occi::Environment * env
Definition: EcalDBConnection.h:64
EcalDBConnection::conn
oracle::occi::Connection * conn
Definition: EcalDBConnection.h:72
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37