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(): 00009 m_session(){ 00010 } 00011 00012 ora::DatabaseUtility::DatabaseUtility( Handle<DatabaseUtilitySession>& utilitySession ): 00013 m_session( utilitySession ){ 00014 } 00015 00016 ora::DatabaseUtility::DatabaseUtility( const DatabaseUtility& rhs ): 00017 m_session( rhs.m_session ){ 00018 } 00019 00020 ora::DatabaseUtility::~DatabaseUtility(){ 00021 } 00022 00023 ora::DatabaseUtility& ora::DatabaseUtility::operator=( const DatabaseUtility& rhs ){ 00024 m_session = rhs.m_session; 00025 return *this; 00026 } 00027 00028 std::set<std::string> ora::DatabaseUtility::listMappingVersions( const std::string& containerName ){ 00029 Handle<DatabaseContainer> cont = m_session->containerHandle( containerName ); 00030 if( !cont ){ 00031 throwException("Container \""+containerName+"\" does not exist in the database.", 00032 "DatabaseUtility::listMappingVersions"); 00033 } 00034 return m_session->listMappingVersions( cont->id() ); 00035 } 00036 00037 std::map<std::string,std::string> ora::DatabaseUtility::listMappings( const std::string& containerName ){ 00038 Handle<DatabaseContainer> cont = m_session->containerHandle( containerName ); 00039 if( !cont ){ 00040 throwException("Container \""+containerName+"\" does not exist in the database.", 00041 "DatabaseUtility::listMappings"); 00042 } 00043 return m_session->listMappings( cont->id() ); 00044 } 00045 00046 bool ora::DatabaseUtility::dumpMapping( const std::string& mappingVersion, 00047 std::ostream& outputStream ){ 00048 return m_session->dumpMapping( mappingVersion,outputStream ); 00049 } 00050 00051 void ora::DatabaseUtility::importContainerSchema( const std::string& sourceConnectionString, 00052 const std::string& containerName ){ 00053 m_session->importContainerSchema( sourceConnectionString, containerName ); 00054 } 00055 00056 void ora::DatabaseUtility::importContainer( const std::string& sourceConnectionString, 00057 const std::string& containerName ){ 00058 m_session->importContainer( sourceConnectionString, containerName ); 00059 } 00060 00061 void ora::DatabaseUtility::eraseMapping( const std::string& mappingVersion ){ 00062 m_session->eraseMapping( mappingVersion ); 00063 } 00064