CMS 3D CMS Logo

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

#include <OraDatabaseSchema.h>

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

Public Member Functions

void create ()
 
void drop ()
 
bool exists ()
 
 OraMappingElementTable (coral::ISchema &dbSchema)
 
virtual ~OraMappingElementTable ()
 
- Public Member Functions inherited from ora::IDatabaseTable
virtual ~IDatabaseTable ()
 

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.

297  :
298  m_schema( dbSchema ){
299 }
ora::OraMappingElementTable::~OraMappingElementTable ( )
virtual

Definition at line 301 of file OraDatabaseSchema.cc.

301  {
302 }

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

292  {
293  static std::string s_col("COLUMN_NAME");
294  return s_col;
295 }
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().

308  {
309  if( m_schema.existsTable( tableName() )){
310  throwException( "ORA database mapping element table already exists in this schema.",
311  "OraMappingElementTable::create");
312  }
313 
314  // mapping elements table
315  coral::TableDescription description2( "OraDb" );
316  description2.setName( tableName() );
317  description2.insertColumn( mappingVersionColumn(),
318  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false );
319  description2.setNotNullConstraint( mappingVersionColumn() );
320  description2.insertColumn( elementIdColumn(),
321  coral::AttributeSpecification::typeNameForType<int>() );
322  description2.setNotNullConstraint( elementIdColumn() );
323  description2.insertColumn( elementTypeColumn(),
324  coral::AttributeSpecification::typeNameForType<std::string>() );
325  description2.setNotNullConstraint( elementTypeColumn() );
326  description2.insertColumn( scopeNameColumn(),
327  coral::AttributeSpecification::typeNameForType<std::string>() );
328  description2.setNotNullConstraint( scopeNameColumn() );
329  description2.insertColumn( variableNameColumn(),
330  coral::AttributeSpecification::typeNameForType<std::string>() );
331  description2.setNotNullConstraint( variableNameColumn() );
332  description2.insertColumn( variableParIndexColumn(),
333  coral::AttributeSpecification::typeNameForType<unsigned int>() );
334  description2.setNotNullConstraint( variableParIndexColumn() );
335  description2.insertColumn( variableTypeColumn(),
336  coral::AttributeSpecification::typeNameForType<std::string>() );
337  description2.setNotNullConstraint( variableTypeColumn() );
338  description2.insertColumn( tableNameColumn(),
339  coral::AttributeSpecification::typeNameForType<std::string>() );
340  description2.setNotNullConstraint( tableNameColumn() );
341  description2.insertColumn( columnNameColumn(),
342  coral::AttributeSpecification::typeNameForType<std::string>() );
343  description2.setNotNullConstraint( columnNameColumn() );
344  std::vector<std::string> cols2;
345  cols2.push_back( elementIdColumn() );
346  cols2.push_back( variableParIndexColumn() );
347  description2.setPrimaryKey( cols2 );
348  std::string fkName20 = mappingVersionColumn()+"_FK_1";
349  description2.createForeignKey( fkName20, mappingVersionColumn(),
351  m_schema.createTable( description2 ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
352 }
static std::string variableNameColumn()
static std::string mappingVersionColumn()
static std::string tableName()
static std::string tableNameColumn()
static std::string elementTypeColumn()
static std::string variableParIndexColumn()
static std::string tableName()
static std::string variableTypeColumn()
static std::string mappingVersionColumn()
static std::string scopeNameColumn()
static std::string columnNameColumn()
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
static std::string elementIdColumn()
void ora::OraMappingElementTable::drop ( )
virtual

Implements ora::IDatabaseTable.

Definition at line 354 of file OraDatabaseSchema.cc.

354  {
355  m_schema.dropIfExistsTable( tableName() );
356 }
static std::string tableName()
std::string ora::OraMappingElementTable::elementIdColumn ( )
static

Definition at line 256 of file OraDatabaseSchema.cc.

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

256  {
257  static std::string s_col("ELEMENT_ID");
258  return s_col;
259 }
std::string ora::OraMappingElementTable::elementTypeColumn ( )
static

Definition at line 261 of file OraDatabaseSchema.cc.

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

261  {
262  static std::string s_col("ELEMENT_TYPE");
263  return s_col;
264 }
bool ora::OraMappingElementTable::exists ( )
virtual

Implements ora::IDatabaseTable.

Definition at line 304 of file OraDatabaseSchema.cc.

304  {
305  return m_schema.existsTable( tableName() );
306 }
static std::string tableName()
std::string ora::OraMappingElementTable::mappingVersionColumn ( )
static

Definition at line 251 of file OraDatabaseSchema.cc.

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

251  {
252  static std::string s_col("MAPPING_VERSION");
253  return s_col;
254 }
std::string ora::OraMappingElementTable::scopeNameColumn ( )
static

Definition at line 266 of file OraDatabaseSchema.cc.

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

266  {
267  static std::string s_col("VARIABLE_SCOPE");
268  return s_col;
269 }
std::string ora::OraMappingElementTable::tableName ( )
static
std::string ora::OraMappingElementTable::tableNameColumn ( )
static

Definition at line 287 of file OraDatabaseSchema.cc.

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

287  {
288  static std::string s_col("TABLE_NAME");
289  return s_col;
290 }
std::string ora::OraMappingElementTable::variableNameColumn ( )
static

Definition at line 271 of file OraDatabaseSchema.cc.

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

271  {
272  static std::string s_col("VARIABLE_NAME");
273  return s_col;
274 }
std::string ora::OraMappingElementTable::variableParIndexColumn ( )
static

Definition at line 276 of file OraDatabaseSchema.cc.

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

276  {
277  static std::string s_col("VARIABLE_PAR_INDEX");
278  return s_col;
279 }
std::string ora::OraMappingElementTable::variableTypeColumn ( )
static

Definition at line 281 of file OraDatabaseSchema.cc.

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

281  {
282  static std::string s_col("VARIABLE_TYPE");
283  return s_col;
284 
285 }

Member Data Documentation

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

Definition at line 85 of file OraDatabaseSchema.h.