Public Member Functions | |
void | build (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema, RelationalBuffer &operationBuffer) |
DependentClassWriter () | |
void | write (int oId, int refId, const void *data) |
~DependentClassWriter () | |
Private Attributes | |
DataElement | m_dataElement |
InsertOperation * | m_depInsert |
std::auto_ptr< IRelationalWriter > | m_writer |
Definition at line 17 of file UniqueRefStreamer.cc.
ora::DependentClassWriter::DependentClassWriter | ( | ) | [inline] |
Definition at line 20 of file UniqueRefStreamer.cc.
: m_dataElement(), m_writer(), m_depInsert( 0 ){ }
ora::DependentClassWriter::~DependentClassWriter | ( | ) | [inline] |
Definition at line 48 of file UniqueRefStreamer.cc.
{ }
void ora::DependentClassWriter::build | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | contSchema, | ||
RelationalBuffer & | operationBuffer | ||
) | [inline] |
Definition at line 26 of file UniqueRefStreamer.cc.
References ora::InputRelationalData::addId(), ora::MappingElement::columnNames(), ora::MappingElement::end(), ora::MappingElement::find(), m_dataElement, m_depInsert, m_writer, ora::RelationalBuffer::newInsert(), ora::RelationalStreamerFactory::newWriter(), ora::MappingElement::tableName(), and ora::throwException().
Referenced by ora::UniqueRefWriter::write().
{ m_depInsert = &operationBuffer.newInsert( mapping.tableName()); const std::vector<std::string> columns = mapping.columnNames(); for( std::vector<std::string>::const_iterator iC = columns.begin(); iC != columns.end(); ++iC){ m_depInsert->addId( *iC ); } MappingElement::iterator iMe = mapping.find( objectType.Name(Reflex::SCOPED) ); // the first inner mapping is the relevant... if( iMe == mapping.end()){ throwException("Could not find a mapping element for class \""+ objectType.Name(Reflex::SCOPED)+"\"", "DependentClassWriter::write"); } RelationalStreamerFactory streamerFactory( contSchema ); m_writer.reset( streamerFactory.newWriter( objectType, iMe->second ) ); m_writer->build( m_dataElement, *m_depInsert, operationBuffer ); }
void ora::DependentClassWriter::write | ( | int | oId, |
int | refId, | ||
const void * | data | ||
) | [inline] |
Definition at line 51 of file UniqueRefStreamer.cc.
References ora::InputRelationalData::data(), m_depInsert, m_writer, and ora::throwException().
Referenced by ora::UniqueRefWriter::write().
{ if( !m_depInsert ){ throwException( "DependentClassWriter has not been built.", "DependentClassWriter::write"); } coral::AttributeList& dataBuff = m_depInsert->data(); coral::AttributeList::iterator iData = dataBuff.begin(); iData->data<int>()= oId; ++iData; iData->data<int>()= refId; // transfering the refId std::vector<int> recordId(1,refId); m_writer->setRecordId( recordId); m_writer->write( oId, data ); }
Definition at line 69 of file UniqueRefStreamer.cc.
Referenced by build().
Definition at line 71 of file UniqueRefStreamer.cc.
std::auto_ptr<IRelationalWriter> ora::DependentClassWriter::m_writer [private] |
Definition at line 70 of file UniqueRefStreamer.cc.