CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/ORA/src/DatabaseUtility.cc

Go to the documentation of this file.
00001 #include "CondCore/ORA/interface/DatabaseUtility.h"
00002 #include "CondCore/ORA/interface/Transaction.h"
00003 #include "CondCore/ORA/interface/Exception.h"
00004 #include "CondCore/ORA/interface/Handle.h"
00005 #include "DatabaseUtilitySession.h"
00006 #include "DatabaseContainer.h"
00007 
00008 ora::DatabaseUtility::DatabaseUtility( Handle<DatabaseUtilitySession>& utilitySession ):
00009   m_session( utilitySession ){
00010 }
00011 
00012 ora::DatabaseUtility::DatabaseUtility( const DatabaseUtility& rhs ):
00013   m_session( rhs.m_session ){
00014 }
00015 
00016 ora::DatabaseUtility::~DatabaseUtility(){
00017 }
00018 
00019 ora::DatabaseUtility& ora::DatabaseUtility::operator=( const DatabaseUtility& rhs ){
00020   m_session = rhs.m_session;
00021   return *this;
00022 }
00023 
00024 std::set<std::string> ora::DatabaseUtility::listMappingVersions( const std::string& containerName ){
00025   Handle<DatabaseContainer> cont = m_session->containerHandle( containerName );
00026   if( !cont ){
00027     throwException("Container \""+containerName+"\" does not exist in the database.",
00028                    "DatabaseUtility::listMappingVersions");
00029   }
00030   return m_session->listMappingVersions( cont->id() );
00031 }
00032 
00033 std::map<std::string,std::string> ora::DatabaseUtility::listMappings( const std::string& containerName ){
00034   Handle<DatabaseContainer> cont = m_session->containerHandle( containerName );
00035   if( !cont ){
00036     throwException("Container \""+containerName+"\" does not exist in the database.",
00037                    "DatabaseUtility::listMappings");
00038   }
00039   return m_session->listMappings( cont->id() );  
00040 }
00041 
00042 bool ora::DatabaseUtility::dumpMapping( const std::string& mappingVersion,
00043                                         std::ostream& outputStream ){
00044   return m_session->dumpMapping( mappingVersion,outputStream );
00045 }
00046 
00047 void ora::DatabaseUtility::importContainerSchema( const std::string& sourceConnectionString,
00048                                                   const std::string& containerName ){
00049   m_session->importContainerSchema( sourceConnectionString, containerName );
00050 }
00051 
00052 void ora::DatabaseUtility::importContainer( const std::string& sourceConnectionString,
00053                                             const std::string& containerName ){
00054   m_session->importContainer( sourceConnectionString, containerName );
00055 }
00056 
00057 void ora::DatabaseUtility::eraseMapping( const std::string& mappingVersion ){
00058   m_session->eraseMapping( mappingVersion );
00059 }
00060