CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cond::MetaDataSchemaUtility Class Reference

#include <MetaDataSchemaUtility.h>

Public Member Functions

void create ()
 create metadata tables if not existing More...
 
void drop ()
 drop metadata tables is existing More...
 
 MetaDataSchemaUtility (cond::DbSession &coraldb)
 
 ~MetaDataSchemaUtility ()
 

Private Attributes

cond::DbSession m_coraldb
 

Detailed Description

Definition at line 7 of file MetaDataSchemaUtility.h.

Constructor & Destructor Documentation

cond::MetaDataSchemaUtility::MetaDataSchemaUtility ( cond::DbSession coraldb)

Definition at line 14 of file MetaDataDataSchemaUtility.cc.

14  :m_coraldb(coraldb){
15 }
cond::MetaDataSchemaUtility::~MetaDataSchemaUtility ( )

Definition at line 16 of file MetaDataDataSchemaUtility.cc.

16 {}

Member Function Documentation

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().

19  {
20  try{
21  coral::ISchema& schema=m_coraldb.nominalSchema();
22  coral::TableDescription description;
23  description.setName( cond::MetaDataNames::metadataTable() );
24  description.insertColumn( cond::MetaDataNames::tagColumn(), coral::AttributeSpecification::typeNameForId( typeid(std::string)) );
25  description.insertColumn( cond::MetaDataNames::tokenColumn(), coral::AttributeSpecification::typeNameForId( typeid(std::string)) );
26  description.insertColumn( cond::MetaDataNames::timetypeColumn(), coral::AttributeSpecification::typeNameForId( typeid(int)) );
27  std::vector<std::string> cols;
28  cols.push_back( cond::MetaDataNames::tagColumn() );
29  description.setPrimaryKey(cols);
30  description.setNotNullConstraint( cond::MetaDataNames::tokenColumn() );
31  coral::ITable& table=schema.createTable(description);
32  table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select);
33  }catch( const coral::TableAlreadyExistingException& er ){
34  //must catch and ignore this exception!!
35  //std::cout<<"table alreay existing, not creating a new one"<<std::endl;
36  }
37 }
list table
Definition: asciidump.py:386
static const std::string & tagColumn()
Definition: MetaDataNames.cc:6
static const std::string & metadataTable()
Definition: MetaDataNames.cc:2
tuple description
Definition: idDealer.py:66
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
static const std::string & timetypeColumn()
static const std::string & tokenColumn()
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.

39  {
40  coral::ISchema& schema=m_coraldb.nominalSchema();
41  try{
42  schema.dropTable(cond::MetaDataNames::metadataTable());
43  }catch(coral::TableNotExistingException& er){
44  //must catch and ignore this exception!!
45  //ok do nothing
46  }
47 }
static const std::string & metadataTable()
Definition: MetaDataNames.cc:2
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175

Member Data Documentation

cond::DbSession cond::MetaDataSchemaUtility::m_coraldb
private

Definition at line 16 of file MetaDataSchemaUtility.h.