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::OraDatabaseSchema Class Reference

#include <OraDatabaseSchema.h>

Inheritance diagram for ora::OraDatabaseSchema:
ora::IDatabaseSchema

Public Member Functions

IDatabaseTableclassVersionTable ()
 
IContainerHeaderTablecontainerHeaderTable ()
 
void create (const std::string &userSchemaVersion)
 
void drop ()
 
bool exists ()
 
IMainTablemainTable ()
 
IDatabaseTablemappingElementTable ()
 
IMappingSchemamappingSchema ()
 
IDatabaseTablemappingVersionTable ()
 
INamingServiceTablenamingServiceTable ()
 
 OraDatabaseSchema (coral::ISchema &dbSchema)
 
ISequenceTablesequenceTable ()
 
void setAccessPermission (const std::string &principal, bool forWrite)
 
bool testDropPermission ()
 
virtual ~OraDatabaseSchema ()
 
- Public Member Functions inherited from ora::IDatabaseSchema
 IDatabaseSchema (coral::ISchema &schema)
 
coral::ISchema & storageSchema ()
 
virtual ~IDatabaseSchema ()
 

Static Public Member Functions

static bool existsMainTable (coral::ISchema &dbSchema)
 
- Static Public Member Functions inherited from ora::IDatabaseSchema
static IDatabaseSchemacreateSchemaHandle (coral::ISchema &schema)
 

Private Attributes

OraClassVersionTable m_classVersionTable
 
OraContainerHeaderTable m_containerHeaderTable
 
OraMainTable m_mainTable
 
OraMappingElementTable m_mappingElementTable
 
OraMappingSchema m_mappingSchema
 
OraMappingVersionTable m_mappingVersionTable
 
OraNamingServiceTable m_namingServiceTable
 
coral::ISchema & m_schema
 
OraSequenceTable m_sequenceTable
 

Detailed Description

Definition at line 181 of file OraDatabaseSchema.h.

Constructor & Destructor Documentation

ora::OraDatabaseSchema::OraDatabaseSchema ( coral::ISchema &  dbSchema)
explicit

Definition at line 1267 of file OraDatabaseSchema.cc.

1267  :
1268  IDatabaseSchema( dbSchema ),
1269  m_schema( dbSchema ),
1270  m_mainTable( dbSchema ),
1271  m_sequenceTable( dbSchema ),
1272  m_mappingVersionTable( dbSchema ),
1273  m_mappingElementTable( dbSchema ),
1274  m_containerHeaderTable( dbSchema ),
1275  m_classVersionTable( dbSchema ),
1276  m_mappingSchema( dbSchema ),
1277  m_namingServiceTable( dbSchema ){
1278 }
OraMappingElementTable m_mappingElementTable
OraContainerHeaderTable m_containerHeaderTable
OraMappingSchema m_mappingSchema
OraMappingVersionTable m_mappingVersionTable
IDatabaseSchema(coral::ISchema &schema)
OraSequenceTable m_sequenceTable
coral::ISchema & m_schema
OraNamingServiceTable m_namingServiceTable
OraClassVersionTable m_classVersionTable
ora::OraDatabaseSchema::~OraDatabaseSchema ( )
virtual

Definition at line 1280 of file OraDatabaseSchema.cc.

1280  {
1281 }

Member Function Documentation

ora::IDatabaseTable & ora::OraDatabaseSchema::classVersionTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1354 of file OraDatabaseSchema.cc.

1354  {
1355  return m_classVersionTable;
1356 }
OraClassVersionTable m_classVersionTable
ora::IContainerHeaderTable & ora::OraDatabaseSchema::containerHeaderTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1350 of file OraDatabaseSchema.cc.

1350  {
1351  return m_containerHeaderTable;
1352 }
OraContainerHeaderTable m_containerHeaderTable
void ora::OraDatabaseSchema::create ( const std::string &  userSchemaVersion)
virtual

Implements ora::IDatabaseSchema.

Definition at line 1302 of file OraDatabaseSchema.cc.

References ora::IMainTable::userSchemaVersionParameterName().

1302  {
1303  m_mainTable.create();
1311 }
OraMappingElementTable m_mappingElementTable
static std::string userSchemaVersionParameterName()
OraContainerHeaderTable m_containerHeaderTable
void setParameter(const std::string &paramName, const std::string &paramValue)
OraMappingVersionTable m_mappingVersionTable
OraSequenceTable m_sequenceTable
OraNamingServiceTable m_namingServiceTable
OraClassVersionTable m_classVersionTable
void ora::OraDatabaseSchema::drop ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1313 of file OraDatabaseSchema.cc.

1313  {
1320  m_mainTable.drop();
1321 }
OraMappingElementTable m_mappingElementTable
OraContainerHeaderTable m_containerHeaderTable
OraMappingVersionTable m_mappingVersionTable
OraSequenceTable m_sequenceTable
OraNamingServiceTable m_namingServiceTable
OraClassVersionTable m_classVersionTable
bool ora::OraDatabaseSchema::exists ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1283 of file OraDatabaseSchema.cc.

References ora::throwException().

