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 #include <boost/shared_ptr.hpp>
14 
15 namespace coral {
16  class ISessionProxy;
17  class ISchema;
18 }
19 
20 namespace cond {
21 
22  namespace persistency {
23 
24  class ITransaction {
25  public:
26  virtual ~ITransaction(){}
27  virtual void commit() = 0;
28  virtual void rollback() = 0;
29  virtual bool isActive() = 0;
30  bool iovDbExists = false;
31  bool iovDbOpen = false;
32  bool gtDbExists = false;
33  bool gtDbOpen = false;
34  bool isOra = false;
35  size_t clients = 0;
36  };
37 
38  class SessionImpl {
39  public:
41  public:
42  SessionImpl();
43  SessionImpl( boost::shared_ptr<coral::ISessionProxy>& session,
45 
46  ~SessionImpl();
47 
48  void close();
49  bool isActive() const;
50  void startTransaction( bool readOnly=true );
51  void commitTransaction();
52  void rollbackTransaction();
53  bool isTransactionActive( bool deep=true ) const;
54 
55  void openIovDb( FailureOnOpeningPolicy policy = THROW );
56  void openGTDb( FailureOnOpeningPolicy policy = THROW );
57  void openDb();
60  // only for the bridging...
61  bool isOra();
62 
63  public:
64  // allows for session shared among more services. To be changed to unique_ptr when we stop needing this feature.
65  boost::shared_ptr<coral::ISessionProxy> coralSession;
66  // not really useful outside the ORA bridging...
68  std::unique_ptr<ITransaction> transaction;
69  std::unique_ptr<IIOVSchema> iovSchemaHandle;
70  std::unique_ptr<IGTSchema> gtSchemaHandle;
71  };
72 
73  }
74 
75 }
76 
77 #endif
78 
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:69
boost::shared_ptr< coral::ISessionProxy > coralSession
Definition: SessionImpl.h:65
std::unique_ptr< IGTSchema > gtSchemaHandle
Definition: SessionImpl.h:70
void startTransaction(bool readOnly=true)
Definition: SessionImpl.cc:63
bool isTransactionActive(bool deep=true) const
Definition: SessionImpl.cc:97
session
Definition: models.py:201
std::unique_ptr< ITransaction > transaction
Definition: SessionImpl.h:68