CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SessionImpl.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_SessionImpl_h
2 #define CondCore_CondDB_SessionImpl_h
3 
4 #include "IOVSchema.h"
5 #include "GTSchema.h"
6 //
8 //
9 #include "RelationalAccess/ConnectionService.h"
10 #include "RelationalAccess/ISessionProxy.h"
11 //
12 #include <memory>
13 // temporarely
14 #include <boost/shared_ptr.hpp>
15 
16 namespace coral {
17  class ISessionProxy;
18  class ISchema;
19 }
20 
21 namespace cond {
22 
23  namespace persistency {
24 
25  class ITransaction {
26  public:
27  virtual ~ITransaction(){}
28  virtual void commit() = 0;
29  virtual void rollback() = 0;
30  virtual bool isActive() = 0;
31  bool iovDbExists = false;
32  bool iovDbOpen = false;
33  bool gtDbExists = false;
34  bool gtDbOpen = false;
35  bool isOra = false;
36  size_t clients = 0;
37  };
38 
39  class SessionImpl {
40  public:
42  public:
43  SessionImpl();
44  SessionImpl( boost::shared_ptr<coral::ISessionProxy>& session, const std::string& connectionString );
45  ~SessionImpl();
46 
47  void close();
48  bool isActive() const;
49  void startTransaction( bool readOnly=true );
50  void commitTransaction();
51  void rollbackTransaction();
52  bool isTransactionActive( bool deep=true ) const;
53 
54  void openIovDb( FailureOnOpeningPolicy policy = THROW );
55  void openGTDb();
58  // only for the bridging...
59  bool isOra();
60 
61  public:
62  // allows for session shared among more services. To be changed to unique_ptr when we stop needing this feature.
63  boost::shared_ptr<coral::ISessionProxy> coralSession;
64  // not really useful outside the ORA bridging...
66  std::unique_ptr<ITransaction> transaction;
67  std::unique_ptr<IIOVSchema> iovSchemaHandle;
68  std::unique_ptr<IGTSchema> gtSchemaHandle;
69  };
70 
71  }
72 
73 }
74 
75 #endif
76 
void openIovDb(FailureOnOpeningPolicy policy=THROW)
Definition: SessionImpl.cc:139
std::unique_ptr< IIOVSchema > iovSchemaHandle
Definition: SessionImpl.h:67
boost::shared_ptr< coral::ISessionProxy > coralSession
Definition: SessionImpl.h:63
std::unique_ptr< IGTSchema > gtSchemaHandle
Definition: SessionImpl.h:68
void startTransaction(bool readOnly=true)
Definition: SessionImpl.cc:87
bool isTransactionActive(bool deep=true) const
Definition: SessionImpl.cc:133
std::unique_ptr< ITransaction > transaction
Definition: SessionImpl.h:66