00001 #include "CondCore/IOVService/interface/IOVSchemaUtility.h" 00002 #include "CondCore/IOVService/interface/IOVNames.h" 00003 #include "CondCore/DBCommon/interface/ObjectRelationalMappingUtility.h" 00004 #include "CondCore/DBCommon/interface/CoralTransaction.h" 00005 cond::IOVSchemaUtility::IOVSchemaUtility(cond::CoralTransaction& coraldb):m_coraldb(coraldb){ 00006 } 00007 cond::IOVSchemaUtility::~IOVSchemaUtility(){} 00008 void 00009 cond::IOVSchemaUtility::create(){ 00010 cond::ObjectRelationalMappingUtility mappingUtil(&(m_coraldb.coralSessionProxy()) ); 00011 if( !mappingUtil.existsMapping(cond::IOVNames::iovMappingVersion()) ){ 00012 mappingUtil.buildAndStoreMappingFromBuffer(cond::IOVNames::iovMappingXML()); 00013 } 00014 } 00015 void 00016 cond::IOVSchemaUtility::drop(){ 00017 cond::ObjectRelationalMappingUtility mappingUtil(&(m_coraldb.coralSessionProxy()) ); 00018 if( !mappingUtil.existsMapping(cond::IOVNames::iovMappingVersion()) ) return; 00019 mappingUtil.removeMapping(cond::IOVNames::iovMappingVersion(),true); 00020 } 00021 void 00022 cond::IOVSchemaUtility::truncate(){ 00023 cond::ObjectRelationalMappingUtility mappingUtil(&(m_coraldb.coralSessionProxy()) ); 00024 if( !mappingUtil.existsMapping(cond::IOVNames::iovMappingVersion()) ) return; 00025 mappingUtil.removeMapping(cond::IOVNames::iovMappingVersion(),false); 00026 }