File indexing completed on 2023-03-17 11:15:03
0001 #ifndef IDBOBJECT_H
0002 #define IDBOBJECT_H
0003
0004 #include <stdexcept>
0005 #include "OnlineDB/Oracle/interface/Oracle.h"
0006
0007
0008 #include <iostream>
0009
0010
0011
0012
0013 class IDBObject {
0014 public:
0015
0016 friend class EcalCondDBInterface;
0017
0018 static int const ECALDB_NROWS = 1024;
0019
0020 virtual ~IDBObject() {}
0021
0022
0023 inline void setConnection(oracle::occi::Environment* env, oracle::occi::Connection* conn) {
0024 m_env = env;
0025 m_conn = conn;
0026 }
0027
0028 inline oracle::occi::Environment* getEnv() const { return m_env; }
0029 inline oracle::occi::Connection* getConn() const { return m_conn; }
0030
0031 protected:
0032
0033 oracle::occi::Environment* m_env;
0034 oracle::occi::Connection* m_conn;
0035
0036 void checkConnection() const noexcept(false) {
0037 if (m_conn == nullptr) {
0038 throw std::runtime_error("ERROR: Connection was not set");
0039 }
0040 }
0041 };
0042
0043 #endif