#include <MetaDataSchemaUtility.h>
Public Member Functions | |
void | create () |
create metadata tables if not existing | |
void | drop () |
drop metadata tables is existing | |
MetaDataSchemaUtility (cond::DbSession &coraldb) | |
~MetaDataSchemaUtility () | |
Private Attributes | |
cond::DbSession | m_coraldb |
Definition at line 7 of file MetaDataSchemaUtility.h.
cond::MetaDataSchemaUtility::MetaDataSchemaUtility | ( | cond::DbSession & | coraldb | ) |
Definition at line 14 of file MetaDataDataSchemaUtility.cc.
:m_coraldb(coraldb){ }
cond::MetaDataSchemaUtility::~MetaDataSchemaUtility | ( | ) |
Definition at line 16 of file MetaDataDataSchemaUtility.cc.
{}
void cond::MetaDataSchemaUtility::create | ( | ) |
create metadata tables if not existing
Definition at line 19 of file MetaDataDataSchemaUtility.cc.
References idDealer::description, cond::MetaDataNames::metadataTable(), python::IdGenerator::schema, asciidump::table, cond::MetaDataNames::tagColumn(), cond::MetaDataNames::timetypeColumn(), and cond::MetaDataNames::tokenColumn().
{ try{ coral::ISchema& schema=m_coraldb.nominalSchema(); coral::TableDescription description; description.setName( cond::MetaDataNames::metadataTable() ); description.insertColumn( cond::MetaDataNames::tagColumn(), coral::AttributeSpecification::typeNameForId( typeid(std::string)) ); description.insertColumn( cond::MetaDataNames::tokenColumn(), coral::AttributeSpecification::typeNameForId( typeid(std::string)) ); description.insertColumn( cond::MetaDataNames::timetypeColumn(), coral::AttributeSpecification::typeNameForId( typeid(int)) ); std::vector<std::string> cols; cols.push_back( cond::MetaDataNames::tagColumn() ); description.setPrimaryKey(cols); description.setNotNullConstraint( cond::MetaDataNames::tokenColumn() ); coral::ITable& table=schema.createTable(description); table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select); }catch( const coral::TableAlreadyExistingException& er ){ //must catch and ignore this exception!! //std::cout<<"table alreay existing, not creating a new one"<<std::endl; } }
void cond::MetaDataSchemaUtility::drop | ( | ) |
drop metadata tables is existing
Definition at line 39 of file MetaDataDataSchemaUtility.cc.
References cond::MetaDataNames::metadataTable(), and python::IdGenerator::schema.
{ coral::ISchema& schema=m_coraldb.nominalSchema(); try{ schema.dropTable(cond::MetaDataNames::metadataTable()); }catch(coral::TableNotExistingException& er){ //must catch and ignore this exception!! //ok do nothing } }
Definition at line 16 of file MetaDataSchemaUtility.h.