CMS 3D CMS Logo

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

#include <OraDatabaseSchema.h>

Inheritance diagram for ora::OraMappingSchema:
ora::IMappingSchema

Public Member Functions

bool containerForMappingVersion (const std::string &mappingVersion, int &destination)
 
bool getClassVersionListForContainer (int containerId, std::map< std::string, std::string > &versionMap)
 
bool getClassVersionListForMappingVersion (const std::string &mappingVersion, std::set< std::string > &destination)
 
bool getContainerTableMap (std::map< std::string, int > &destination)
 
bool getDependentClassesInContainerMapping (int containerId, std::set< std::string > &destination)
 
bool getMapping (const std::string &version, MappingRawData &destination)
 
bool getMappingVersionListForContainer (int containerId, std::set< std::string > &destination, bool onlyDependency=false)
 
bool getMappingVersionListForTable (const std::string &tableName, std::set< std::string > &destination)
 
bool getVersionList (std::set< std::string > &destination)
 
void insertClassVersion (const std::string &className, const std::string &classVersion, const std::string &classId, int dependencyIndex, int containerId, const std::string &mappingVersion)
 
 OraMappingSchema (coral::ISchema &dbSchema)
 
void removeMapping (const std::string &version)
 
bool selectMappingVersion (const std::string &classId, int containerId, std::string &destination)
 
void setMappingVersion (const std::string &classId, int containerId, const std::string &mappingVersion)
 
void storeMapping (const MappingRawData &mapping)
 
virtual ~OraMappingSchema ()
 
- Public Member Functions inherited from ora::IMappingSchema
virtual ~IMappingSchema ()
 

Private Attributes

coral::ISchema & m_schema
 

Detailed Description

Definition at line 133 of file OraDatabaseSchema.h.

Constructor & Destructor Documentation

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

Definition at line 684 of file OraDatabaseSchema.cc.

684  :
685  m_schema( dbSchema ){
686 }
coral::ISchema & m_schema
ora::OraMappingSchema::~OraMappingSchema ( )
virtual

Definition at line 688 of file OraDatabaseSchema.cc.

688  {
689 }

Member Function Documentation

bool ora::OraMappingSchema::containerForMappingVersion ( const std::string &  mappingVersion,
int &  destination 
)
virtual

Implements ora::IMappingSchema.

Definition at line 997 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

998  {
999  bool ret = false;
1000  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
1001  query->addToOutputList( OraClassVersionTable::containerIdColumn() );
1002  std::ostringstream condition;
1004  coral::AttributeList condData;
1006  coral::AttributeList::iterator iAttribute = condData.begin();
1007  iAttribute->data< std::string >() = mappingVersion;
1008  query->setCondition( condition.str(), condData );
1009  coral::ICursor& cursor = query->execute();
1010  while ( cursor.next() ) {
1011  ret = true;
1012  const coral::AttributeList& currentRow = cursor.currentRow();
1013  destination = currentRow[ OraClassVersionTable::containerIdColumn() ].data<int>();
1014  }
1015  return ret;
1016 }
static std::string mappingVersionColumn()
static std::string tableName()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
static std::string containerIdColumn()
bool ora::OraMappingSchema::getClassVersionListForContainer ( int  containerId,
std::map< std::string, std::string > &  versionMap 
)
virtual

Implements ora::IMappingSchema.

Definition at line 922 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::classVersionColumn(), ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

923  {
924  bool ret = false;
925  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
926  query->setDistinct();
927  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
929  std::ostringstream condition;
931  coral::AttributeList condData;
932  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
933  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
934  query->setCondition(condition.str(),condData);
935  coral::ICursor& cursor = query->execute();
936  while ( cursor.next() ) {
937  ret = true;
938  const coral::AttributeList& currentRow = cursor.currentRow();
939  std::string classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
940  std::string mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
941  versionMap.insert( std::make_pair(classVersion,mappingVersion ) );
942  }
943  return ret;
944 }
static std::string mappingVersionColumn()
static std::string tableName()
static std::string classVersionColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
static std::string containerIdColumn()
bool ora::OraMappingSchema::getClassVersionListForMappingVersion ( const std::string &  mappingVersion,
std::set< std::string > &  destination 
)
virtual

