CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::OraMappingSchema Class Reference

#include <OraDatabaseSchema.h>

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

List of all members.

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

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.

                                                              :
  m_schema( dbSchema ){
}
ora::OraMappingSchema::~OraMappingSchema ( ) [virtual]

Definition at line 688 of file OraDatabaseSchema.cc.

                                      {
}

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, and ora::OraClassVersionTable::tableName().

                                                                          {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->addToOutputList( OraClassVersionTable::containerIdColumn() );
  std::ostringstream condition;
  condition << OraClassVersionTable::mappingVersionColumn() << " =:"<< OraClassVersionTable::mappingVersionColumn();
  coral::AttributeList condData;
  condData.extend<std::string>( OraClassVersionTable::mappingVersionColumn() );
  coral::AttributeList::iterator iAttribute = condData.begin();
  iAttribute->data< std::string >() = mappingVersion;
  query->setCondition( condition.str(), condData );
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    destination = currentRow[ OraClassVersionTable::containerIdColumn() ].data<int>();
  }
  return ret;
}
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, and ora::OraClassVersionTable::tableName().

                                                                                                      {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->setDistinct();
  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
  query->addToOutputList( OraClassVersionTable::mappingVersionColumn() );
  std::ostringstream condition;
  condition <<OraClassVersionTable::containerIdColumn()<<" =:"<<OraClassVersionTable::containerIdColumn();
  coral::AttributeList condData;
  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
  condData[ OraClassVersionTable::containerIdColumn() ].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 classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
    std::string mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
    versionMap.insert( std::make_pair(classVersion,mappingVersion ) );
  }
  return ret;
}
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, and ora::OraClassVersionTable::tableName().

                                                                                                  {
  
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->setDistinct();
  query->addToOutputList( OraClassVersionTable::classVersionColumn() );
  std::ostringstream condition;
  condition <<OraClassVersionTable::mappingVersionColumn()<<" =:"<<OraClassVersionTable::mappingVersionColumn();
  coral::AttributeList condData;
  condData.extend< std::string >( OraClassVersionTable::mappingVersionColumn() );  
  condData[ OraClassVersionTable::mappingVersionColumn() ].data< std::string >() = mappingVersion;
  query->setCondition(condition.str(),condData);
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    std::string classVersion = currentRow[ OraClassVersionTable::classVersionColumn() ].data<std::string>();
    destination.insert( classVersion );
  }
  return ret;
}
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::OraClassVersionTable::mappingVersionColumn(), ora::OraMappingElementTable::mappingVersionColumn(), o2o::query, run_regression::ret, ora::OraClassVersionTable::tableName(), ora::OraMappingElementTable::tableName(), and ora::OraMappingElementTable::tableNameColumn().

                                                                            {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query(m_schema.newQuery());
  query->addToTableList( OraMappingElementTable::tableName(),"T0");
  query->addToTableList( OraClassVersionTable::tableName(), "T1");
  query->setDistinct();
  query->addToOutputList( "T0."+ OraMappingElementTable::tableNameColumn() );
  query->addToOutputList( "T1."+ OraClassVersionTable::containerIdColumn());
  std::ostringstream condition;
  condition << "T0."<<OraMappingElementTable::mappingVersionColumn()<<"="<< "T1."<< OraClassVersionTable::mappingVersionColumn();
  coral::AttributeList condData;
  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>();
    int containerId = currentRow[ "T1."+ OraClassVersionTable::containerIdColumn()].data<int>();
    dest.insert(std::make_pair(tableName,containerId));
  }
  return ret;
}
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, and ora::OraClassVersionTable::tableName().

                                                                                                   {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->setDistinct();
  query->addToOutputList( OraClassVersionTable::classNameColumn() );
  std::ostringstream condition;
  condition <<OraClassVersionTable::containerIdColumn()<<" =:"<<OraClassVersionTable::containerIdColumn();
  condition << " AND "<< OraClassVersionTable::dependencyIndexColumn()<<" > 0";
  coral::AttributeList condData;
  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
  condData[ OraClassVersionTable::containerIdColumn() ].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 className = currentRow[ OraClassVersionTable::classNameColumn() ].data<std::string>();
    destination.insert( className );
  }
  return ret;
}
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(), ora::OraMappingElementTable::tableName(), ora::OraMappingElementTable::tableNameColumn(), ora::OraMappingElementTable::variableNameColumn(), ora::OraMappingElementTable::variableParIndexColumn(), and ora::OraMappingElementTable::variableTypeColumn().

                                                                 {
  bool ret = false;
  coral::ITable& mappingTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
  std::auto_ptr<coral::IQuery> query(mappingTable.newQuery());
  coral::AttributeList outputBuffer;
  outputBuffer.extend<int>( OraMappingElementTable::elementIdColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::elementTypeColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::scopeNameColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::variableNameColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::variableTypeColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::tableNameColumn() );
  outputBuffer.extend<std::string>( OraMappingElementTable::columnNameColumn() );
  query->defineOutput( outputBuffer );
  query->addToOutputList( OraMappingElementTable::elementIdColumn() );
  query->addToOutputList( OraMappingElementTable::elementTypeColumn() );
  query->addToOutputList( OraMappingElementTable::scopeNameColumn() );
  query->addToOutputList( OraMappingElementTable::variableNameColumn() );
  query->addToOutputList( OraMappingElementTable::variableTypeColumn() );
  query->addToOutputList( OraMappingElementTable::tableNameColumn() );
  query->addToOutputList( OraMappingElementTable::columnNameColumn() );
  std::ostringstream condition;
  condition << OraMappingElementTable::mappingVersionColumn()<<"= :"<< OraMappingElementTable::mappingVersionColumn();
  coral::AttributeList condData;
  condData.extend<std::string>( OraMappingElementTable::mappingVersionColumn() );
  coral::AttributeList::iterator iAttribute = condData.begin();
  iAttribute->data< std::string >() = version;
  query->setCondition( condition.str(), condData );
  query->addToOrderList( OraMappingElementTable::scopeNameColumn() );
  query->addToOrderList( OraMappingElementTable::variableNameColumn() );
  query->addToOrderList( OraMappingElementTable::variableParIndexColumn() );
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    int elementId = currentRow[ OraMappingElementTable::elementIdColumn() ].data<int>();
    MappingRawElement& elem = dest.addElement( elementId );
    elem.elementType = currentRow[ OraMappingElementTable::elementTypeColumn() ].data<std::string>();
    elem.scopeName = currentRow[ OraMappingElementTable::scopeNameColumn() ].data<std::string>();
    elem.variableName = currentRow[ OraMappingElementTable::variableNameColumn() ].data<std::string>();
    elem.variableType = currentRow[ OraMappingElementTable::variableTypeColumn() ].data<std::string>();
    elem.tableName = currentRow[ OraMappingElementTable::tableNameColumn() ].data<std::string>();
    elem.columns.push_back( currentRow[ OraMappingElementTable::columnNameColumn() ].data<std::string>() );
  }
  return ret;
}
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, and ora::OraClassVersionTable::tableName().

                                                                                    {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->setDistinct();
  query->addToOutputList( OraClassVersionTable::mappingVersionColumn() );
  std::ostringstream condition;
  condition <<OraClassVersionTable::containerIdColumn()<<" =:"<<OraClassVersionTable::containerIdColumn();
  coral::AttributeList condData;
  condData.extend< int >( OraClassVersionTable::containerIdColumn() );
  if( onlyDependency ){
    condition << " AND "<<OraClassVersionTable::dependencyIndexColumn()<<" > 0";
  }
  condData[ OraClassVersionTable::containerIdColumn() ].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 mappingVersion = currentRow[ OraClassVersionTable::mappingVersionColumn() ].data<std::string>();
    dest.insert( mappingVersion );
  }
  return ret;
}
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, ora::OraMappingElementTable::tableName(), and ora::OraMappingElementTable::tableNameColumn().

