CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OraDatabaseSchema.cc
Go to the documentation of this file.
2 #include "OraDatabaseSchema.h"
3 //
4 #include <memory>
5 // externals
6 #include "RelationalAccess/ISchema.h"
7 #include "RelationalAccess/ITable.h"
8 #include "RelationalAccess/IQuery.h"
9 #include "RelationalAccess/ICursor.h"
10 #include "RelationalAccess/TableDescription.h"
11 #include "RelationalAccess/ITablePrivilegeManager.h"
12 #include "RelationalAccess/ITableDataEditor.h"
13 #include "RelationalAccess/IBulkOperation.h"
14 #include "CoralBase/Attribute.h"
15 
17  static std::string s_version("V1.0");
18  return s_version;
19 }
20 
22  static std::string s_name("ORA_DB");
23  return s_name;
24 }
25 
27  static std::string s_column("PARAMETER_NAME");
28  return s_column;
29 }
30 
32  static std::string s_column("PARAMETER_VALUE");
33  return s_column;
34 }
35 
36 ora::OraMainTable::OraMainTable( coral::ISchema& dbSchema ):
37  m_schema( dbSchema ){
38 }
39 
41 }
42 
43 bool ora::OraMainTable::getParameters( std::map<std::string,std::string>& dest ){
44  bool ret = false;
45  coral::ITable& mainTable = m_schema.tableHandle( tableName() );
46  std::auto_ptr<coral::IQuery> query(mainTable.newQuery());
47  coral::ICursor& cursor = query->execute();
48  while ( cursor.next() ) {
49  ret = true;
50  const coral::AttributeList& row = cursor.currentRow();
51  std::string paramName = row[ parameterNameColumn()].data< std::string >();
52  std::string paramValue = row[ parameterValueColumn()].data< std::string >();
53  dest.insert( std::make_pair( paramName, paramValue ) );
54  }
55  return ret;
56 }
57 
59  // could be replaced by a call to getParameters in case of needs to distinguish between ora db schema versions...
60  return version();
61 }
62 
64  return m_schema.existsTable( tableName() );
65 }
66 
68  if( m_schema.existsTable( tableName() )){
69  throwException( "ORA database main table already exists in this schema.",
70  "OraMainTable::create");
71  }
72 
73  coral::TableDescription descr( "OraDb" );
74  descr.setName( tableName() );
75  descr.insertColumn( parameterNameColumn(),
76  coral::AttributeSpecification::typeNameForType<std::string>() );
77  descr.insertColumn( parameterValueColumn(),
78  coral::AttributeSpecification::typeNameForType<std::string>() );
79  descr.setNotNullConstraint( parameterNameColumn() );
80  descr.setNotNullConstraint( parameterValueColumn() );
81  descr.setPrimaryKey( std::vector<std::string>( 1, parameterNameColumn() ) );
82 
83  coral::ITable& table = m_schema.createTable( descr );
84  table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
85 
86  coral::AttributeList dataToInsert;
87  dataToInsert.extend<std::string>( parameterNameColumn());
88  dataToInsert.extend<std::string>( parameterValueColumn());
89  dataToInsert[ parameterNameColumn() ].data<std::string>() = IMainTable::versionParameterName();
90  dataToInsert[ parameterValueColumn() ].data<std::string>() = version();
91  table.dataEditor().insertRow( dataToInsert );
92 }
93 
95  m_schema.dropIfExistsTable( tableName() );
96 }
97 
99  static std::string s_name("ORA_SEQUENCE");
100  return s_name;
101 }
102 
104  static std::string s_column("NAME");
105  return s_column;
106 }
107 
109  static std::string s_column("VALUE");
110  return s_column;
111 }
112 
114  m_schema( schema){
115 }
116 
118 }
119 
120 bool
121 ora::OraSequenceTable::add( const std::string& sequenceName ){
122  // Create the entry in the table
123  coral::AttributeList insertData;
124  insertData.extend<std::string>(sequenceNameColumn());
125  insertData.extend<int>(sequenceValueColumn());
126  coral::AttributeList::iterator iAttribute = insertData.begin();
127  iAttribute->data< std::string >() = sequenceName;
128  ++iAttribute;
129  iAttribute->data< int >() = 0;
130  m_schema.tableHandle( tableName() ).dataEditor().insertRow( insertData );
131  return true;
132 }
133 
134 bool
135 ora::OraSequenceTable::getLastId( const std::string& sequenceName,
136  int& lastId ) {
137  std::auto_ptr< coral::IQuery > query( m_schema.tableHandle( tableName() ).newQuery() );
138  query->limitReturnedRows( 1, 0 );
139  query->addToOutputList( sequenceValueColumn() );
140  query->defineOutputType( sequenceValueColumn(), coral::AttributeSpecification::typeNameForType<int>() );
141  query->setForUpdate();
142  std::string whereClause( sequenceNameColumn() + " = :" + sequenceNameColumn() );
143  coral::AttributeList rowData;
144  rowData.extend<std::string>(sequenceNameColumn());
145  rowData.begin()->data< std::string >() = sequenceName;
146  query->setCondition( whereClause, rowData );
147  coral::ICursor& cursor = query->execute();
148  if ( cursor.next() ) {
149  lastId = cursor.currentRow().begin()->data<int >();
150  return true;
151  }
152  return false;
153 }
154 
155 void ora::OraSequenceTable::sinchronize( const std::string& sequenceName,
156  int lastValue ){
157  coral::AttributeList updateData;
158  updateData.extend<std::string>(sequenceNameColumn());
159  updateData.extend<int>(sequenceValueColumn());
160  std::string setClause( sequenceValueColumn() + " = :" + sequenceValueColumn() );
161  std::string whereClause( sequenceNameColumn() + " = :" + sequenceNameColumn() );
162  // Increment the oid in the database as well
163  coral::AttributeList::iterator iAttribute = updateData.begin();
164  iAttribute->data< std::string >() = sequenceName;
165  ++iAttribute;
166  iAttribute->data< int >() = lastValue;
167  m_schema.tableHandle( tableName() ).dataEditor().updateRows( setClause,whereClause,updateData );
168 }
169 
170 void ora::OraSequenceTable::erase( const std::string& name ){
171  coral::AttributeList whereData;
172  whereData.extend<std::string>(sequenceNameColumn());
173  whereData[ sequenceNameColumn() ].data<std::string>() = name;
174  std::string whereClause( sequenceNameColumn() + " = :" + sequenceNameColumn() );
175  m_schema.tableHandle( tableName() ).dataEditor().deleteRows( whereClause, whereData );
176 }
177 
179  return m_schema.existsTable( tableName() );
180 }
181 
183  if( m_schema.existsTable( tableName() )){
184  throwException( "ORA database sequence table already exists in this schema.",
185  "OraSequenceTable::create");
186  }
187 
188  coral::TableDescription description( "OraDb" );
189  description.setName( tableName() );
190 
191  description.insertColumn( sequenceNameColumn(), coral::AttributeSpecification::typeNameForType<std::string>() );
192  description.setNotNullConstraint( sequenceNameColumn() );
193 
194  description.insertColumn( sequenceValueColumn(),coral::AttributeSpecification::typeNameForType<int>() );
195  description.setNotNullConstraint( sequenceValueColumn() );
196 
197  description.setPrimaryKey( std::vector< std::string >( 1, sequenceNameColumn() ) );
198  m_schema.createTable( description ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
199 }
200 
202  m_schema.dropIfExistsTable( tableName() );
203 }
204 
206  static std::string s_table("ORA_MAPPING_VERSION");
207  return s_table;
208 }
209 
211  static std::string s_col("MAPPING_VERSION");
212  return s_col;
213 }
214 
216  m_schema( dbSchema ){
217 }
218 
220 }
221 
223  return m_schema.existsTable( tableName() );
224 }
225 
227  if( m_schema.existsTable( tableName() )){
228  throwException( "ORA database mapping version table already exists in this schema.",
229  "OraMappingVersionTable::create");
230  }
231  // version table
232  coral::TableDescription description0( "OraDb" );
233  description0.setName( tableName() );
234  description0.insertColumn( mappingVersionColumn(),
235  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false);
236  description0.setNotNullConstraint( mappingVersionColumn() );
237  description0.setPrimaryKey( mappingVersionColumn() );
238  m_schema.createTable( description0 ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
239 }
240 
242  m_schema.dropIfExistsTable( tableName() );
243 }
244 
245 
247  static std::string s_table("ORA_MAPPING_ELEMENT");
248  return s_table;
249 }
250 
252  static std::string s_col("MAPPING_VERSION");
253  return s_col;
254 }
255 
257  static std::string s_col("ELEMENT_ID");
258  return s_col;
259 }
260 
262  static std::string s_col("ELEMENT_TYPE");
263  return s_col;
264 }
265 
267  static std::string s_col("VARIABLE_SCOPE");
268  return s_col;
269 }
270 
272  static std::string s_col("VARIABLE_NAME");
273  return s_col;
274 }
275 
277  static std::string s_col("VARIABLE_PAR_INDEX");
278  return s_col;
279 }
280 
282  static std::string s_col("VARIABLE_TYPE");
283  return s_col;
284 
285 }
286 
288  static std::string s_col("TABLE_NAME");
289  return s_col;
290 }
291 
293  static std::string s_col("COLUMN_NAME");
294  return s_col;
295 }
296 
298  m_schema( dbSchema ){
299 }
300 
302 }
303 
305  return m_schema.existsTable( tableName() );
306 }
307 
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 }
353 
355  m_schema.dropIfExistsTable( tableName() );
356 }
357 
359  static std::string s_name("ORA_CONTAINER");
360  return s_name;
361 }
362 
363 
365  static std::string s_column("CONTAINER_ID");
366  return s_column;
367 }
368 
369 
371  static std::string s_column("CONTAINER_NAME");
372  return s_column;
373 }
374 
376  static std::string s_column("CLASS_NAME");
377  return s_column;
378 }
379 
381  static std::string s_column("NUMBER_OF_OBJECTS");
382  return s_column;
383 }
384 
386  m_schema(dbSchema){
387 }
388 
390 }
391 
394  bool ret = false;
395  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
396  std::auto_ptr<coral::IQuery> query( containerTable.newQuery());
397  coral::AttributeList outputBuffer;
398  outputBuffer.extend<int>( containerIdColumn() );
399  outputBuffer.extend<std::string>( containerNameColumn() );
400  outputBuffer.extend<std::string>( classNameColumn() );
401  outputBuffer.extend<unsigned int>( numberOfObjectsColumn() );
402  query->defineOutput( outputBuffer );
403  coral::ICursor& cursor = query->execute();
404  while ( cursor.next() ) {
405  ret = true;
406  const coral::AttributeList& row = cursor.currentRow();
407  int containerId = row[ containerIdColumn() ].data< int >();
408  std::string containerName = row[ containerNameColumn()].data< std::string >();
409  std::string className = row[ classNameColumn()].data< std::string >();
410  unsigned int numberOfObjects = row[ numberOfObjectsColumn()].data< unsigned int >();
411  dest.insert( std::make_pair( containerName, ContainerHeaderData( containerId, className, numberOfObjects ) )) ;
412  }
413  return ret;
414 }
415 
417  const std::string& containerName,
418  const std::string& className ){
419  coral::AttributeList dataToInsert;
420  unsigned int numberOfObjects = 0;
421  dataToInsert.extend<int>( containerIdColumn());
422  dataToInsert.extend<std::string>( containerNameColumn());
423  dataToInsert.extend<std::string>( classNameColumn());
424  dataToInsert.extend<unsigned int>( numberOfObjectsColumn());
425  dataToInsert[ containerIdColumn() ].data<int>() = containerId;
426  dataToInsert[ containerNameColumn() ].data<std::string>() = containerName;
427  dataToInsert[ classNameColumn() ].data<std::string>() = className;
428  dataToInsert[ numberOfObjectsColumn() ].data<unsigned int>() = numberOfObjects;
429  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
430  containerTable.dataEditor().insertRow( dataToInsert );
431 }
432 
434  std::stringstream whereClause;
435  whereClause << containerIdColumn() << "= :" <<containerIdColumn();
436  coral::AttributeList whereData;
437  whereData.extend< int >( containerIdColumn() );
438  whereData.begin()->data< int >() = id;
439  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
440  containerTable.dataEditor().deleteRows(whereClause.str(),whereData);
441 }
442 
444  const std::string& setClause ){
445  std::stringstream whereClause;
446  whereClause << containerIdColumn() << "= :" <<containerIdColumn();
447  coral::AttributeList updateData;
448  updateData.extend<int>( containerIdColumn() );
449  updateData.begin()->data<int>() = containerId;
450  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
451  containerTable.dataEditor().updateRows(setClause,whereClause.str(),updateData);
452 }
453 
455  std::stringstream setClause;
456  setClause << numberOfObjectsColumn() << " = " <<numberOfObjectsColumn() << " + 1";
457  return updateContainer( containerId, setClause.str() );
458 }
459 
461  std::stringstream setClause;
462  setClause << numberOfObjectsColumn() << " = " <<numberOfObjectsColumn() << " - 1";
463  return updateContainer( containerId, setClause.str() );
464 }
465 
466 void ora::OraContainerHeaderTable::updateNumberOfObjects( const std::map<int,unsigned int>& numberOfObjectsForContainerIds ){
467  if( numberOfObjectsForContainerIds.size() ){
468 
469  std::stringstream whereClause;
470  whereClause << containerIdColumn() << "= :" <<containerIdColumn();
471  std::stringstream setClause;
472  setClause << numberOfObjectsColumn() << " = :" <<numberOfObjectsColumn();
473  coral::AttributeList updateData;
474  updateData.extend<unsigned int>( numberOfObjectsColumn() );
475  updateData.extend<int>( containerIdColumn() );
476 
477  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
478  std::auto_ptr<coral::IBulkOperation> bulkUpdate( containerTable.dataEditor().bulkUpdateRows( setClause.str(), whereClause.str(), updateData,(int)numberOfObjectsForContainerIds.size()));
479 
480  for( std::map<int,unsigned int>::const_iterator iCont = numberOfObjectsForContainerIds.begin();
481  iCont != numberOfObjectsForContainerIds.end(); ++iCont ){
482  updateData[containerIdColumn()].data<int>() = iCont->first;
483  updateData[numberOfObjectsColumn()].data<unsigned int>() = iCont->second;
484  bulkUpdate->processNextIteration();
485  }
486  bulkUpdate->flush();
487  }
488 }
489 
491  return m_schema.existsTable( tableName() );
492 }
493 
495  if( m_schema.existsTable( tableName() )){
496  throwException( "ORA database container header table already exists in this schema.",
497  "OraContainerHeaderTable::create");
498  }
499 
500  coral::TableDescription descr( "OraDb" );
501  descr.setName( tableName() );
502  descr.insertColumn( containerIdColumn(),
503  coral::AttributeSpecification::typeNameForType<int>() );
504  descr.insertColumn( containerNameColumn(),
505  coral::AttributeSpecification::typeNameForType<std::string>() );
506  descr.insertColumn( classNameColumn(),
507  coral::AttributeSpecification::typeNameForType<std::string>() );
508  descr.insertColumn( numberOfObjectsColumn(),
509  coral::AttributeSpecification::typeNameForType<unsigned int>() );
510  descr.setNotNullConstraint( containerIdColumn() );
511  descr.setNotNullConstraint( containerNameColumn() );
512  descr.setNotNullConstraint( classNameColumn() );
513  descr.setNotNullConstraint( numberOfObjectsColumn() );
514  descr.setPrimaryKey( std::vector<std::string>( 1, containerIdColumn() ) );
515  descr.setUniqueConstraint( containerNameColumn() );
516  coral::ITable& table = m_schema.createTable( descr );
517  table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
518 }
519 
521  m_schema.dropIfExistsTable( tableName() );
522 }
523 
525  static std::string s_table("ORA_CLASS_VERSION");
526  return s_table;
527 }
528 
530  static std::string s_col("CLASS_NAME");
531  return s_col;
532 }
533 
535  static std::string s_col("CLASS_VERSION");
536  return s_col;
537 }
538 
540  static std::string s_col("CLASS_ID");
541  return s_col;
542 }
543 
545  static std::string s_col("DEPENDENCY_INDEX");
546  return s_col;
547 }
548 
550  static std::string s_col("CONTAINER_ID");
551  return s_col;
552 
553 }
554 
556  static std::string s_col("MAPPING_VERSION");
557  return s_col;
558 }
559 
560 
562  m_schema( dbSchema ){
563 }
564 
566 }
567 
569  return m_schema.existsTable( tableName() );
570 }
571 
573  if( m_schema.existsTable( tableName() )){
574  throwException( "ORA database class version table already exists in this schema.",
575  "OraClassVersionTable::create");
576  }
577  // class version table
578  coral::TableDescription description1( "OraDb" );
579  description1.setName( tableName() );
580  description1.insertColumn( classNameColumn(),
581  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false);
582  description1.setNotNullConstraint( classNameColumn() );
583  description1.insertColumn( classVersionColumn(),
584  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false);
585  description1.setNotNullConstraint( classVersionColumn() );
586  description1.insertColumn( classIdColumn(),
587  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false);
588  description1.setNotNullConstraint( classIdColumn() );
589  description1.insertColumn( dependencyIndexColumn(),
590  coral::AttributeSpecification::typeNameForType<int>() );
591  description1.setNotNullConstraint( dependencyIndexColumn() );
592  description1.insertColumn( containerIdColumn(),
593  coral::AttributeSpecification::typeNameForType<int>() );
594  description1.setNotNullConstraint( containerIdColumn() );
595  description1.insertColumn( mappingVersionColumn(),
596  coral::AttributeSpecification::typeNameForType<std::string>(), 1000, false);
597  description1.setNotNullConstraint( mappingVersionColumn() );
598  std::vector<std::string> cols1;
599  cols1.push_back( classIdColumn() );
600  cols1.push_back( containerIdColumn() );
601  description1.setPrimaryKey( cols1 );
602  std::string fk10Name = mappingVersionColumn()+"_FK10";
603  description1.createForeignKey( fk10Name, mappingVersionColumn(),
605  std::string fk11Name = containerIdColumn()+"_FK11";
606  description1.createForeignKey( fk11Name, containerIdColumn(),
608  m_schema.createTable( description1 ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
609 }
610 
612  m_schema.dropIfExistsTable( tableName() );
613 }
614 
615 ora::OraMappingSchema::OraMappingSchema( coral::ISchema& dbSchema ):
616  m_schema( dbSchema ){
617 }
618 
620 }
621 
622 bool ora::OraMappingSchema::getVersionList( std::set<std::string>& dest ){
623  bool ret = false;
624  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingVersionTable::tableName() ).newQuery() );
626  coral::ICursor& cursor = query->execute();
627  while ( cursor.next() ) {
628  ret = true;
629  const coral::AttributeList& currentRow = cursor.currentRow();
630  std::string mappingVersion = currentRow[ OraMappingVersionTable::mappingVersionColumn()].data<std::string>();
631  dest.insert( mappingVersion );
632  }
633  return ret;
634 }
635 
638  bool ret = false;
639  coral::ITable& mappingTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
640  std::auto_ptr<coral::IQuery> query(mappingTable.newQuery());
641  coral::AttributeList outputBuffer;
642  outputBuffer.extend<int>( OraMappingElementTable::elementIdColumn() );
643  outputBuffer.extend<std::string>( OraMappingElementTable::elementTypeColumn() );
644  outputBuffer.extend<std::string>( OraMappingElementTable::scopeNameColumn() );
645  outputBuffer.extend<std::string>( OraMappingElementTable::variableNameColumn() );
646  outputBuffer.extend<std::string>( OraMappingElementTable::variableTypeColumn() );
647  outputBuffer.extend<std::string>( OraMappingElementTable::tableNameColumn() );
648  outputBuffer.extend<std::string>( OraMappingElementTable::columnNameColumn() );
649  query->defineOutput( outputBuffer );
650  query->addToOutputList( OraMappingElementTable::elementIdColumn() );
651  query->addToOutputList( OraMappingElementTable::elementTypeColumn() );
652  query->addToOutputList( OraMappingElementTable::scopeNameColumn() );
655  query->addToOutputList( OraMappingElementTable::tableNameColumn() );
656  query->addToOutputList( OraMappingElementTable::columnNameColumn() );
657  std::ostringstream condition;
659  coral::AttributeList condData;
660  condData.extend<std::string>( OraMappingElementTable::mappingVersionColumn() );
661  coral::AttributeList::iterator iAttribute = condData.begin();
662  iAttribute->data< std::string >() = version;
663  query->setCondition( condition.str(), condData );
664  query->addToOrderList( OraMappingElementTable::scopeNameColumn() );
667  coral::ICursor& cursor = query->execute();
668  while ( cursor.next() ) {
669  ret = true;
670  const coral::AttributeList& currentRow = cursor.currentRow();
671  int elementId = currentRow[ OraMappingElementTable::elementIdColumn() ].data<int>();
672  MappingRawElement& elem = dest.addElement( elementId );
673  elem.elementType = currentRow[ OraMappingElementTable::elementTypeColumn() ].data<std::string>();
674  elem.scopeName = currentRow[ OraMappingElementTable::scopeNameColumn() ].data<std::string>();
675  elem.variableName = currentRow[ OraMappingElementTable::variableNameColumn() ].data<std::string>();
676  elem.variableType = currentRow[ OraMappingElementTable::variableTypeColumn() ].data<std::string>();
677  elem.tableName = currentRow[ OraMappingElementTable::tableNameColumn() ].data<std::string>();
678  elem.columns.push_back( currentRow[ OraMappingElementTable::columnNameColumn() ].data<std::string>() );
679  }
680  return ret;
681 }
682 
684  // first update the version table
685  coral::ITable& mappingVersionTable = m_schema.tableHandle( OraMappingVersionTable::tableName() );
686  coral::AttributeList rowBuffer;
687  rowBuffer.extend< std::string >( OraMappingVersionTable::mappingVersionColumn() );
688  rowBuffer[ OraMappingVersionTable::mappingVersionColumn() ].data<std::string>()= mapping.version;
689  mappingVersionTable.dataEditor().insertRow( rowBuffer );
690 
691  // then update the element tables
692  coral::ITable& mappingElementTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
693  coral::AttributeList dataBuffer;
694  dataBuffer.extend< std::string >( OraMappingElementTable::mappingVersionColumn() );
695  dataBuffer.extend< int >( OraMappingElementTable::elementIdColumn() );
696  dataBuffer.extend< std::string >( OraMappingElementTable::elementTypeColumn() );
697  dataBuffer.extend< std::string >( OraMappingElementTable::scopeNameColumn() );
698  dataBuffer.extend< std::string >( OraMappingElementTable::variableNameColumn() );
699  dataBuffer.extend< unsigned int >( OraMappingElementTable::variableParIndexColumn() );
700  dataBuffer.extend< std::string >( OraMappingElementTable::variableTypeColumn() );
701  dataBuffer.extend< std::string >( OraMappingElementTable::tableNameColumn() );
702  dataBuffer.extend< std::string >( OraMappingElementTable::columnNameColumn() );
703  dataBuffer[ OraMappingElementTable::mappingVersionColumn() ].data<std::string>()= mapping.version;
704 
705  for( std::map < int, MappingRawElement >::const_iterator iElem = mapping.elements.begin();
706  iElem != mapping.elements.end(); iElem++ ){
707  for( size_t iParamIndex = 0; iParamIndex < iElem->second.columns.size(); iParamIndex++ ){
708  dataBuffer[ OraMappingElementTable::elementIdColumn() ].data<int>() = iElem->first;
709  dataBuffer[ OraMappingElementTable::elementTypeColumn()].data<std::string>()= iElem->second.elementType;
710  dataBuffer[ OraMappingElementTable::scopeNameColumn() ].data<std::string>()= iElem->second.scopeName;
711  dataBuffer[ OraMappingElementTable::variableNameColumn() ].data<std::string>()= iElem->second.variableName;
712  dataBuffer[ OraMappingElementTable::variableParIndexColumn() ].data<unsigned int>() = iParamIndex;
713  dataBuffer[ OraMappingElementTable::variableTypeColumn() ].data<std::string>()= iElem->second.variableType;
714  dataBuffer[ OraMappingElementTable::tableNameColumn() ].data<std::string>()= iElem->second.tableName;
715  dataBuffer[ OraMappingElementTable::columnNameColumn() ].data<std::string>()= iElem->second.columns[iParamIndex];
716  mappingElementTable.dataEditor().insertRow( dataBuffer );
717  }
718  }
719 }
720 
722  // Remove all rows in the tables with the version.
723  coral::AttributeList whereData;
724  whereData.extend<std::string>( OraMappingVersionTable::mappingVersionColumn() );
725  whereData.begin()->data<std::string>() = version;
726 
728  m_schema.tableHandle( OraClassVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
729  m_schema.tableHandle( OraMappingElementTable::tableName() ).dataEditor().deleteRows( condition, whereData );
730  m_schema.tableHandle( OraMappingVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
731 }
732 
733 bool ora::OraMappingSchema::getContainerTableMap( std::map<std::string, int>& dest ){
734  bool ret = false;
735  std::auto_ptr<coral::IQuery> query(m_schema.newQuery());
736  query->addToTableList( OraMappingElementTable::tableName(),"T0");
737  query->addToTableList( OraClassVersionTable::tableName(), "T1");
738  query->setDistinct();
739  query->addToOutputList( "T0."+ OraMappingElementTable::tableNameColumn() );
740  query->addToOutputList( "T1."+ OraClassVersionTable::containerIdColumn());
741  std::ostringstream condition;
743  coral::AttributeList condData;
744  query->setCondition(condition.str(),condData);
745  coral::ICursor& cursor = query->execute();
746  while ( cursor.next() ) {
747  ret = true;
748  const coral::AttributeList& currentRow = cursor.currentRow();
749  std::string tableName = currentRow[ "T0."+ OraMappingElementTable::tableNameColumn()].data<std::string>();
750  int containerId = currentRow[ "T1."+ OraClassVersionTable::containerIdColumn()].data<int>();
751  dest.insert(std::make_pair(tableName,containerId));
752  }
753  return ret;
754 }
755 
782  std::set<std::string>& destination ){
783  bool ret = false;
784  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
785  query->setDistinct();
786  query->addToOutputList( OraClassVersionTable::classNameColumn() );
787  std::ostringstream condition;
789  condition << " AND "<< OraClassVersionTable::dependencyIndexColumn()<<" > 0";
790  coral::AttributeList condData;
791  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
792  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
793  query->setCondition(condition.str(),condData);
794  coral::ICursor& cursor = query->execute();
795  while ( cursor.next() ) {
796  ret = true;
797  const coral::AttributeList& currentRow = cursor.currentRow();
798  std::string className = currentRow[ OraClassVersionTable::classNameColumn() ].data<std::string>();
799  destination.insert( className );
800  }
801  return ret;
802 }
803 
804 bool ora::OraMappingSchema::getClassVersionListForMappingVersion( const std::string& mappingVersion,
805  std::set<std::string>& destination ){
806 
807  bool ret = false;
808  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
809  query->setDistinct();
810  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
811  std::ostringstream condition;
813  coral::AttributeList condData;
814  condData.extend< std::string >( OraClassVersionTable::mappingVersionColumn() );
815  condData[ OraClassVersionTable::mappingVersionColumn() ].data< std::string >() = mappingVersion;
816  query->setCondition(condition.str(),condData);
817  coral::ICursor& cursor = query->execute();
818  while ( cursor.next() ) {
819  ret = true;
820  const coral::AttributeList& currentRow = cursor.currentRow();
821  std::string classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
822  destination.insert( classVersion );
823  }
824  return ret;
825 }
826 
828  std::set<std::string>& dest,
829  bool onlyDependency ){
830  bool ret = false;
831  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
832  query->setDistinct();
834  std::ostringstream condition;
836  coral::AttributeList condData;
837  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
838  if( onlyDependency ){
839  condition << " AND "<<OraClassVersionTable::dependencyIndexColumn()<<" > 0";
840  }
841  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
842  query->setCondition(condition.str(),condData);
843  coral::ICursor& cursor = query->execute();
844  while ( cursor.next() ) {
845  ret = true;
846  const coral::AttributeList& currentRow = cursor.currentRow();
847  std::string mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
848  dest.insert( mappingVersion );
849  }
850  return ret;
851 }
852 
854  std::map<std::string,std::string>& versionMap ){
855  bool ret = false;
856  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
857  query->setDistinct();
858  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
860  std::ostringstream condition;
862  coral::AttributeList condData;
863  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
864  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
865  query->setCondition(condition.str(),condData);
866  coral::ICursor& cursor = query->execute();
867  while ( cursor.next() ) {
868  ret = true;
869  const coral::AttributeList& currentRow = cursor.currentRow();
870  std::string classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
871  std::string mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
872  versionMap.insert( std::make_pair(classVersion,mappingVersion ) );
873  }
874  return ret;
875 }
876 
877 bool ora::OraMappingSchema::getMappingVersionListForTable( const std::string& tableName,
878  std::set<std::string>& destination )
879 {
880  bool ret = false;
881  destination.clear();
882  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingElementTable::tableName() ).newQuery() );
883  query->setDistinct();
885  std::ostringstream condition;
887  coral::AttributeList condData;
888  condData.extend< std::string >( OraMappingElementTable::tableNameColumn() );
889  condData.begin()->data<std::string>() = tableName;
890  query->setCondition(condition.str(),condData);
891  coral::ICursor& cursor = query->execute();
892  while ( cursor.next() ) {
893  ret = true;
894  const coral::AttributeList& currentRow = cursor.currentRow();
895  std::string mappingVersion = currentRow[ OraMappingElementTable::mappingVersionColumn()].data<std::string>();
896  destination.insert( mappingVersion );
897  }
898  return ret;
899 }
900 
901 bool ora::OraMappingSchema::selectMappingVersion( const std::string& classId,
902  int containerId,
903  std::string& destination ){
904  bool ret = false;
905  destination.clear();
906  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
908  std::ostringstream condition;
909  condition << OraClassVersionTable::classIdColumn() << " =:" << OraClassVersionTable::classIdColumn() << " AND ";
911  coral::AttributeList condData;
912  condData.extend<std::string>( OraClassVersionTable::classIdColumn() );
913  condData.extend<int>( OraClassVersionTable::containerIdColumn() );
914  coral::AttributeList::iterator iAttribute = condData.begin();
915  iAttribute->data< std::string >() = classId;
916  ++iAttribute;
917  iAttribute->data< int >() = containerId;
918  query->setCondition( condition.str(), condData );
919  coral::ICursor& cursor = query->execute();
920  while ( cursor.next() ) {
921  ret = true;
922  const coral::AttributeList& currentRow = cursor.currentRow();
923  destination = currentRow[OraClassVersionTable::mappingVersionColumn()].data<std::string>();
924  }
925  return ret;
926 }
927 
928 bool ora::OraMappingSchema::containerForMappingVersion( const std::string& mappingVersion,
929  int& destination ){
930  bool ret = false;
931  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
932  query->addToOutputList( OraClassVersionTable::containerIdColumn() );
933  std::ostringstream condition;
935  coral::AttributeList condData;
936  condData.extend<std::string>( OraClassVersionTable::mappingVersionColumn() );
937  coral::AttributeList::iterator iAttribute = condData.begin();
938  iAttribute->data< std::string >() = mappingVersion;
939  query->setCondition( condition.str(), condData );
940  coral::ICursor& cursor = query->execute();
941  while ( cursor.next() ) {
942  ret = true;
943  const coral::AttributeList& currentRow = cursor.currentRow();
944  destination = currentRow[ OraClassVersionTable::containerIdColumn() ].data<int>();
945  }
946  return ret;
947 }
948 
950  const std::string& classVersion,
951  const std::string& classId,
952  int dependencyIndex,
953  int containerId,
954  const std::string& mappingVersion ){
955  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
956  coral::AttributeList inputData;
957  inputData.extend<std::string>( OraClassVersionTable::mappingVersionColumn());
958  inputData.extend<std::string>( OraClassVersionTable::classNameColumn());
959  inputData.extend<std::string>( OraClassVersionTable::classVersionColumn());
960  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
961  inputData.extend<int>( OraClassVersionTable::dependencyIndexColumn());
962  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
963  coral::AttributeList::iterator iInAttr = inputData.begin();
964  iInAttr->data< std::string >() = mappingVersion;
965  ++iInAttr;
966  iInAttr->data< std::string >() = className;
967  ++iInAttr;
968  iInAttr->data< std::string >() = classVersion;
969  ++iInAttr;
970  iInAttr->data< std::string >() = classId;
971  ++iInAttr;
972  iInAttr->data< int >() = dependencyIndex;
973  ++iInAttr;
974  iInAttr->data< int >() = containerId;
975  classVersionTable.dataEditor().insertRow( inputData );
976 }
977 
978 void ora::OraMappingSchema::setMappingVersion( const std::string& classId,
979  int containerId,
980  const std::string& mappingVersion ){
981  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
982  coral::AttributeList inputData;
983  inputData.extend<std::string>( OraClassVersionTable::mappingVersionColumn());
984  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
985  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
986  coral::AttributeList::iterator iInAttr = inputData.begin();
987  iInAttr->data< std::string >() = mappingVersion;
988  ++iInAttr;
989  iInAttr->data< std::string >() = classId;
990  ++iInAttr;
991  iInAttr->data< int >() = containerId;
993  std::string whereClause = OraClassVersionTable::classIdColumn()+" =:"+ OraClassVersionTable::classIdColumn()+" AND "+
995  classVersionTable.dataEditor().updateRows( setClause,whereClause, inputData );
996 }
997 
998 bool ora::OraDatabaseSchema::existsMainTable( coral::ISchema& dbSchema ){
999  OraMainTable tmp( dbSchema );
1000  return tmp.exists();
1001 }
1002 
1004  static std::string s_table("ORA_NAMING_SERVICE" );
1005  return s_table;
1006 }
1007 
1009  static std::string s_column("OBJECT_NAME");
1010  return s_column;
1011 }
1012 
1014  static std::string s_column("CONTAINER_ID");
1015  return s_column;
1016 }
1017 
1019  static std::string s_column("ITEM_ID");
1020  return s_column;
1021 }
1022 
1023 ora::OraNamingServiceTable::OraNamingServiceTable( coral::ISchema& dbSchema ): m_schema( dbSchema ){
1024 }
1025 
1027 }
1028 
1030  return m_schema.existsTable( tableName() );
1031 }
1032 
1034  if( m_schema.existsTable( tableName() )){
1035  throwException( "ORA naming service table already exists in this schema.",
1036  "OraNameTable::create");
1037  }
1038 
1039  coral::TableDescription descr( "OraDb" );
1040  descr.setName( tableName() );
1041  descr.insertColumn( objectNameColumn(),
1042  coral::AttributeSpecification::typeNameForType<std::string>() );
1043  descr.insertColumn( containerIdColumn(),
1044  coral::AttributeSpecification::typeNameForType<int>() );
1045  descr.insertColumn( itemIdColumn(),
1046  coral::AttributeSpecification::typeNameForType<int>() );
1047  descr.setNotNullConstraint( objectNameColumn() );
1048  descr.setNotNullConstraint( containerIdColumn() );
1049  descr.setNotNullConstraint( itemIdColumn() );
1050  descr.setPrimaryKey( std::vector<std::string>( 1, objectNameColumn() ) );
1051 
1052  coral::ITable& table = m_schema.createTable( descr );
1053  table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
1054 }
1055 
1057  m_schema.dropIfExistsTable( tableName() );
1058 }
1059 
1061  int contId,
1062  int itemId ){
1063  coral::AttributeList dataToInsert;
1064  dataToInsert.extend<std::string>( objectNameColumn() );
1065  dataToInsert.extend<int>( containerIdColumn());
1066  dataToInsert.extend<int>( itemIdColumn());
1067  dataToInsert[ objectNameColumn() ].data<std::string>() = name;
1068  dataToInsert[ containerIdColumn() ].data<int>() = contId;
1069  dataToInsert[ itemIdColumn() ].data<int>() = itemId;
1070  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
1071  containerTable.dataEditor().insertRow( dataToInsert );
1072 }
1073 
1075  coral::AttributeList whereData;
1076  whereData.extend<std::string>( objectNameColumn() );
1077  whereData.begin()->data<std::string>() = name;
1078  std::string condition = objectNameColumn() + " = :" + objectNameColumn();
1079  return m_schema.tableHandle( tableName() ).dataEditor().deleteRows( condition, whereData )>0;
1080 }
1081 
1083  std::string condition("");
1084  coral::AttributeList whereData;
1085  return m_schema.tableHandle( tableName() ).dataEditor().deleteRows( condition, whereData )>0;
1086 }
1087 
1089  std::pair<int,int>& destination ){
1090  bool ret = false;
1091  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
1092  std::auto_ptr<coral::IQuery> query( containerTable.newQuery());
1093  coral::AttributeList outputBuffer;
1094  outputBuffer.extend<int>( containerIdColumn() );
1095  outputBuffer.extend<int>( itemIdColumn() );
1096  query->defineOutput( outputBuffer );
1097  query->addToOutputList( containerIdColumn() );
1098  query->addToOutputList( itemIdColumn() );
1099  std::ostringstream condition;
1100  condition << objectNameColumn()<<"= :"<< objectNameColumn();
1101  coral::AttributeList condData;
1102  condData.extend<std::string>( objectNameColumn() );
1103  coral::AttributeList::iterator iAttribute = condData.begin();
1104  iAttribute->data< std::string >() = name;
1105  query->setCondition( condition.str(), condData );
1106  coral::ICursor& cursor = query->execute();
1107  while ( cursor.next() ) {
1108  ret = true;
1109  const coral::AttributeList& row = cursor.currentRow();
1110  int containerId = row[ containerIdColumn() ].data< int >();
1111  int itemId = row[ itemIdColumn() ].data< int >();
1112  destination.first = containerId;
1113  destination.second = itemId;
1114  }
1115  return ret;
1116 }
1117 
1119  int itemId,
1120  std::vector<std::string>& destination ){
1121  bool ret = false;
1122  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
1123  std::auto_ptr<coral::IQuery> query( containerTable.newQuery());
1124  coral::AttributeList outputBuffer;
1125  outputBuffer.extend<std::string>( objectNameColumn() );
1126  query->defineOutput( outputBuffer );
1127  query->addToOutputList( objectNameColumn() );
1128  std::ostringstream condition;
1129  condition << containerIdColumn()<<"= :"<< containerIdColumn();
1130  condition << " AND ";
1131  condition << itemIdColumn()<<"= :"<< itemIdColumn();
1132  coral::AttributeList condData;
1133  condData.extend<int>( containerIdColumn() );
1134  condData.extend<int>( itemIdColumn() );
1135  coral::AttributeList::iterator iAttribute = condData.begin();
1136  iAttribute->data< int >() = contId;
1137  ++iAttribute;
1138  iAttribute->data< int >() = itemId;
1139  query->setCondition( condition.str(), condData );
1140  coral::ICursor& cursor = query->execute();
1141  while ( cursor.next() ) {
1142  ret = true;
1143  const coral::AttributeList& row = cursor.currentRow();
1144  std::string name = row[ objectNameColumn() ].data< std::string >();
1145  destination.push_back( name );
1146  }
1147  return ret;
1148 }
1149 
1151  std::vector<std::string>& destination ){
1152  bool ret = false;
1153  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
1154  std::auto_ptr<coral::IQuery> query( containerTable.newQuery());
1155  coral::AttributeList outputBuffer;
1156  outputBuffer.extend<std::string>( objectNameColumn() );
1157  query->defineOutput( outputBuffer );
1158  query->addToOutputList( objectNameColumn() );
1159  std::ostringstream condition;
1160  condition << containerIdColumn()<<"= :"<< containerIdColumn();
1161  coral::AttributeList condData;
1162  condData.extend<int>( containerIdColumn() );
1163  coral::AttributeList::iterator iAttribute = condData.begin();
1164  iAttribute->data< int >() = contId;
1165  query->setCondition( condition.str(), condData );
1166  coral::ICursor& cursor = query->execute();
1167  while ( cursor.next() ) {
1168  ret = true;
1169  const coral::AttributeList& row = cursor.currentRow();
1170  std::string name = row[ objectNameColumn() ].data< std::string >();
1171  destination.push_back( name );
1172  }
1173  return ret;
1174 }
1175 
1176 bool ora::OraNamingServiceTable::getAllNames( std::vector<std::string>& destination ){
1177  bool ret = false;
1178  coral::ITable& containerTable = m_schema.tableHandle( tableName() );
1179  std::auto_ptr<coral::IQuery> query( containerTable.newQuery());
1180  coral::AttributeList outputBuffer;
1181  outputBuffer.extend<std::string>( objectNameColumn() );
1182  query->defineOutput( outputBuffer );
1183  query->addToOutputList( objectNameColumn() );
1184  coral::ICursor& cursor = query->execute();
1185  while ( cursor.next() ) {
1186  ret = true;
1187  const coral::AttributeList& row = cursor.currentRow();
1188  std::string name = row[ objectNameColumn() ].data< std::string >();
1189  destination.push_back( name );
1190  }
1191  return ret;
1192 }
1193 
1194 ora::OraDatabaseSchema::OraDatabaseSchema( coral::ISchema& dbSchema ):
1195  IDatabaseSchema( dbSchema ),
1196  m_schema( dbSchema ),
1197  m_mainTable( dbSchema ),
1198  m_sequenceTable( dbSchema ),
1199  m_mappingVersionTable( dbSchema ),
1200  m_mappingElementTable( dbSchema ),
1201  m_containerHeaderTable( dbSchema ),
1202  m_classVersionTable( dbSchema ),
1203  m_mappingSchema( dbSchema ),
1204  m_namingServiceTable( dbSchema ){
1205 }
1206 
1208 }
1209 
1211  if(!m_mainTable.exists()){
1212  return false;
1213  }
1214  if(!m_sequenceTable.exists() ||
1215  !m_mappingVersionTable.exists() ||
1216  !m_mappingElementTable.exists() ||
1217  !m_containerHeaderTable.exists() ||
1218  !m_classVersionTable.exists() ||
1219  !m_namingServiceTable.exists()){
1220  throwException( "ORA database is corrupted..",
1221  "OraDatabaseSchema::exists");
1222  }
1223  return true;
1224 }
1225 
1227  m_mainTable.create();
1228  m_sequenceTable.create();
1229  m_mappingVersionTable.create();
1230  m_mappingElementTable.create();
1231  m_containerHeaderTable.create();
1232  m_classVersionTable.create();
1233  m_namingServiceTable.create();
1234 }
1235 
1237  m_namingServiceTable.drop();
1238  m_classVersionTable.drop();
1239  m_containerHeaderTable.drop();
1240  m_mappingElementTable.drop();
1241  m_mappingVersionTable.drop();
1242  m_sequenceTable.drop();
1243  m_mainTable.drop();
1244 }
1245 
1247  return m_mainTable;
1248 }
1249 
1251  return m_sequenceTable;
1252 }
1253 
1255  return m_mappingVersionTable;
1256 }
1257 
1259  return m_mappingElementTable;
1260 }
1261 
1263  return m_containerHeaderTable;
1264 }
1265 
1267  return m_classVersionTable;
1268 }
1269 
1271  return m_mappingSchema;
1272 }
1273 
1275  return m_namingServiceTable;
1276 }
1277 
1278 
static std::string versionParameterName()
list table
Definition: asciidump.py:386
void updateContainer(int id, const std::string &setClause)
static std::string classIdColumn()
void sinchronize(const std::string &sequenceName, int lastValue)
void setMappingVersion(const std::string &classId, int containerId, const std::string &mappingVersion)
OraDatabaseSchema(coral::ISchema &dbSchema)
MappingRawElement & addElement(int elementId)
bool getMapping(const std::string &version, MappingRawData &destination)
static std::string sequenceNameColumn()
bool getContainerTableMap(std::map< std::string, int > &destination)
void insertClassVersion(const std::string &className, const std::string &classVersion, const std::string &classId, int dependencyIndex, int containerId, const std::string &mappingVersion)
static std::string variableNameColumn()
void removeMapping(const std::string &version)
IDatabaseTable & mappingElementTable()
static std::string mappingVersionColumn()
std::map< int, MappingRawElement > elements
static std::string mappingVersionColumn()
bool getLastId(const std::string &sequenceName, int &lastId)
OraSequenceTable(coral::ISchema &dbSchema)
IDatabaseTable & classVersionTable()
static std::string containerNameColumn()
static std::string classNameColumn()
bool getNamesForObject(int contId, int itemId, std::vector< std::string > &destination)
static std::string tableName()
bool getClassVersionListForContainer(int containerId, std::map< std::string, std::string > &versionMap)
IMappingSchema & mappingSchema()
static std::string & tableName()
OraMappingElementTable(coral::ISchema &dbSchema)
static std::string tableName()
IContainerHeaderTable & containerHeaderTable()
static std::string classNameColumn()
OraClassVersionTable(coral::ISchema &dbSchema)
static std::string tableNameColumn()
std::string schemaVersion()
bool getContainerData(std::map< std::string, ContainerHeaderData > &destination)
bool getNamesForContainer(int contId, std::vector< std::string > &destination)
bool getParameters(std::map< std::string, std::string > &destination)
static std::string elementTypeColumn()
bool getClassVersionListForMappingVersion(const std::string &mappingVersion, std::set< std::string > &destination)
bool getVersionList(std::set< std::string > &destination)
OraMappingVersionTable(coral::ISchema &dbSchema)
static std::string tableName()
static std::string variableParIndexColumn()
static std::string tableName()
static std::string numberOfObjectsColumn()
INamingServiceTable & namingServiceTable()
static std::string sequenceValueColumn()
static std::string tableName()
ISequenceTable & sequenceTable()
void erase(const std::string &sequenceName)
static std::string tableName()
tuple description
Definition: idDealer.py:66
static std::string variableTypeColumn()
static std::string parameterNameColumn()
static bool existsMainTable(coral::ISchema &dbSchema)
static std::string classVersionColumn()
OraContainerHeaderTable(coral::ISchema &dbSchema)
OraNamingServiceTable(coral::ISchema &dbSchema)
bool getAllNames(std::vector< std::string > &destination)
bool eraseObjectName(const std::string &name)
bool getObjectByName(const std::string &name, std::pair< int, int > &destination)
static std::string mappingVersionColumn()
static std::string containerIdColumn()
bool getMappingVersionListForContainer(int containerId, std::set< std::string > &destination, bool onlyDependency=false)
static std::string dependencyIndexColumn()
void updateNumberOfObjects(const std::map< int, unsigned int > &numberOfObjectsForContainerIds)
bool getMappingVersionListForTable(const std::string &tableName, std::set< std::string > &destination)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static std::string & objectNameColumn()
bool containerForMappingVersion(const std::string &mappingVersion, int &destination)
static std::string scopeNameColumn()
tuple query
Definition: o2o.py:269
OraMappingSchema(coral::ISchema &dbSchema)
static std::string columnNameColumn()
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
bool add(const std::string &sequenceName)
IDatabaseTable & mappingVersionTable()
void setObjectName(const std::string &name, int contId, int itemId)
static std::string elementIdColumn()
void addContainer(int id, const std::string &containerName, const std::string &className)
bool selectMappingVersion(const std::string &classId, int containerId, std::string &destination)
void storeMapping(const MappingRawData &mapping)
static std::string & containerIdColumn()
static std::string version()
std::string className(const T &t)
Definition: ClassName.h:30
bool getDependentClassesInContainerMapping(int containerId, std::set< std::string > &destination)
tuple inputData
Definition: idDealer.py:72
static std::string & itemIdColumn()
static std::string parameterValueColumn()
OraMainTable(coral::ISchema &dbSchema)
static std::string containerIdColumn()