Implements ora::IMappingSchema.

Definition at line 873 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::classVersionColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

874  {
875 
876  bool ret = false;
877  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
878  query->setDistinct();
879  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
880  std::ostringstream condition;
882  coral::AttributeList condData;
884  condData[ OraClassVersionTable::mappingVersionColumn() ].data< std::string >() = mappingVersion;
885  query->setCondition(condition.str(),condData);
886  coral::ICursor& cursor = query->execute();
887  while ( cursor.next() ) {
888  ret = true;
889  const coral::AttributeList& currentRow = cursor.currentRow();
890  std::string classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
891  destination.insert( classVersion );
892  }
893  return ret;
894 }
static std::string mappingVersionColumn()
static std::string tableName()
static std::string classVersionColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
bool ora::OraMappingSchema::getContainerTableMap ( std::map< std::string, int > &  destination)
virtual

Implements ora::IMappingSchema.

Definition at line 802 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::containerIdColumn(), ora::OraMappingElementTable::mappingVersionColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, HLT_25ns14e33_v1_cff::tableName, ora::OraMappingElementTable::tableName(), ora::OraClassVersionTable::tableName(), and ora::OraMappingElementTable::tableNameColumn().

802  {
803  bool ret = false;
804  std::auto_ptr<coral::IQuery> query(m_schema.newQuery());
805  query->addToTableList( OraMappingElementTable::tableName(),"T0");
806  query->addToTableList( OraClassVersionTable::tableName(), "T1");
807  query->setDistinct();
808  query->addToOutputList( "T0."+ OraMappingElementTable::tableNameColumn() );
809  query->addToOutputList( "T1."+ OraClassVersionTable::containerIdColumn());
810  std::ostringstream condition;
812  coral::AttributeList condData;
813  query->setCondition(condition.str(),condData);
814  coral::ICursor& cursor = query->execute();
815  while ( cursor.next() ) {
816  ret = true;
817  const coral::AttributeList& currentRow = cursor.currentRow();
819  int containerId = currentRow[ "T1."+ OraClassVersionTable::containerIdColumn()].data<int>();
820  dest.insert(std::make_pair(tableName,containerId));
821  }
822  return ret;
823 }
static std::string mappingVersionColumn()
static std::string mappingVersionColumn()
static std::string tableName()
static std::string tableNameColumn()
static std::string tableName()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
static std::string containerIdColumn()
bool ora::OraMappingSchema::getDependentClassesInContainerMapping ( int  containerId,
std::set< std::string > &  destination 
)
virtual

bool ora::OraMappingSchema::getTableListForContainer( int containerId, std::set<std::string>& dest ){ bool ret = false; std::auto_ptr<coral::IQuery> query(m_schema.newQuery()); query->addToTableList( OraMappingElementTable::tableName(),"T0"); query->addToTableList( OraMappingVersionTable::tableName(), "T1"); query->setDistinct(); query->addToOutputList( "T0."+ OraMappingElementTable::tableNameColumn() ); std::ostringstream condition; condition << "T0."<<OraMappingElementTable::mappingVersionColumn()<<"="<< "T1."<< OraMappingVersionTable::mappingVersionColumn() << " AND "; condition << "T1."<<OraMappingVersionTable::containerIdColumn()<<" =:"<<OraMappingVersionTable::containerIdColumn(); coral::AttributeList condData; condData.extend< int >( OraMappingVersionTable::containerIdColumn() ); condData.begin()->data< int >() = containerId; query->setCondition(condition.str(),condData); coral::ICursor& cursor = query->execute(); while ( cursor.next() ) { ret = true; const coral::AttributeList& currentRow = cursor.currentRow(); std::string tableName = currentRow[ "T0."+ OraMappingElementTable::tableNameColumn()].data<std::string>(); dest.insert( tableName ); } return ret; }

Implements ora::IMappingSchema.

Definition at line 850 of file OraDatabaseSchema.cc.

References className(), ora::OraClassVersionTable::classNameColumn(), ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::dependencyIndexColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