{
  bool ret = false;
  destination.clear();
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingElementTable::tableName() ).newQuery() );
  query->setDistinct();
  query->addToOutputList( OraMappingElementTable::mappingVersionColumn() );
  std::ostringstream condition;
  condition << OraMappingElementTable::tableNameColumn()<<" = :"<< OraMappingElementTable::tableNameColumn();
  coral::AttributeList condData;
  condData.extend< std::string >( OraMappingElementTable::tableNameColumn() );
  condData.begin()->data<std::string>() = tableName;
  query->setCondition(condition.str(),condData);
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    std::string mappingVersion = currentRow[ OraMappingElementTable::mappingVersionColumn()].data<std::string>();
    destination.insert( mappingVersion );
  }
  return ret;
}
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, and ora::OraMappingVersionTable::tableName().

                                                                 {
  bool ret = false;
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraMappingVersionTable::tableName() ).newQuery() );
  query->addToOutputList( OraMappingVersionTable::mappingVersionColumn() );
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    std::string mappingVersion = currentRow[ OraMappingVersionTable::mappingVersionColumn()].data<std::string>();
    dest.insert( mappingVersion );
  }
  return ret;
}
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(), and ora::OraClassVersionTable::tableName().

                                                                                 {
  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
  coral::AttributeList inputData;
  inputData.extend<std::string>( OraClassVersionTable::mappingVersionColumn());
  inputData.extend<std::string>( OraClassVersionTable::classNameColumn());
  inputData.extend<std::string>( OraClassVersionTable::classVersionColumn());
  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
  inputData.extend<int>( OraClassVersionTable::dependencyIndexColumn());
  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
  coral::AttributeList::iterator iInAttr = inputData.begin();
  iInAttr->data< std::string >() = mappingVersion;
  ++iInAttr;
  iInAttr->data< std::string >() = className;
  ++iInAttr;
  iInAttr->data< std::string >() = classVersion;
  ++iInAttr;
  iInAttr->data< std::string >() = classId;
  ++iInAttr;
  iInAttr->data< int >() = dependencyIndex;
  ++iInAttr;
  iInAttr->data< int >() = containerId;
  classVersionTable.dataEditor().insertRow( inputData );
}
void ora::OraMappingSchema::removeMapping ( const std::string &  version) [virtual]

