48 throwException(
"Container \""+name+
"\" does not exist in the database.",
49 "Database::getContainerFromSession");
82 if(
this != &rhs ) m_impl = rhs.
m_impl;
87 return m_impl->m_session->configuration();
92 return m_impl->m_session->connect( connectionString, readOnly );
98 return m_impl->m_session->connect( connectionString, asRole, readOnly );
102 return m_impl->m_session->connect( coralSession, connectionString, schemaName );
106 m_impl->m_session->disconnect();
110 return m_impl->m_session->isConnected();
114 return m_impl->m_session->connectionString();
118 if(!m_impl->m_session->isConnected()) {
119 throwException(
"No database storage connected.",
"Database::transaction");
121 return *m_impl->m_transaction;
125 if(!m_impl->m_session->isConnected()) {
126 throwException(
"No database storage connected.",
"Database::checkTransaction");
128 if(!m_impl->m_transaction->isActive()) {
129 throwException(
"Transaction is not active.",
"Database::checkTransaction");
135 return m_impl->m_session->exists();
139 bool created =
false;
141 m_impl->m_session->create( userSchemaVersion );
148 bool dropped =
false;
151 const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
153 iC != conts.end(); iC++ ){
156 m_impl->m_session->drop();
165 m_impl->m_session->setAccessPermission( principal, forWrite );
166 const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
168 iC != conts.end(); iC++ ){
169 iC->second->setAccessPermission( principal, forWrite );
176 if( !m_impl->m_session->exists() ){
178 m_impl->m_session->create();
180 throwException(
"Database does not exists in \""+m_impl->m_session->connectionString()+
"\"",
"Database::open");
183 m_impl->m_session->open();
188 if( !m_impl->m_session->exists() ){
189 throwException(
"Database does not exists in \""+m_impl->m_session->connectionString()+
"\"",
"Database::schemaVersion");
196 std::set< std::string > contList;
197 const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
199 iC != conts.end(); iC++ ){
200 contList.insert( iC->second->name() );
206 const std::type_info& typeInfo ){
208 if( m_impl->m_session->containerHandle( name ) ){
209 throwException(
"Container with name \""+name+
"\" already exists in the database.",
210 "Database::createContainer");
221 if( m_impl->m_session->containerHandle( name ) ){
222 throwException(
"Container with name \""+name+
"\" already exists in the database.",
223 "Database::createContainer");
233 if( name.empty() ) name = nameForContainer( className );
234 if( m_impl->m_session->containerHandle( name ) ){
235 throwException(
"Container with name \""+name+
"\" already exists in the database.",
236 "Database::createContainer");
243 const std::type_info& typeInfo){
258 if( !m_impl->m_session->containerHandle( name ) ){
261 m_impl->m_session->dropContainer( name );
269 throwException(
"Container \""+name+
"\" does not exist in the database.",
270 "Database::lockContainer");
279 throwException(
"Container \""+name+
"\" does not exist in the database.",
280 "Database::containerHandle");
289 std::stringstream messg;
290 messg <<
"Container with id=" << contId <<
" not found in the database.";
292 "Database::containerHandle");
303 const Object& dataObject ){
307 return OId( cont.
id(), itemId );
311 const Object& dataObject ){
325 const std::map<int,Handle<DatabaseContainer> >& containers = m_impl->m_session->containers();
327 iCont != containers.end(); ++iCont ){
328 iCont->second->flush();
339 return m_impl->m_session->eraseObjectName( name );
344 return m_impl->m_session->eraseAllNames();
349 return m_impl->m_session->getItemId( name, destination );
355 return m_impl->m_session->fetchTypedObjectByName( name, objType );
360 return m_impl->m_session->fetchObjectByName( name );
366 if( !m_impl->m_session->exists() ){
367 throwException(
"Database does not exists in \""+m_impl->m_session->connectionString()+
"\"",
"Database::getNamesForObject");
374 if( !m_impl->m_session->exists() ){
375 throwException(
"Database does not exists in \""+m_impl->m_session->connectionString()+
"\"",
"Database::listObjectNames");
377 return m_impl->m_session->listObjectNames( destination );
387 return m_impl->m_session->storageAccessSession();
Handle< DatabaseContainer > containerHandle(const std::string &name)
bool create(std::string userSchemaVersion=std::string(""))
std::auto_ptr< DatabaseSession > m_session
bool getFlag(const std::string &flagName) const
void updateItem(int itemId, const Object &data)
Object fetchItemByName(const std::string &name)
tuple cont
load Luminosity info ##
static Version fromString(const std::string &versionString)
const edm::TypeWithDict & type() const
Properties & properties()
const std::string & connectionString()
int insertItem(const Object &data)
bool getItemId(const std::string &name, OId &destination)
std::auto_ptr< Transaction > m_transaction
ora::Version schemaVersion(bool userSchema=false)
static std::string automaticContainerCreation()
void open(bool writingAccess=false)
Object fetchItem(int itemId)
Container getContainerFromSession(const std::string &name, const edm::TypeWithDict &contType, DatabaseSession &session)
static std::string automaticDatabaseCreation()
bool lockContainer(const std::string &name)
Transaction & transaction()
SharedSession & storageAccessSession()
void erase(const OId &oid)
Object fetchItem(const OId &oid)
std::string cppName() const
std::string nameFromClass(const edm::TypeWithDict &contType)
Container containerHandle(const std::string &name)
std::set< std::string > containers()
bool dropContainer(const std::string &name)
DatabaseImpl(boost::shared_ptr< ConnectionPool > &connectionPool)
Container createContainer()
boost::shared_ptr< DatabaseImpl > m_impl
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
DatabaseUtility utility()
bool getNamesForObject(const OId &oid, std::vector< std::string > &destination)
OId insertItem(const std::string &containerName, const Object &data)
Database & operator=(const Database &rhs)
bool connect(const std::string &connectionString, bool readOnly=false)
Handle< DatabaseContainer > createContainer(const std::string &containerName, const edm::TypeWithDict &type)
bool eraseObjectName(const std::string &name)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Configuration & configuration()
static std::string nameForContainer(const std::type_info &typeInfo)
bool listObjectNames(std::vector< std::string > &destination)
boost::shared_ptr< void > getTypedObjectByName(const std::string &name, const std::type_info &typeInfo)
Configuration & configuration()
void updateItem(const OId &oid, const Object &data)
void setObjectName(const std::string &name, const OId &oid)
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
std::string className(const T &t)
Container getContainer(const std::string &name, const std::type_info &typeInfo)
void setAccessPermission(const std::string &principal, bool forWrite)