851  {
852  bool ret = false;
853  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
854  query->setDistinct();
855  query->addToOutputList( OraClassVersionTable::classNameColumn() );
856  std::ostringstream condition;
858  condition << " AND "<< OraClassVersionTable::dependencyIndexColumn()<<" > 0";
859  coral::AttributeList condData;
860  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
861  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
862  query->setCondition(condition.str(),condData);
863  coral::ICursor& cursor = query->execute();
864  while ( cursor.next() ) {
865  ret = true;
866  const coral::AttributeList& currentRow = cursor.currentRow();
868  destination.insert( className );
869  }
870  return ret;
871 }
static std::string classNameColumn()
static std::string tableName()
static std::string dependencyIndexColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
std::string className(const T &t)
Definition: ClassName.h:30
static std::string containerIdColumn()
bool ora::OraMappingSchema::getMapping ( const std::string &  version,
ora::MappingRawData dest 
)
virtual

Implements ora::IMappingSchema.

Definition at line 705 of file OraDatabaseSchema.cc.

References ora::MappingRawData::addElement(), ora::OraMappingElementTable::columnNameColumn(), HTMLExport::elem(), ora::OraMappingElementTable::elementIdColumn(), ora::MappingRawElement::elementType, ora::OraMappingElementTable::elementTypeColumn(), ora::OraMappingElementTable::mappingVersionColumn(), o2o::query, run_regression::ret, ora::OraMappingElementTable::scopeNameColumn(), AlCaHLTBitMon_QueryRunRegistry::string, ora::OraMappingElementTable::tableName(), ora::OraMappingElementTable::tableNameColumn(), ora::OraMappingElementTable::variableNameColumn(), ora::OraMappingElementTable::variableParIndexColumn(), and ora::OraMappingElementTable::variableTypeColumn().

706  {
707  bool ret = false;
708  coral::ITable& mappingTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
709  std::auto_ptr<coral::IQuery> query(mappingTable.newQuery());
710  coral::AttributeList outputBuffer;
711  outputBuffer.extend<int>( OraMappingElementTable::elementIdColumn() );
712  outputBuffer.extend<std::string>( OraMappingElementTable::elementTypeColumn() );
713  outputBuffer.extend<std::string>( OraMappingElementTable::scopeNameColumn() );
716  outputBuffer.extend<std::string>( OraMappingElementTable::tableNameColumn() );
717  outputBuffer.extend<std::string>( OraMappingElementTable::columnNameColumn() );
718  query->defineOutput( outputBuffer );
719  query->addToOutputList( OraMappingElementTable::elementIdColumn() );
720  query->addToOutputList( OraMappingElementTable::elementTypeColumn() );
721  query->addToOutputList( OraMappingElementTable::scopeNameColumn() );
724  query->addToOutputList( OraMappingElementTable::tableNameColumn() );
725  query->addToOutputList( OraMappingElementTable::columnNameColumn() );
726  std::ostringstream condition;
728  coral::AttributeList condData;
730  coral::AttributeList::iterator iAttribute = condData.begin();
731  iAttribute->data< std::string >() = version;
732  query->setCondition( condition.str(), condData );
733  query->addToOrderList( OraMappingElementTable::scopeNameColumn() );
736  coral::ICursor& cursor = query->execute();
737  while ( cursor.next() ) {
738  ret = true;
739  const coral::AttributeList& currentRow = cursor.currentRow();
740  int elementId = currentRow[ OraMappingElementTable::elementIdColumn() ].data<int>();
741  MappingRawElement& elem = dest.addElement( elementId );
743  elem.scopeName = currentRow[ OraMappingElementTable::scopeNameColumn() ].data<std::string>();
744  elem.variableName = currentRow[ OraMappingElementTable::variableNameColumn() ].data<std::string>();
745  elem.variableType = currentRow[ OraMappingElementTable::variableTypeColumn() ].data<std::string>();
746  elem.tableName = currentRow[ OraMappingElementTable::tableNameColumn() ].data<std::string>();
747  elem.columns.push_back( currentRow[ OraMappingElementTable::columnNameColumn() ].data<std::string>() );
748  }
749  return ret;
750 }
MappingRawElement & addElement(int elementId)
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 variableTypeColumn()
coral::ISchema & m_schema
static std::string scopeNameColumn()
tuple query
Definition: o2o.py:269
static std::string columnNameColumn()
static std::string elementIdColumn()
bool ora::OraMappingSchema::getMappingVersionListForContainer ( int  containerId,
std::set< std::string > &  destination,
bool  onlyDependency = false 
)
virtual

