test
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 
5 #include "IOVSchema.h"
6 #include "GTSchema.h"
7 //
8 #include "RelationalAccess/ConnectionService.h"
9 #include "RelationalAccess/ISessionProxy.h"
10 //
11 #include <memory>
12 // temporarely
13 
14 namespace coral {
15  class ISessionProxy;
16  class ISchema;
17 }
18 
19 namespace cond {
20 
21  namespace persistency {
22 
23  class ITransaction {
24  public:
25  virtual ~ITransaction(){}
26  virtual void commit() = 0;
27  virtual void rollback() = 0;
28  virtual bool isActive() = 0;
29  bool iovDbExists = false;
30  bool iovDbOpen = false;
31  bool gtDbExists = false;
32  bool gtDbOpen = false;
33  bool isOra = false;
34  size_t clients = 0;
35  };
36 
37  class SessionImpl {
38  public:
40  public:
41  SessionImpl();
42  SessionImpl( std::shared_ptr<coral::ISessionProxy>& session,
44 
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( FailureOnOpeningPolicy policy = THROW );
56  void openDb();
59  // only for the bridging...
60  bool isOra();
61 
62  public:
63  // allows for session shared among more services. To be changed to unique_ptr when we stop needing this feature.
64  std::shared_ptr<coral::ISessionProxy> coralSession;
65  // not really useful outside the ORA bridging...
67  std::unique_ptr<ITransaction> transaction;
68  std::unique_ptr<IIOVSchema> iovSchemaHandle;
69  std::unique_ptr<IGTSchema> gtSchemaHandle;
70  };
71 
72  }
73 
74 }
75 
76 #endif
77 
std::shared_ptr< coral::ISessionProxy > coralSession
Definition: SessionImpl.h:64
tuple session
Definition: dataDML.py:2333
void openGTDb(FailureOnOpeningPolicy policy=THROW)
Definition: SessionImpl.cc:119
void openIovDb(FailureOnOpeningPolicy policy=THROW)
Definition: SessionImpl.cc:103
std::unique_ptr< IIOVSchema > iovSchemaHandle
Definition: SessionImpl.h:68
std::unique_ptr< IGTSchema > gtSchemaHandle
Definition: SessionImpl.h:69
void startTransaction(bool readOnly=true)
Definition: SessionImpl.cc:63
bool isTransactionActive(bool deep=true) const
Definition: SessionImpl.cc:97
std::unique_ptr< ITransaction > transaction
Definition: SessionImpl.h:67