#include <PoolDatabaseSchema.h>
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 | init (PoolDbCache &dbCache) |
void | insertClassVersion (const std::string &className, const std::string &classVersion, const std::string &classId, int dependencyIndex, int containerId, const std::string &mappingVersion) |
PoolMappingSchema (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 | ~PoolMappingSchema () |
Static Public Member Functions | |
static std::string | emptyScope () |
Private Attributes | |
PoolDbCache * | m_dbCache |
coral::ISchema & | m_schema |
Definition at line 173 of file PoolDatabaseSchema.h.
ora::PoolMappingSchema::PoolMappingSchema | ( | coral::ISchema & | dbSchema | ) | [explicit] |
Definition at line 750 of file PoolDatabaseSchema.cc.
ora::PoolMappingSchema::~PoolMappingSchema | ( | ) | [virtual] |
Definition at line 755 of file PoolDatabaseSchema.cc.
{ }
bool ora::PoolMappingSchema::containerForMappingVersion | ( | const std::string & | mappingVersion, |
int & | destination | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 1091 of file PoolDatabaseSchema.cc.
{ // not implemented for the moment return false; }
std::string ora::PoolMappingSchema::emptyScope | ( | ) | [static] |
Definition at line 745 of file PoolDatabaseSchema.cc.
{ static std::string s_scope(" "); return s_scope; }
bool ora::PoolMappingSchema::getClassVersionListForContainer | ( | int | containerId, |
std::map< std::string, std::string > & | versionMap | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 1015 of file PoolDatabaseSchema.cc.
References ora::PoolClassVersionTable::classVersionColumn(), ora::PoolContainerHeaderTable::containerIdColumn(), ora::PoolClassVersionTable::containerNameColumn(), ora::PoolContainerHeaderTable::containerNameColumn(), ora::PoolClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, ora::PoolClassVersionTable::tableName(), and ora::PoolContainerHeaderTable::tableName().
{ bool ret = false; std::auto_ptr<coral::IQuery> query( m_schema.newQuery() ); query->addToTableList( PoolClassVersionTable::tableName(), "T0" ); query->addToTableList( PoolContainerHeaderTable::tableName(), "T1" ); query->addToOutputList( "T0."+PoolClassVersionTable::classVersionColumn() ); query->addToOutputList( "T0."+PoolClassVersionTable::mappingVersionColumn() ); query->setDistinct(); std::ostringstream condition; condition <<"T0."<<PoolClassVersionTable::containerNameColumn()<<" = "<<"T1."<<PoolContainerHeaderTable::containerNameColumn(); condition <<" AND T1."<<PoolContainerHeaderTable::containerIdColumn()<<" =:"<<PoolContainerHeaderTable::containerIdColumn(); coral::AttributeList condData; condData.extend< int >( PoolContainerHeaderTable::containerIdColumn() ); condData[ PoolContainerHeaderTable::containerIdColumn() ].data< int >() = containerId + 1; //POOL starts counting from 1!; 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[ "T0."+PoolClassVersionTable::classVersionColumn() ].data<std::string>(); std::string mappingVersion = currentRow[ "T0."+PoolClassVersionTable::mappingVersionColumn() ].data<std::string>(); versionMap.insert( std::make_pair(classVersion, mappingVersion ) ); } return ret; }
bool ora::PoolMappingSchema::getClassVersionListForMappingVersion | ( | const std::string & | mappingVersion, |
std::set< std::string > & | destination | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 991 of file PoolDatabaseSchema.cc.
References ora::PoolClassVersionTable::classVersionColumn(), ora::PoolClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, and ora::PoolClassVersionTable::tableName().
{ bool ret = false; coral::ITable& classVersionTable = m_schema.tableHandle( PoolClassVersionTable::tableName() ); std::auto_ptr<coral::IQuery> query( classVersionTable.newQuery() ); query->setDistinct(); query->addToOutputList( PoolClassVersionTable::classVersionColumn() ); std::ostringstream condition; condition <<PoolClassVersionTable::mappingVersionColumn()<<" =:"<<PoolClassVersionTable::mappingVersionColumn(); coral::AttributeList condData; condData.extend<std::string>(PoolClassVersionTable::mappingVersionColumn()); condData[ PoolClassVersionTable::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[ PoolClassVersionTable::classVersionColumn() ].data<std::string>(); destination.insert( classVersion ); } return ret; }
bool ora::PoolMappingSchema::getContainerTableMap | ( | std::map< std::string, int > & | destination | ) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 946 of file PoolDatabaseSchema.cc.
{ // not implemented for the moment return false; }
bool ora::PoolMappingSchema::getDependentClassesInContainerMapping | ( | int | containerId, |
std::set< std::string > & | destination | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 985 of file PoolDatabaseSchema.cc.
{ // not implemented for the moment return false; }
bool ora::PoolMappingSchema::getMapping | ( | const std::string & | version, |
ora::MappingRawData & | dest | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 792 of file PoolDatabaseSchema.cc.
References ora::MappingRawData::addElement(), ora::MappingElement::classMappingElementType(), ora::PoolMappingElementTable::columnNameColumn(), HTMLExport::elem(), ora::MappingRawElement::elementType, ora::PoolMappingElementTable::elementTypeColumn(), ora::MappingRawElement::emptyScope(), ora::mappingTypeFromPool(), ora::PoolMappingElementTable::mappingVersionColumn(), ora::MappingElement::objectMappingElementType(), o2o::query, ora::rebuildPoolMapping(), run_regression::ret, ora::MappingRawElement::scopeName, ora::PoolMappingElementTable::scopeNameColumn(), ora::PoolMappingElementTable::tableName(), ora::MappingRawElement::tableName, ora::PoolMappingElementTable::tableNameColumn(), ora::MappingRawElement::variableName, ora::PoolMappingElementTable::variableNameColumn(), ora::variableNameFromPool(), ora::PoolMappingElementTable::variableParIndexColumn(), ora::MappingRawElement::variableType, and ora::PoolMappingElementTable::variableTypeColumn().
{ bool ret = false; coral::ITable& mappingTable = m_schema.tableHandle( PoolMappingElementTable::tableName() ); std::auto_ptr<coral::IQuery> query(mappingTable.newQuery()); coral::AttributeList outputBuffer; outputBuffer.extend<std::string>( PoolMappingElementTable::elementTypeColumn() ); outputBuffer.extend<std::string>( PoolMappingElementTable::scopeNameColumn() ); outputBuffer.extend<std::string>( PoolMappingElementTable::variableNameColumn() ); outputBuffer.extend<std::string>( PoolMappingElementTable::variableTypeColumn() ); outputBuffer.extend<std::string>( PoolMappingElementTable::tableNameColumn() ); outputBuffer.extend<std::string>( PoolMappingElementTable::columnNameColumn() ); query->defineOutput( outputBuffer ); query->addToOutputList( PoolMappingElementTable::elementTypeColumn() ); query->addToOutputList( PoolMappingElementTable::scopeNameColumn() ); query->addToOutputList( PoolMappingElementTable::variableNameColumn() ); query->addToOutputList( PoolMappingElementTable::variableTypeColumn() ); query->addToOutputList( PoolMappingElementTable::tableNameColumn() ); query->addToOutputList( PoolMappingElementTable::columnNameColumn() ); std::ostringstream condition; condition << PoolMappingElementTable::mappingVersionColumn()<<"= :"<< PoolMappingElementTable::mappingVersionColumn(); coral::AttributeList condData; condData.extend<std::string>( PoolMappingElementTable::mappingVersionColumn() ); coral::AttributeList::iterator iAttribute = condData.begin(); iAttribute->data< std::string >() = version; query->setCondition( condition.str(), condData ); query->addToOrderList( PoolMappingElementTable::scopeNameColumn() ); query->addToOrderList( PoolMappingElementTable::variableNameColumn() ); // check the order: column order has to be swapped! query->addToOrderList( PoolMappingElementTable::variableParIndexColumn() ); coral::ICursor& cursor = query->execute(); std::set<std::string> topElements; std::map<std::string,MappingRawElement> elementsByVarName; while ( cursor.next() ) { ret = true; const coral::AttributeList& currentRow = cursor.currentRow(); std::string scope = currentRow[ PoolMappingElementTable::scopeNameColumn() ].data<std::string>(); std::string varName = currentRow[ PoolMappingElementTable::variableNameColumn() ].data<std::string>(); std::string elemId = scope+"::"+varName; std::map<std::string,MappingRawElement>::iterator iE = elementsByVarName.find( elemId ); if( iE == elementsByVarName.end() ) { iE = elementsByVarName.insert( std::make_pair( elemId, MappingRawElement())).first; MappingRawElement& elem = iE->second; elem.elementType = mappingTypeFromPool( currentRow[ PoolMappingElementTable::elementTypeColumn() ].data<std::string>() ); elem.scopeName = scope; elem.variableName = variableNameFromPool( varName ); elem.variableType = currentRow[ PoolMappingElementTable::variableTypeColumn() ].data<std::string>(); elem.tableName = currentRow[ PoolMappingElementTable::tableNameColumn() ].data<std::string>(); if(elem.scopeName == emptyScope()) { if( elem.elementType == MappingElement::objectMappingElementType() ){ if( topElements.find( elemId ) == topElements.end() ){ topElements.insert( elemId ); } } } } iE->second.columns.push_back( currentRow[ PoolMappingElementTable::columnNameColumn() ].data<std::string>() ); } // re-ordering by scope std::map<std::string, std::vector<MappingRawElement> > elementsByScope; for( std::map<std::string,MappingRawElement>::iterator iEl = elementsByVarName.begin(); iEl != elementsByVarName.end(); ++iEl ){ // reversing the columns std::vector<std::string> reverseCols; for( std::vector<std::string>::reverse_iterator iR = iEl->second.columns.rbegin(); iR != iEl->second.columns.rend(); ++iR ){ reverseCols.push_back( *iR ); } iEl->second.columns = reverseCols; std::string scope = iEl->second.scopeName; if( scope != emptyScope() ){ std::map<std::string, std::vector<MappingRawElement> >::iterator iS = elementsByScope.find( scope ); if( iS == elementsByScope.end() ){ elementsByScope.insert( std::make_pair( scope, std::vector<MappingRawElement>(1,iEl->second ) )); } else { iS->second.push_back( iEl->second ); } } } // rebuilding + adding class elements int eid = 0; for( std::set<std::string>::const_iterator iEl = topElements.begin(); iEl != topElements.end(); ++iEl ){ // adding the class elements... std::map<std::string,MappingRawElement>::iterator iE = elementsByVarName.find( *iEl ); MappingRawElement classElement = iE->second; classElement.elementType = MappingElement::classMappingElementType(); classElement.scopeName = MappingRawElement::emptyScope(); dest.addElement( eid ) = classElement; eid++; MappingRawElement firstElement = iE->second; firstElement.scopeName = iE->second.variableName; dest.addElement( eid ) = firstElement; eid++; // rebuilding extending the scope... rebuildPoolMapping( iE->second.variableName, iE->second.variableName, elementsByScope, dest, eid ); } return ret; }
bool ora::PoolMappingSchema::getMappingVersionListForContainer | ( | int | containerId, |
std::set< std::string > & | destination, | ||
bool | onlyDependency = false |
||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 951 of file PoolDatabaseSchema.cc.
References ora::PoolContainerHeaderTable::containerIdColumn(), ora::PoolClassVersionTable::containerNameColumn(), ora::PoolContainerHeaderTable::containerNameColumn(), ora::MappingElement::dependencyMappingElementType(), ora::PoolMappingElementTable::elementTypeColumn(), ora::PoolClassVersionTable::mappingVersionColumn(), ora::PoolMappingElementTable::mappingVersionColumn(), o2o::query, run_regression::ret, ora::PoolClassVersionTable::tableName(), ora::PoolMappingElementTable::tableName(), and ora::PoolContainerHeaderTable::tableName().
{ bool ret = false; std::auto_ptr<coral::IQuery> query( m_schema.newQuery() ); query->addToTableList( PoolClassVersionTable::tableName(), "T0" ); query->addToTableList( PoolContainerHeaderTable::tableName(), "T1" ); query->addToTableList( PoolMappingElementTable::tableName(), "T2" ); query->addToOutputList( "T0."+PoolClassVersionTable::mappingVersionColumn() ); query->setDistinct(); std::ostringstream condition; condition <<"T0."<<PoolClassVersionTable::containerNameColumn()<<" = "<<"T1."<<PoolContainerHeaderTable::containerNameColumn(); condition <<" AND T0."<<PoolClassVersionTable::mappingVersionColumn()<<" = "<<"T2."<<PoolMappingElementTable::mappingVersionColumn(); condition <<" AND T1."<<PoolContainerHeaderTable::containerIdColumn()<<" =:"<<PoolContainerHeaderTable::containerIdColumn(); coral::AttributeList condData; condData.extend< int >( PoolContainerHeaderTable::containerIdColumn() ); condData[ PoolContainerHeaderTable::containerIdColumn() ].data< int >() = containerId + 1; //POOL starts counting from 1!; if( onlyDependency ){ condition <<" AND T2."<<PoolMappingElementTable::elementTypeColumn() <<" = :"<<PoolMappingElementTable::elementTypeColumn(); condData.extend< std::string >( PoolMappingElementTable::elementTypeColumn() ); condData[PoolMappingElementTable::elementTypeColumn() ].data<std::string>() = MappingElement::dependencyMappingElementType(); } 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[ "T0."+PoolClassVersionTable::mappingVersionColumn() ].data<std::string>(); dest.insert( mappingVersion ); } return ret; }
bool ora::PoolMappingSchema::getMappingVersionListForTable | ( | const std::string & | tableName, |
std::set< std::string > & | destination | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 1043 of file PoolDatabaseSchema.cc.
{ // not implemented for the moment return false; }
bool ora::PoolMappingSchema::getVersionList | ( | std::set< std::string > & | destination | ) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 762 of file PoolDatabaseSchema.cc.
References ora::PoolMappingVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, and ora::PoolMappingVersionTable::tableName().
{ bool ret = false; std::auto_ptr<coral::IQuery> query( m_schema.tableHandle( PoolMappingVersionTable::tableName() ).newQuery() ); query->addToOutputList( PoolMappingVersionTable::mappingVersionColumn() ); coral::ICursor& cursor = query->execute(); while ( cursor.next() ) { ret = true; const coral::AttributeList& currentRow = cursor.currentRow(); std::string mappingVersion = currentRow[ PoolMappingVersionTable::mappingVersionColumn()].data<std::string>(); dest.insert( mappingVersion ); } return ret; }
void ora::PoolMappingSchema::init | ( | PoolDbCache & | dbCache | ) |
Definition at line 758 of file PoolDatabaseSchema.cc.
Referenced by ora::PoolDatabaseSchema::PoolDatabaseSchema().
{ m_dbCache = &dbCache; }
void ora::PoolMappingSchema::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 1097 of file PoolDatabaseSchema.cc.
References ora::PoolClassVersionTable::classVersionColumn(), ora::PoolClassVersionTable::containerNameColumn(), idDealer::inputData, ora::PoolClassVersionTable::mappingVersionColumn(), ora::PoolClassVersionTable::tableName(), and ora::throwException().
{ if(!m_dbCache){ throwException("MappingSchema handle has not been initialized.","PoolMappingSchema::insertClassVersion"); } coral::ITable& classVersionTable = m_schema.tableHandle( PoolClassVersionTable::tableName() ); coral::AttributeList inputData; inputData.extend<std::string>( PoolClassVersionTable::mappingVersionColumn()); inputData.extend<std::string>( PoolClassVersionTable::classVersionColumn()); inputData.extend<std::string>( PoolClassVersionTable::containerNameColumn()); std::string containerName = m_dbCache->nameById( containerId ); coral::AttributeList::iterator iInAttr = inputData.begin(); iInAttr->data< std::string >() = mappingVersion; ++iInAttr; iInAttr->data< std::string >() = classVersion; ++iInAttr; iInAttr->data< std::string >() = containerName; classVersionTable.dataEditor().insertRow( inputData ); }
void ora::PoolMappingSchema::removeMapping | ( | const std::string & | version | ) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 934 of file PoolDatabaseSchema.cc.
References ora::PoolMappingVersionTable::mappingVersionColumn(), ora::PoolClassVersionTable::tableName(), ora::PoolMappingElementTable::tableName(), and ora::PoolMappingVersionTable::tableName().
{ // Remove all rows in the tables with the version. coral::AttributeList whereData; whereData.extend<std::string>( PoolMappingVersionTable::mappingVersionColumn() ); whereData.begin()->data<std::string>() = version; std::string condition = PoolMappingVersionTable::mappingVersionColumn() + " = :" + PoolMappingVersionTable::mappingVersionColumn(); m_schema.tableHandle( PoolClassVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData ); m_schema.tableHandle( PoolMappingElementTable::tableName() ).dataEditor().deleteRows( condition, whereData ); m_schema.tableHandle( PoolMappingVersionTable::tableName() ).dataEditor().deleteRows( condition, whereData ); }
bool ora::PoolMappingSchema::selectMappingVersion | ( | const std::string & | classId, |
int | containerId, | ||
std::string & | destination | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 1049 of file PoolDatabaseSchema.cc.
References ora::MappingRules::classNameFromBaseId(), ora::PoolClassVersionTable::classVersionColumn(), ora::MappingRules::classVersionFromId(), ora::PoolContainerHeaderTable::containerIdColumn(), ora::PoolClassVersionTable::containerNameColumn(), ora::PoolContainerHeaderTable::containerNameColumn(), ora::PoolDbCacheData::m_className, ora::PoolDbCacheData::m_mappingVersion, ora::PoolClassVersionTable::mappingVersionColumn(), o2o::query, run_regression::ret, ora::PoolClassVersionTable::tableName(), and ora::PoolContainerHeaderTable::tableName().
{ bool ret = false; destination.clear(); std::pair<bool,std::string> isBaseId = MappingRules::classNameFromBaseId( classId ); if( !isBaseId.first ){ std::auto_ptr<coral::IQuery> query( m_schema.newQuery() ); query->addToTableList( PoolClassVersionTable::tableName(), "T0" ); query->addToTableList( PoolContainerHeaderTable::tableName(), "T1" ); query->addToOutputList( "T0."+PoolClassVersionTable::mappingVersionColumn() ); std::ostringstream condition; condition <<"T0."<<PoolClassVersionTable::containerNameColumn()<<" = "<<"T1."<<PoolContainerHeaderTable::containerNameColumn(); condition << " AND T0."<<PoolClassVersionTable::classVersionColumn() << " =:" <<PoolClassVersionTable::classVersionColumn(); condition << " AND T1."<<PoolContainerHeaderTable::containerIdColumn() << " =:" <<PoolContainerHeaderTable::containerIdColumn(); coral::AttributeList condData; condData.extend<std::string>( PoolClassVersionTable::classVersionColumn() ); condData.extend<int>( PoolContainerHeaderTable::containerIdColumn() ); coral::AttributeList::iterator iAttribute = condData.begin(); iAttribute->data< std::string >() = MappingRules::classVersionFromId( classId ); ++iAttribute; iAttribute->data< int >() = containerId + 1; //POOL starts counting from 1!; query->setCondition( condition.str(), condData ); coral::ICursor& cursor = query->execute(); while ( cursor.next() ) { ret = true; const coral::AttributeList& currentRow = cursor.currentRow(); destination = currentRow["T0."+PoolClassVersionTable::mappingVersionColumn()].data<std::string>(); } } else { PoolDbCacheData& containerData = m_dbCache->find( containerId ); // in POOL db this will be only possible for top level classes (not for dependencies) if( containerData.m_className == isBaseId.second ){ destination = containerData.m_mappingVersion; ret = true; } } return ret; }
void ora::PoolMappingSchema::setMappingVersion | ( | const std::string & | classId, |
int | containerId, | ||
const std::string & | mappingVersion | ||
) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 1123 of file PoolDatabaseSchema.cc.
References ora::PoolClassVersionTable::classVersionColumn(), ora::MappingRules::classVersionFromId(), ora::PoolClassVersionTable::containerNameColumn(), idDealer::inputData, ora::PoolClassVersionTable::mappingVersionColumn(), ora::PoolClassVersionTable::tableName(), and ora::throwException().
{ if(!m_dbCache){ throwException("MappingSchema handle has not been initialized.","PoolMappingSchema::setMappingVersion"); } coral::ITable& classVersionTable = m_schema.tableHandle( PoolClassVersionTable::tableName() ); coral::AttributeList inputData; inputData.extend<std::string>( PoolClassVersionTable::mappingVersionColumn()); inputData.extend<std::string>( PoolClassVersionTable::classVersionColumn()); inputData.extend<std::string>( PoolClassVersionTable::containerNameColumn()); std::string classVersion = MappingRules::classVersionFromId( classId ); std::string containerName = m_dbCache->nameById( containerId ); coral::AttributeList::iterator iInAttr = inputData.begin(); iInAttr->data< std::string >() = mappingVersion; ++iInAttr; iInAttr->data< std::string >() = classVersion; ++iInAttr; iInAttr->data< std::string >() = containerName; std::string setClause = PoolClassVersionTable::mappingVersionColumn()+" =:"+ PoolClassVersionTable::mappingVersionColumn(); std::string whereClause = PoolClassVersionTable::classVersionColumn()+" =:"+ PoolClassVersionTable::classVersionColumn()+" AND "+ PoolClassVersionTable::containerNameColumn()+" =:"+ PoolClassVersionTable::containerNameColumn(); classVersionTable.dataEditor().updateRows( setClause,whereClause, inputData ); }
void ora::PoolMappingSchema::storeMapping | ( | const MappingRawData & | mapping | ) | [virtual] |
Implements ora::IMappingSchema.
Definition at line 892 of file PoolDatabaseSchema.cc.
References ora::PoolMappingElementTable::columnNameColumn(), ora::PoolMappingElementTable::elementIdColumn(), ora::MappingRawData::elements, ora::PoolMappingElementTable::elementTypeColumn(), ora::MappingRawElement::emptyScope(), ora::PoolMappingVersionTable::mappingVersionColumn(), ora::PoolMappingElementTable::mappingVersionColumn(), ora::PoolMappingElementTable::scopeNameColumn(), ora::PoolMappingElementTable::tableName(), ora::PoolMappingVersionTable::tableName(), ora::PoolMappingElementTable::tableNameColumn(), ora::PoolMappingElementTable::variableNameColumn(), ora::PoolMappingElementTable::variableParIndexColumn(), ora::PoolMappingElementTable::variableTypeColumn(), and ora::MappingRawData::version.
{ // first update the version table coral::ITable& mappingVersionTable = m_schema.tableHandle( PoolMappingVersionTable::tableName() ); coral::AttributeList rowBuffer; rowBuffer.extend< std::string >( PoolMappingVersionTable::mappingVersionColumn() ); rowBuffer[ PoolMappingVersionTable::mappingVersionColumn() ].data<std::string>()= mapping.version; mappingVersionTable.dataEditor().insertRow( rowBuffer ); // then update the element tables coral::ITable& mappingElementTable = m_schema.tableHandle( PoolMappingElementTable::tableName() ); coral::AttributeList dataBuffer; dataBuffer.extend< std::string >( PoolMappingElementTable::mappingVersionColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::elementIdColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::elementTypeColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::scopeNameColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::variableNameColumn() ); dataBuffer.extend< unsigned int >( PoolMappingElementTable::variableParIndexColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::variableTypeColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::tableNameColumn() ); dataBuffer.extend< std::string >( PoolMappingElementTable::columnNameColumn() ); dataBuffer[ PoolMappingElementTable::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++ ){ std::stringstream elemIdx; elemIdx << iElem->first; std::string scopeName = iElem->second.scopeName; if( scopeName == MappingRawElement::emptyScope() ) scopeName = std::string(" "); dataBuffer[ PoolMappingElementTable::elementIdColumn() ].data<std::string>() = elemIdx.str(); dataBuffer[ PoolMappingElementTable::elementTypeColumn()].data<std::string>()= iElem->second.elementType; dataBuffer[ PoolMappingElementTable::scopeNameColumn() ].data<std::string>()= scopeName; dataBuffer[ PoolMappingElementTable::variableNameColumn() ].data<std::string>()= iElem->second.variableName; dataBuffer[ PoolMappingElementTable::variableParIndexColumn() ].data<unsigned int>() = iParamIndex; dataBuffer[ PoolMappingElementTable::variableTypeColumn() ].data<std::string>()= iElem->second.variableType; dataBuffer[ PoolMappingElementTable::tableNameColumn() ].data<std::string>()= iElem->second.tableName; dataBuffer[ PoolMappingElementTable::columnNameColumn() ].data<std::string>()= iElem->second.columns[iParamIndex]; mappingElementTable.dataEditor().insertRow( dataBuffer ); } } }
PoolDbCache* ora::PoolMappingSchema::m_dbCache [private] |
Definition at line 198 of file PoolDatabaseSchema.h.
coral::ISchema& ora::PoolMappingSchema::m_schema [private] |
Definition at line 197 of file PoolDatabaseSchema.h.