Implements ora::IMappingSchema.

Definition at line 896 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::dependencyIndexColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

898  {
899  bool ret = false;
900  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
901  query->setDistinct();
903  std::ostringstream condition;
905  coral::AttributeList condData;
906  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
907  if( onlyDependency ){
908  condition << " AND "<<OraClassVersionTable::dependencyIndexColumn()<<" > 0";
909  }
910  condData[ OraClassVersionTable::containerIdColumn() ].data< int >() = containerId;
911  query->setCondition(condition.str(),condData);
912  coral::ICursor& cursor = query->execute();
913  while ( cursor.next() ) {
914  ret = true;
915  const coral::AttributeList& currentRow = cursor.currentRow();
916  std::string mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
917  dest.insert( mappingVersion );
918  }
919  return ret;
920 }
static std::string mappingVersionColumn()
static std::string tableName()
static std::string dependencyIndexColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
static std::string containerIdColumn()
bool ora::OraMappingSchema::getMappingVersionListForTable ( const std::string &  tableName,
std::set< std::string > &  destination 
)
virtual

Implements ora::IMappingSchema.

Definition at line 946 of file OraDatabaseSchema.cc.

References ora::OraMappingElementTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, ora::OraMappingElementTable::tableName(), and ora::OraMappingElementTable::tableNameColumn().

948 {
949  bool ret = false;
950  destination.clear();
951  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingElementTable::tableName() ).newQuery() );
952  query->setDistinct();
954  std::ostringstream condition;
956  coral::AttributeList condData;
958  condData.begin()->data<std::string>() = tableName;
959  query->setCondition(condition.str(),condData);
960  coral::ICursor& cursor = query->execute();
961  while ( cursor.next() ) {
962  ret = true;
963  const coral::AttributeList& currentRow = cursor.currentRow();
964  std::string mappingVersion = currentRow[ OraMappingElementTable::mappingVersionColumn()].data<std::string>();
965  destination.insert( mappingVersion );
966  }
967  return ret;
968 }
static std::string mappingVersionColumn()
static std::string tableName()
static std::string tableNameColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
bool ora::OraMappingSchema::getVersionList ( std::set< std::string > &  destination)
virtual

Implements ora::IMappingSchema.

Definition at line 691 of file OraDatabaseSchema.cc.

References ora::OraMappingVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraMappingVersionTable::tableName().

691  {
692  bool ret = false;
693  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingVersionTable::tableName() ).newQuery() );
695  coral::ICursor& cursor = query->execute();
696  while ( cursor.next() ) {
697  ret = true;
698  const coral::AttributeList& currentRow = cursor.currentRow();
699  std::string mappingVersion = currentRow[ OraMappingVersionTable::mappingVersionColumn()].data<std::string>();
700  dest.insert( mappingVersion );
701  }
702  return ret;
703 }
static std::string tableName()
static std::string mappingVersionColumn()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
void ora::OraMappingSchema::insertClassVersion ( const std::string &  className,
const std::string &  classVersion,
const std::string &  classId,
int  dependencyIndex,
int  containerId,
const std::string &  mappingVersion 
)
virtual

Implements ora::IMappingSchema.

