CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

ora::OraMappingElementTable Class Reference

#include <OraDatabaseSchema.h>

Inheritance diagram for ora::OraMappingElementTable:
ora::IDatabaseTable

List of all members.

Public Member Functions

void create ()
void drop ()
bool exists ()
 OraMappingElementTable (coral::ISchema &dbSchema)
virtual ~OraMappingElementTable ()

Static Public Member Functions

static std::string columnNameColumn ()
static std::string elementIdColumn ()
static std::string elementTypeColumn ()
static std::string mappingVersionColumn ()
static std::string scopeNameColumn ()
static std::string tableName ()
static std::string tableNameColumn ()
static std::string variableNameColumn ()
static std::string variableParIndexColumn ()
static std::string variableTypeColumn ()

Private Attributes

coral::ISchema & m_schema

Detailed Description

Definition at line 65 of file OraDatabaseSchema.h.


Constructor & Destructor Documentation

ora::OraMappingElementTable::OraMappingElementTable ( coral::ISchema &  dbSchema) [explicit]

Definition at line 297 of file OraDatabaseSchema.cc.

                                                                          :
  m_schema( dbSchema ){
}
ora::OraMappingElementTable::~OraMappingElementTable ( ) [virtual]

Definition at line 301 of file OraDatabaseSchema.cc.

                                                  {
}

Member Function Documentation

std::string ora::OraMappingElementTable::columnNameColumn ( ) [static]

Definition at line 292 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                     {
  static std::string s_col("COLUMN_NAME");
  return s_col;  
}
void ora::OraMappingElementTable::create ( ) [virtual]

Implements ora::IDatabaseTable.

Definition at line 308 of file OraDatabaseSchema.cc.

References ora::OraMappingVersionTable::mappingVersionColumn(), ora::OraMappingVersionTable::tableName(), and ora::throwException().

                                      {
  if( m_schema.existsTable( tableName() )){
    throwException( "ORA database mapping element table already exists in this schema.",
                    "OraMappingElementTable::create");
  }

  // mapping elements table
  coral::TableDescription description2( "OraDb" );
  description2.setName( tableName() );
  description2.insertColumn(  mappingVersionColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false );
  description2.setNotNullConstraint(  mappingVersionColumn() );
  description2.insertColumn(  elementIdColumn(),
                              coral::AttributeSpecification::typeNameForType<int>() );
  description2.setNotNullConstraint(  elementIdColumn() );
  description2.insertColumn(  elementTypeColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint(  elementTypeColumn() );
  description2.insertColumn(  scopeNameColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint(  scopeNameColumn() );
  description2.insertColumn( variableNameColumn(),
                             coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint( variableNameColumn() );
  description2.insertColumn( variableParIndexColumn(),
                              coral::AttributeSpecification::typeNameForType<unsigned int>() );
  description2.setNotNullConstraint(  variableParIndexColumn() );
  description2.insertColumn(  variableTypeColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint(  variableTypeColumn() );
  description2.insertColumn(  tableNameColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint(  tableNameColumn() );
  description2.insertColumn(  columnNameColumn(),
                              coral::AttributeSpecification::typeNameForType<std::string>() );
  description2.setNotNullConstraint(  columnNameColumn() );
  std::vector<std::string> cols2;
  cols2.push_back(  elementIdColumn() );
  cols2.push_back(  variableParIndexColumn() );
  description2.setPrimaryKey( cols2 );
  std::string fkName20 = mappingVersionColumn()+"_FK_1";
  description2.createForeignKey( fkName20, mappingVersionColumn(),
                                 OraMappingVersionTable::tableName(),OraMappingVersionTable::mappingVersionColumn());
  m_schema.createTable( description2 ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
}
void ora::OraMappingElementTable::drop ( ) [virtual]

Implements ora::IDatabaseTable.

Definition at line 354 of file OraDatabaseSchema.cc.

                                    {
  m_schema.dropIfExistsTable( tableName() );
}
std::string ora::OraMappingElementTable::elementIdColumn ( ) [static]

Definition at line 256 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                    {
  static std::string s_col("ELEMENT_ID");
  return s_col;
}
std::string ora::OraMappingElementTable::elementTypeColumn ( ) [static]

Definition at line 261 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                      {
  static std::string s_col("ELEMENT_TYPE");
  return s_col;  
}
bool ora::OraMappingElementTable::exists ( ) [virtual]

Implements ora::IDatabaseTable.

Definition at line 304 of file OraDatabaseSchema.cc.

                                      {
  return m_schema.existsTable( tableName() );
}
std::string ora::OraMappingElementTable::mappingVersionColumn ( ) [static]
std::string ora::OraMappingElementTable::scopeNameColumn ( ) [static]

Definition at line 266 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                    {
  static std::string s_col("VARIABLE_SCOPE");
  return s_col;
}
std::string ora::OraMappingElementTable::tableName ( ) [static]
std::string ora::OraMappingElementTable::tableNameColumn ( ) [static]
std::string ora::OraMappingElementTable::variableNameColumn ( ) [static]

Definition at line 271 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                       {
  static std::string s_col("VARIABLE_NAME");
  return s_col;
}
std::string ora::OraMappingElementTable::variableParIndexColumn ( ) [static]

Definition at line 276 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                           {
  static std::string s_col("VARIABLE_PAR_INDEX");
  return s_col;
}
std::string ora::OraMappingElementTable::variableTypeColumn ( ) [static]

Definition at line 281 of file OraDatabaseSchema.cc.

Referenced by ora::OraMappingSchema::getMapping(), and ora::OraMappingSchema::storeMapping().

                                                       {
  static std::string s_col("VARIABLE_TYPE");
  return s_col;

}

Member Data Documentation

coral::ISchema& ora::OraMappingElementTable::m_schema [private]

Definition at line 85 of file OraDatabaseSchema.h.