Implements ora::IMappingSchema.

Definition at line 790 of file OraDatabaseSchema.cc.

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

                                                                 {
  // Remove all rows in the tables with the version.
  coral::AttributeList whereData;
  whereData.extend<std::string>( OraMappingVersionTable::mappingVersionColumn() );
  whereData.begin()->data<std::string>() = version;

  std::string condition = OraMappingVersionTable::mappingVersionColumn() + " = :" + OraMappingVersionTable::mappingVersionColumn();
  m_schema.tableHandle( OraClassVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
  m_schema.tableHandle( OraMappingElementTable::tableName() ).dataEditor().deleteRows( condition, whereData );
  m_schema.tableHandle( OraMappingVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData );
}
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, and ora::OraClassVersionTable::tableName().

                                                                          {
  bool ret = false;
  destination.clear();
  std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( OraClassVersionTable::tableName() ).newQuery() );
  query->addToOutputList( OraClassVersionTable::mappingVersionColumn() );
  std::ostringstream condition;
  condition << OraClassVersionTable::classIdColumn() << " =:" << OraClassVersionTable::classIdColumn() << " AND ";
  condition << OraClassVersionTable::containerIdColumn() << " =:" << OraClassVersionTable::containerIdColumn();
  coral::AttributeList condData;
  condData.extend<std::string>( OraClassVersionTable::classIdColumn() );
  condData.extend<int>( OraClassVersionTable::containerIdColumn() );
  coral::AttributeList::iterator iAttribute = condData.begin();
  iAttribute->data< std::string >() = classId;
  ++iAttribute;
  iAttribute->data< int >() = containerId;
  query->setCondition( condition.str(), condData );
  coral::ICursor& cursor = query->execute();
  while ( cursor.next() ) {
    ret = true;
    const coral::AttributeList& currentRow = cursor.currentRow();
    destination = currentRow[OraClassVersionTable::mappingVersionColumn()].data<std::string>();
  }
  return ret;  
}
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(), and ora::OraClassVersionTable::tableName().

                                                                                {
  coral::ITable& classVersionTable = m_schema.tableHandle( OraClassVersionTable::tableName() );
  coral::AttributeList inputData;
  inputData.extend<std::string>( OraClassVersionTable::mappingVersionColumn());
  inputData.extend<std::string>( OraClassVersionTable::classIdColumn());
  inputData.extend<int>( OraClassVersionTable::containerIdColumn());
  coral::AttributeList::iterator iInAttr = inputData.begin();
  iInAttr->data< std::string >() = mappingVersion;
  ++iInAttr;
  iInAttr->data< std::string >() = classId;
  ++iInAttr;
  iInAttr->data< int >() = containerId;
  std::string setClause = OraClassVersionTable::mappingVersionColumn()+" =:"+ OraClassVersionTable::mappingVersionColumn();
  std::string whereClause = OraClassVersionTable::classIdColumn()+" =:"+ OraClassVersionTable::classIdColumn()+" AND "+
    OraClassVersionTable::containerIdColumn()+" =:"+ OraClassVersionTable::containerIdColumn();
  classVersionTable.dataEditor().updateRows( setClause,whereClause, inputData  );
}
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(), ora::OraMappingVersionTable::tableName(), ora::OraMappingElementTable::tableName(), ora::OraMappingElementTable::tableNameColumn(), ora::OraMappingElementTable::variableNameColumn(), ora::OraMappingElementTable::variableParIndexColumn(), ora::OraMappingElementTable::variableTypeColumn(), and ora::MappingRawData::version.

                                                                     {
  // first update the version table
  coral::ITable& mappingVersionTable = m_schema.tableHandle( OraMappingVersionTable::tableName() );
  coral::AttributeList  rowBuffer;
  rowBuffer.extend< std::string >( OraMappingVersionTable::mappingVersionColumn() );
  rowBuffer[ OraMappingVersionTable::mappingVersionColumn() ].data<std::string>()= mapping.version;
  mappingVersionTable.dataEditor().insertRow( rowBuffer );

  // then update the element tables
  coral::ITable& mappingElementTable = m_schema.tableHandle( OraMappingElementTable::tableName() );
  coral::AttributeList  dataBuffer;
  dataBuffer.extend< std::string >( OraMappingElementTable::mappingVersionColumn() );
  dataBuffer.extend< int >( OraMappingElementTable::elementIdColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::elementTypeColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::scopeNameColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::variableNameColumn() );
  dataBuffer.extend< unsigned int >( OraMappingElementTable::variableParIndexColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::variableTypeColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::tableNameColumn() );
  dataBuffer.extend< std::string >( OraMappingElementTable::columnNameColumn() );
  dataBuffer[ OraMappingElementTable::mappingVersionColumn() ].data<std::string>()= mapping.version;

  for( std::map < int, MappingRawElement >::const_iterator iElem = mapping.elements.begin();
       iElem != mapping.elements.end(); iElem++ ){
    for( size_t iParamIndex = 0; iParamIndex < iElem->second.columns.size(); iParamIndex++ ){
      dataBuffer[ OraMappingElementTable::elementIdColumn() ].data<int>() = iElem->first;
      dataBuffer[ OraMappingElementTable::elementTypeColumn()].data<std::string>()=  iElem->second.elementType;
      dataBuffer[ OraMappingElementTable::scopeNameColumn() ].data<std::string>()= iElem->second.scopeName;
      dataBuffer[ OraMappingElementTable::variableNameColumn() ].data<std::string>()= iElem->second.variableName;
      dataBuffer[ OraMappingElementTable::variableParIndexColumn() ].data<unsigned int>() = iParamIndex;
      dataBuffer[ OraMappingElementTable::variableTypeColumn() ].data<std::string>()= iElem->second.variableType;
      dataBuffer[ OraMappingElementTable::tableNameColumn() ].data<std::string>()= iElem->second.tableName;
      dataBuffer[ OraMappingElementTable::columnNameColumn() ].data<std::string>()= iElem->second.columns[iParamIndex];
      mappingElementTable.dataEditor().insertRow( dataBuffer );
    }
  }
}

Member Data Documentation

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

Definition at line 154 of file OraDatabaseSchema.h.