Definition at line 1018 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::classIdColumn(), ora::OraClassVersionTable::classNameColumn(), ora::OraClassVersionTable::classVersionColumn(), ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::dependencyIndexColumn(), idDealer::inputData, ora::OraClassVersionTable::mappingVersionColumn(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

1023  {
1024  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
1025  coral::AttributeList inputData;
1027  inputData.extend<std::string>( OraClassVersionTable::classNameColumn());
1029  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
1030  inputData.extend<int>( OraClassVersionTable::dependencyIndexColumn());
1031  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
1032  coral::AttributeList::iterator iInAttr = inputData.begin();
1033  iInAttr->data< std::string >() = mappingVersion;
1034  ++iInAttr;
1035  iInAttr->data< std::string >() = className;
1036  ++iInAttr;
1037  iInAttr->data< std::string >() = classVersion;
1038  ++iInAttr;
1039  iInAttr->data< std::string >() = classId;
1040  ++iInAttr;
1041  iInAttr->data< int >() = dependencyIndex;
1042  ++iInAttr;
1043  iInAttr->data< int >() = containerId;
1044  classVersionTable.dataEditor().insertRow( inputData );
1045 }
static std::string classIdColumn()
static std::string mappingVersionColumn()
static std::string classNameColumn()
static std::string tableName()
static std::string classVersionColumn()
static std::string dependencyIndexColumn()
coral::ISchema & m_schema
std::string className(const T &t)
Definition: ClassName.h:30
tuple inputData
Definition: idDealer.py:72
static std::string containerIdColumn()
void ora::OraMappingSchema::removeMapping ( const std::string &  version)
virtual

Implements ora::IMappingSchema.

Definition at line 790 of file OraDatabaseSchema.cc.

References ora::OraMappingVersionTable::mappingVersionColumn(), AlCaHLTBitMon_QueryRunRegistry::string, ora::OraMappingVersionTable::tableName(), ora::OraMappingElementTable::tableName(), and ora::OraClassVersionTable::tableName().

790  {
791  // Remove all rows in the tables with the version.
792  coral::AttributeList whereData;
794  whereData.begin()->data<std::string>() = version;
795 
797  m_schema.tableHandle( OraClassVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
798  m_schema.tableHandle( OraMappingElementTable::tableName() ).dataEditor().deleteRows( condition, whereData );
799  m_schema.tableHandle( OraMappingVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
800 }
static std::string tableName()
static std::string tableName()
static std::string tableName()
static std::string mappingVersionColumn()
coral::ISchema & m_schema
bool ora::OraMappingSchema::selectMappingVersion ( const std::string &  classId,
int  containerId,
std::string &  destination 
)
virtual

Implements ora::IMappingSchema.

Definition at line 970 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::classIdColumn(), ora::OraClassVersionTable::containerIdColumn(), ora::OraClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

972  {
973  bool ret = false;
974  destination.clear();
975  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
977  std::ostringstream condition;
978  condition << OraClassVersionTable::classIdColumn() << " =:" << OraClassVersionTable::classIdColumn() << " AND ";
980  coral::AttributeList condData;
981  condData.extend<std::string>( OraClassVersionTable::classIdColumn() );
982  condData.extend<int>( OraClassVersionTable::containerIdColumn() );
983  coral::AttributeList::iterator iAttribute = condData.begin();
984  iAttribute->data< std::string >() = classId;
985  ++iAttribute;
986  iAttribute->data< int >() = containerId;
987  query->setCondition( condition.str(), condData );
988  coral::ICursor& cursor = query->execute();
989  while ( cursor.next() ) {
990  ret = true;
991  const coral::AttributeList& currentRow = cursor.currentRow();
992  destination = currentRow[OraClassVersionTable::mappingVersionColumn()].data<std::string>();
993  }
994  return ret;
995 }
static std::string classIdColumn()
static std::string mappingVersionColumn()
static std::string tableName()
coral::ISchema & m_schema
tuple query
Definition: o2o.py:269
static std::string containerIdColumn()
void ora::OraMappingSchema::setMappingVersion ( const std::string &  classId,
int  containerId,
const std::string &  mappingVersion 
)
virtual

Implements ora::IMappingSchema.

Definition at line 1047 of file OraDatabaseSchema.cc.

References ora::OraClassVersionTable::classIdColumn(), ora::OraClassVersionTable::containerIdColumn(), idDealer::inputData, ora::OraClassVersionTable::mappingVersionColumn(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::OraClassVersionTable::tableName().

1049  {
1050  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
1051  coral::AttributeList inputData;
1053  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
1054  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
1055  coral::AttributeList::iterator iInAttr = inputData.begin();
1056  iInAttr->data< std::string >() = mappingVersion;
1057  ++iInAttr;
1058  iInAttr->data< std::string >() = classId;
1059  ++iInAttr;
1060  iInAttr->data< int >() = containerId;
1064  classVersionTable.dataEditor().updateRows( setClause,whereClause, inputData );
1065 }
static std::string classIdColumn()
static std::string mappingVersionColumn()
static std::string tableName()
coral::ISchema & m_schema
tuple inputData
Definition: idDealer.py:72
static std::string containerIdColumn()
void ora::OraMappingSchema::storeMapping ( const MappingRawData mapping)
virtual

Implements ora::IMappingSchema.

Definition at line 752 of file OraDatabaseSchema.cc.

References ora::OraMappingElementTable::columnNameColumn(), ora::OraMappingElementTable::elementIdColumn(), ora::MappingRawData::elements, ora::OraMappingElementTable::elementTypeColumn(), ora::OraMappingVersionTable::mappingVersionColumn(), ora::OraMappingElementTable::mappingVersionColumn(), ora::OraMappingElementTable::scopeNameColumn(), AlCaHLTBitMon_QueryRunRegistry::string, ora::OraMappingVersionTable::tableName(), ora::OraMappingElementTable::tableName(), ora::OraMappingElementTable::tableNameColumn(), ora::OraMappingElementTable::variableNameColumn(), ora::OraMappingElementTable::variableParIndexColumn(), ora::OraMappingElementTable::variableTypeColumn(), and ora::MappingRawData::version.

752  {
753  // first update the version table
754  coral::ITable& mappingVersionTable = m_schema.tableHandle( OraMappingVersionTable::tableName() );
755  coral::AttributeList rowBuffer;
757  rowBuffer[ OraMappingVersionTable::mappingVersionColumn() ].data<std::string>()= mapping.version;
758  mappingVersionTable.dataEditor().insertRow( rowBuffer );
759 
760  // then update the element tables
761  coral::ITable& mappingElementTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
762  coral::AttributeList dataBuffer;
764  dataBuffer.extend< int >( OraMappingElementTable::elementIdColumn() );
765  dataBuffer.extend< std::string >( OraMappingElementTable::elementTypeColumn() );
766  dataBuffer.extend< std::string >( OraMappingElementTable::scopeNameColumn() );
768  dataBuffer.extend< unsigned int >( OraMappingElementTable::variableParIndexColumn() );
770  dataBuffer.extend< std::string >( OraMappingElementTable::tableNameColumn() );
771  dataBuffer.extend< std::string >( OraMappingElementTable::columnNameColumn() );
772  dataBuffer[ OraMappingElementTable::mappingVersionColumn() ].data<std::string>()= mapping.version;
773 
774  for( std::map < int, MappingRawElement >::const_iterator iElem = mapping.elements.begin();
775  iElem != mapping.elements.end(); iElem++ ){
776  for( size_t iParamIndex = 0; iParamIndex < iElem->second.columns.size(); iParamIndex++ ){
777  dataBuffer[ OraMappingElementTable::elementIdColumn() ].data<int>() = iElem->first;
778  dataBuffer[ OraMappingElementTable::elementTypeColumn()].data<std::string>()= iElem->second.elementType;
779  dataBuffer[ OraMappingElementTable::scopeNameColumn() ].data<std::string>()= iElem->second.scopeName;
780  dataBuffer[ OraMappingElementTable::variableNameColumn() ].data<std::string>()= iElem->second.variableName;
781  dataBuffer[ OraMappingElementTable::variableParIndexColumn() ].data<unsigned int>() = iParamIndex;
782  dataBuffer[ OraMappingElementTable::variableTypeColumn() ].data<std::string>()= iElem->second.variableType;
783  dataBuffer[ OraMappingElementTable::tableNameColumn() ].data<std::string>()= iElem->second.tableName;
784  dataBuffer[ OraMappingElementTable::columnNameColumn() ].data<std::string>()= iElem->second.columns[iParamIndex];
785  mappingElementTable.dataEditor().insertRow( dataBuffer );
786  }
787  }
788 }
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()
coral::ISchema & m_schema
static std::string scopeNameColumn()
static std::string columnNameColumn()
static std::string elementIdColumn()

Member Data Documentation

coral::ISchema& ora::OraMappingSchema::m_schema
private

Definition at line 154 of file OraDatabaseSchema.h.