1283  {
1284  if(!m_mainTable.exists()){
1285  return false;
1286  }
1288  throwException( "ORA database is corrupted. Naming Service table is missing", "OraDatabaseSchema::exists");
1289  if(!m_sequenceTable.exists())
1290  throwException( "ORA database is corrupted. Sequence table is missing.","OraDatabaseSchema::exists");
1292  throwException( "ORA database is corrupted. Mapping Version table is missing.","OraDatabaseSchema::exists");
1294  throwException( "ORA database is corrupted. Mapping Element table is missing.","OraDatabaseSchema::exists");
1296  throwException( "ORA database is corrupted. Container Header table is missing.","OraDatabaseSchema::exists");
1297  if(!m_classVersionTable.exists())
1298  throwException( "ORA database is corrupted. Class Version table is missing.","OraDatabaseSchema::exists");
1299  return true;
1300 }
OraMappingElementTable m_mappingElementTable
OraContainerHeaderTable m_containerHeaderTable
OraMappingVersionTable m_mappingVersionTable
OraSequenceTable m_sequenceTable
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
OraNamingServiceTable m_namingServiceTable
OraClassVersionTable m_classVersionTable
bool ora::OraDatabaseSchema::existsMainTable ( coral::ISchema &  dbSchema)
static

Definition at line 1067 of file OraDatabaseSchema.cc.

References ora::OraMainTable::exists(), and tmp.

Referenced by ora::IDatabaseSchema::createSchemaHandle().

1067  {
1068  OraMainTable tmp( dbSchema );
1069  return tmp.exists();
1070 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
ora::IMainTable & ora::OraDatabaseSchema::mainTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1334 of file OraDatabaseSchema.cc.

1334  {
1335  return m_mainTable;
1336 }
ora::IDatabaseTable & ora::OraDatabaseSchema::mappingElementTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1346 of file OraDatabaseSchema.cc.

1346  {
1347  return m_mappingElementTable;
1348 }
OraMappingElementTable m_mappingElementTable
ora::IMappingSchema & ora::OraDatabaseSchema::mappingSchema ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1358 of file OraDatabaseSchema.cc.

1358  {
1359  return m_mappingSchema;
1360 }
OraMappingSchema m_mappingSchema
ora::IDatabaseTable & ora::OraDatabaseSchema::mappingVersionTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1342 of file OraDatabaseSchema.cc.

1342  {
1343  return m_mappingVersionTable;
1344 }
OraMappingVersionTable m_mappingVersionTable
ora::INamingServiceTable & ora::OraDatabaseSchema::namingServiceTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1362 of file OraDatabaseSchema.cc.

1362  {
1363  return m_namingServiceTable;
1364 }
OraNamingServiceTable m_namingServiceTable
ora::ISequenceTable & ora::OraDatabaseSchema::sequenceTable ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1338 of file OraDatabaseSchema.cc.

1338  {
1339  return m_sequenceTable;
1340 }
OraSequenceTable m_sequenceTable
void ora::OraDatabaseSchema::setAccessPermission ( const std::string &  principal,
bool  forWrite 
)
virtual

Implements ora::IDatabaseSchema.

Definition at line 1323 of file OraDatabaseSchema.cc.

1324  {
1332 }
OraMappingElementTable m_mappingElementTable
OraContainerHeaderTable m_containerHeaderTable
OraMappingVersionTable m_mappingVersionTable
OraSequenceTable m_sequenceTable
OraNamingServiceTable m_namingServiceTable
virtual void setAccessPermission(const std::string &principal, bool forWrite)
OraClassVersionTable m_classVersionTable
bool ora::OraDatabaseSchema::testDropPermission ( )
virtual

Implements ora::IDatabaseSchema.

Definition at line 1366 of file OraDatabaseSchema.cc.

References Exception, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, HLT_25ns14e33_v1_cff::tableName, and ora::throwException().

1366  {
1367  // horrible work-around to avoid the attempt to DROP a db with no permission:
1368  // due to Oracle implicit COMMIT after any DDL attempt (successful or not...), the previous DELETE on containers are commited
1369  // as a result the ora db is left corrupted
1370  bool ret = false;
1371  std::string tableName("ORA_TEST_DROP");
1372  if( m_schema.existsTable( tableName )){
1373  throwException( "ORA_TEST_DROP table already exists in this schema.",
1374  "OraNameTable::testDropPermission");
1375  }
1376  try{
1377  coral::TableDescription descr( "OraDb" );
1378  descr.setName( tableName );
1379  descr.insertColumn( "DUMMY",
1380  coral::AttributeSpecification::typeNameForType<int>() );
1381  m_schema.createTable( descr );
1382  ret = true;
1383  ::sleep(1);
1384  }catch ( const coral::Exception& ){
1385  ret = false;
1386  }
1387  if(ret ) m_schema.dropIfExistsTable( tableName );
1388  return ret;
1389 }
coral::ISchema & m_schema
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10

Member Data Documentation

OraClassVersionTable ora::OraDatabaseSchema::m_classVersionTable
private

Definition at line 211 of file OraDatabaseSchema.h.

OraContainerHeaderTable ora::OraDatabaseSchema::m_containerHeaderTable
private

Definition at line 210 of file OraDatabaseSchema.h.

OraMainTable ora::OraDatabaseSchema::m_mainTable
private

Definition at line 206 of file OraDatabaseSchema.h.

OraMappingElementTable ora::OraDatabaseSchema::m_mappingElementTable
private

Definition at line 209 of file OraDatabaseSchema.h.

OraMappingSchema ora::OraDatabaseSchema::m_mappingSchema
private

Definition at line 212 of file OraDatabaseSchema.h.

OraMappingVersionTable ora::OraDatabaseSchema::m_mappingVersionTable
private

Definition at line 208 of file OraDatabaseSchema.h.

OraNamingServiceTable ora::OraDatabaseSchema::m_namingServiceTable
private

Definition at line 213 of file OraDatabaseSchema.h.

coral::ISchema& ora::OraDatabaseSchema::m_schema
private

Definition at line 205 of file OraDatabaseSchema.h.

OraSequenceTable ora::OraDatabaseSchema::m_sequenceTable
private

Definition at line 207 of file OraDatabaseSchema.h.