Public Member Functions | |
void | build (const Reflex::Type &objectType, MappingElement &depMapping, ContainerSchema &contSchema) |
DependentClassReader () | |
void * | read (int refId) |
~DependentClassReader () | |
Private Attributes | |
DataElement | m_dataElement |
std::auto_ptr< SelectOperation > | m_depQuery |
std::auto_ptr< IRelationalReader > | m_reader |
Reflex::Type | m_type |
Definition at line 74 of file UniqueRefStreamer.cc.
ora::DependentClassReader::DependentClassReader | ( | ) | [inline] |
Definition at line 76 of file UniqueRefStreamer.cc.
: m_dataElement(), m_type(), m_reader(), m_depQuery(){ }
ora::DependentClassReader::~DependentClassReader | ( | ) | [inline] |
Definition at line 101 of file UniqueRefStreamer.cc.
{ }
void ora::DependentClassReader::build | ( | const Reflex::Type & | objectType, |
MappingElement & | depMapping, | ||
ContainerSchema & | contSchema | ||
) | [inline] |
Definition at line 83 of file UniqueRefStreamer.cc.
References ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_dataElement, m_depQuery, m_reader, m_type, ora::RelationalStreamerFactory::newReader(), ora::ContainerSchema::storageSchema(), ora::MappingElement::tableName(), and ora::throwException().
Referenced by ora::RelationalRefLoader::build().
{ m_type = objectType; m_depQuery.reset( new SelectOperation( depMapping.tableName(), contSchema.storageSchema())); m_depQuery->addWhereId( depMapping.columnNames()[ 1 ] ); MappingElement::iterator iMap = depMapping.find( m_type.Name(Reflex::SCOPED) ); // the first inner mapping is the good one ... if( iMap == depMapping.end()){ throwException("Could not find a mapping element for class \""+ m_type.Name(Reflex::SCOPED)+"\"", "DependentClassReadBuffer::ReadBuffer"); } MappingElement& mapping = iMap->second; RelationalStreamerFactory streamerFactory( contSchema ); m_reader.reset( streamerFactory.newReader( m_type, mapping )) ; m_reader->build( m_dataElement , *m_depQuery ); }
void* ora::DependentClassReader::read | ( | int | refId | ) | [inline] |
Definition at line 104 of file UniqueRefStreamer.cc.
References ora::ClassUtils::constructObject(), m_depQuery, m_reader, m_type, and ora::throwException().
Referenced by ora::RelationalRefLoader::load().
{ if( !m_depQuery.get() ){ throwException( "DependentClassReader has not been built.", "DependentClassReader::read"); } coral::AttributeList& whereData = m_depQuery->whereData(); coral::AttributeList::iterator iWData = whereData.begin(); iWData->data<int>() = refId; m_depQuery->execute(); m_reader->select( refId ); void* destination = 0; if( m_depQuery->nextCursorRow() ){ destination = ClassUtils::constructObject( m_type ); m_reader->read( destination ); } m_depQuery->clear(); return destination; }
Definition at line 124 of file UniqueRefStreamer.cc.
Referenced by build().
std::auto_ptr<SelectOperation> ora::DependentClassReader::m_depQuery [private] |
Definition at line 127 of file UniqueRefStreamer.cc.
std::auto_ptr<IRelationalReader> ora::DependentClassReader::m_reader [private] |
Definition at line 126 of file UniqueRefStreamer.cc.
Reflex::Type ora::DependentClassReader::m_type [private] |
Definition at line 125 of file UniqueRefStreamer.cc.