test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IDatabaseSchema.cc
Go to the documentation of this file.
1 #include "IDatabaseSchema.h"
2 #include "OraDatabaseSchema.h"
3 #include "PoolDatabaseSchema.h"
4 // externals
5 #include "RelationalAccess/ISchema.h"
6 #include "RelationalAccess/ITable.h"
7 #include "RelationalAccess/ITablePrivilegeManager.h"
8 
10  static const std::string s_version("POOL");
11  return s_version;
12 }
13 
14 void ora::setTableAccessPermission( coral::ITable& table,
15  const std::string& principal,
16  bool forWrite ){
17  table.privilegeManager().grantToUser( principal, coral::ITablePrivilegeManager::Select );
18  if(forWrite){
19  table.privilegeManager().grantToUser( principal, coral::ITablePrivilegeManager::Update );
20  table.privilegeManager().grantToUser( principal, coral::ITablePrivilegeManager::Insert );
21  table.privilegeManager().grantToUser( principal, coral::ITablePrivilegeManager::Delete );
22  }
23 }
24 
26  m_schema( schema ){
27 }
28 
29 coral::ISchema& ora::IDatabaseTable::schema(){
30  return m_schema;
31 }
32 
34  bool forWrite ){
35  coral::ITable& coralHandle = m_schema.tableHandle( name() );
36  setTableAccessPermission( coralHandle, principal, forWrite );
37 }
38 
40  static const std::string s_name("SCHEMA_VERSION");
41  return s_name;
42 }
43 
45  static const std::string s_name("USER_SCHEMA_VERSION");
46  return s_name;
47 }
48 
50  IDatabaseTable( schema ){
51 }
52 
54  IDatabaseTable( schema ){
55 }
56 
58  scopeName(""),
59  variableName(""),
60  variableType(""),
61  elementType(""),
62  tableName(""),
63  columns(){
64 }
65 
67  scopeName( rhs.scopeName ),
68  variableName( rhs.variableName ),
69  variableType( rhs.variableType ),
70  elementType( rhs.elementType ),
71  tableName( rhs.tableName ),
72  columns( rhs.columns ){
73 }
74 
76  scopeName = rhs.scopeName;
77  variableName = rhs.variableName;
78  variableType = rhs.variableType;
79  elementType = rhs.elementType;
80  tableName = rhs.tableName;
81  columns = rhs.columns;
82  return *this;
83 }
84 
86  static const std::string s_scope("[]");
87  return s_scope;
88 }
89 
91  version( "" ),
92  elements(){
93 }
94 
96  version( vers ),
97  elements(){
98 }
99 
101  std::map< int, MappingRawElement>::iterator iElem = elements.find( elementId );
102  if( iElem == elements.end() ){
103  iElem = elements.insert( std::make_pair( elementId, MappingRawElement() ) ).first;
104  }
105  return iElem->second;
106 }
107 
109  id(-1),
110  className(""),
111  numberOfObjects(0){
112 }
113 
115  const std::string& classN,
116  unsigned int numberObj ):
117  id(contId),
118  className(classN),
119  numberOfObjects(numberObj){
120 }
121 
123  id(rhs.id),
124  className(rhs.className),
125  numberOfObjects(rhs.numberOfObjects){
126 }
127 
129  id = rhs.id;
130  className = rhs.className;
131  numberOfObjects = rhs.numberOfObjects;
132  return *this;
133 }
134 
136  IDatabaseTable( schema ){
137 }
138 
140  IDatabaseTable( schema ){
141 }
142 
144  IDatabaseSchema* dbSchema = 0;
145  if( !OraDatabaseSchema::existsMainTable( schema ) ){
146  if( PoolDatabaseSchema::existsMainTable( schema ) ) dbSchema = new PoolDatabaseSchema( schema );
147  }
148  if( ! dbSchema ) dbSchema = new OraDatabaseSchema( schema );
149  return dbSchema;
150 }
151 
153  m_schema( schema ){
154 }
155 
157  return m_schema;
158 }
159 
static std::string versionParameterName()
static std::string userSchemaVersionParameterName()
MappingRawElement & addElement(int elementId)
std::vector< std::string > columns
list elements
Definition: asciidump.py:414
IContainerHeaderTable(coral::ISchema &schema)
void setTableAccessPermission(coral::ITable &table, const std::string &principal, bool forWrite)
def Delete
Definition: archive.py:449
INamingServiceTable(coral::ISchema &schema)
std::string poolSchemaVersion()
static IDatabaseSchema * createSchemaHandle(coral::ISchema &schema)
static std::string emptyScope()
static bool existsMainTable(coral::ISchema &dbSchema)
coral::ISchema & storageSchema()
IDatabaseSchema(coral::ISchema &schema)
IMainTable(coral::ISchema &schema)
#define table(NAME)
Definition: DbCore.h:49
IDatabaseTable(coral::ISchema &schema)
ContainerHeaderData & operator=(const ContainerHeaderData &rhs)
coral::ISchema & schema()
static bool existsMainTable(coral::ISchema &dbSchema)
ISequenceTable(coral::ISchema &schema)
MappingRawElement & operator==(const MappingRawElement &rhs)
virtual void setAccessPermission(const std::string &principal, bool forWrite)
std::string className(const T &t)
Definition: ClassName.h:30