CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/CondCore/ORA/src/IDatabaseSchema.cc

Go to the documentation of this file.
00001 #include "IDatabaseSchema.h"
00002 #include "OraDatabaseSchema.h"
00003 #include "PoolDatabaseSchema.h"
00004 
00005 std::string ora::poolSchemaVersion(){
00006   static std::string s_version("POOL");
00007   return s_version;
00008 }
00009 
00010 std::string ora::IMainTable::versionParameterName(){
00011   static std::string s_name("SCHEMA_VERSION");
00012   return s_name;
00013 }
00014 
00015 ora::MappingRawElement::MappingRawElement():
00016   scopeName(""),
00017   variableName(""),
00018   variableType(""),
00019   elementType(""),
00020   tableName(""),
00021   columns(){
00022 }
00023 
00024 ora::MappingRawElement::MappingRawElement(const MappingRawElement& rhs):
00025   scopeName( rhs.scopeName ),
00026   variableName( rhs.variableName ),
00027   variableType( rhs.variableType ),
00028   elementType( rhs.elementType ),
00029   tableName( rhs.tableName ),
00030   columns( rhs.columns ){
00031 }
00032 
00033 ora::MappingRawElement& ora::MappingRawElement::operator==(const MappingRawElement& rhs){
00034   scopeName = rhs.scopeName;
00035   variableName = rhs.variableName;
00036   variableType = rhs.variableType;
00037   elementType = rhs.elementType;
00038   tableName = rhs.tableName;
00039   columns = rhs.columns;
00040   return *this;
00041 }
00042 
00043 std::string ora::MappingRawElement::emptyScope(){
00044   static std::string s_scope("[]");
00045   return s_scope;
00046 }
00047 
00048 ora::MappingRawData::MappingRawData():  
00049   version( "" ),
00050   elements(){
00051 }
00052 
00053 ora::MappingRawData::MappingRawData( const std::string& vers ):  
00054   version( vers ),
00055   elements(){
00056 }
00057 
00058 ora::MappingRawElement& ora::MappingRawData::addElement( int elementId ){
00059   std::map< int, MappingRawElement>::iterator iElem = elements.find( elementId );
00060   if( iElem == elements.end() ){
00061     iElem = elements.insert( std::make_pair( elementId, MappingRawElement() ) ).first;
00062   }
00063   return iElem->second;
00064 }
00065 
00066 ora::ContainerHeaderData::ContainerHeaderData( int contId,
00067                                                const std::string& classN,
00068                                                unsigned int numberObj ):
00069   id(contId),
00070   className(classN),
00071   numberOfObjects(numberObj){
00072 }
00073 
00074 ora::ContainerHeaderData::ContainerHeaderData( const ContainerHeaderData& rhs ):
00075   id(rhs.id),
00076   className(rhs.className),
00077   numberOfObjects(rhs.numberOfObjects){
00078 }
00079 
00080 ora::ContainerHeaderData& ora::ContainerHeaderData::operator=( const ContainerHeaderData& rhs ){
00081   id = rhs.id;
00082   className = rhs.className;
00083   numberOfObjects = rhs.numberOfObjects;
00084   return *this;
00085 }
00086 
00087 
00088 ora::IDatabaseSchema* ora::IDatabaseSchema::createSchemaHandle( coral::ISchema& schema ){
00089   IDatabaseSchema* dbSchema = 0;
00090   if( !OraDatabaseSchema::existsMainTable( schema ) ){
00091     if( PoolDatabaseSchema::existsMainTable( schema ) ) dbSchema = new PoolDatabaseSchema( schema );
00092   }
00093   if( ! dbSchema ) dbSchema = new OraDatabaseSchema( schema );
00094   return dbSchema;
00095 }
00096 
00097 ora::IDatabaseSchema::IDatabaseSchema( coral::ISchema& schema ):
00098   m_schema( schema ){
00099 }
00100 
00101 coral::ISchema& ora::IDatabaseSchema::storageSchema(){
00102   return m_schema;
00103 }
00104