#include <BlobStreamer.h>
Public Member Functions | |
void | bindData (const void *data) |
BlobWriterBase (const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema) | |
bool | buildDataElement (DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer) |
virtual | ~BlobWriterBase () |
Private Attributes | |
IBlobStreamingService * | m_blobWriter |
int | m_columnIndex |
DataElement * | m_dataElement |
MappingElement & | m_mapping |
Reflex::Type | m_objectType |
RelationalBuffer * | m_relationalBuffer |
IRelationalData * | m_relationalData |
ContainerSchema & | m_schema |
bool | m_useCompression |
Definition at line 15 of file BlobStreamer.h.
ora::BlobWriterBase::BlobWriterBase | ( | const Reflex::Type & | objectType, |
MappingElement & | mapping, | ||
ContainerSchema & | contSchema | ||
) |
Definition at line 16 of file BlobStreamer.cc.
: m_objectType( objectType ), m_mapping( mapping ), m_columnIndex(-1), m_schema( contSchema ), m_dataElement( 0 ), m_relationalData( 0 ), m_relationalBuffer( 0 ), m_blobWriter( 0 ), m_useCompression( true ){ }
ora::BlobWriterBase::~BlobWriterBase | ( | ) | [virtual] |
Definition at line 30 of file BlobStreamer.cc.
{ }
void ora::BlobWriterBase::bindData | ( | const void * | data | ) |
Definition at line 55 of file BlobStreamer.cc.
References ora::throwException().
{ if( ! m_dataElement ){ throwException( "The streamer has not been built.", "BlobWriterBase::bindData"); } void* dataElementAddress = m_dataElement->address( data ); coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ]; boost::shared_ptr<coral::Blob> blobData = m_blobWriter->write( dataElementAddress, m_objectType, m_useCompression ); m_relationalBuffer->storeBlob( blobData ); relDataElement.bind<coral::Blob>( *blobData ); }
bool ora::BlobWriterBase::buildDataElement | ( | DataElement & | dataElement, |
IRelationalData & | relationalData, | ||
RelationalBuffer & | operationBuffer | ||
) |
Definition at line 33 of file BlobStreamer.cc.
References ora::IRelationalData::addBlobData(), ora::poolSchemaVersion(), and ora::throwException().
{ if( m_mapping.columnNames().size() == 0 ){ throwException( "The mapping element does not contain columns.", "BlobWriterBase::build"); } m_dataElement = &dataElement; std::string columnName = m_mapping.columnNames()[0]; m_columnIndex = relationalData.addBlobData( columnName ); m_relationalData = &relationalData; m_relationalBuffer = &operationBuffer; m_blobWriter = m_schema.blobStreamingService(); if(!m_blobWriter){ throwException("Blob Streaming Service is not installed.", "BlobWriterBase::::build"); } if( m_schema.dbSession().schema().mainTable().schemaVersion()==poolSchemaVersion() ) m_useCompression = false; return true; }
Definition at line 36 of file BlobStreamer.h.
int ora::BlobWriterBase::m_columnIndex [private] |
Definition at line 29 of file BlobStreamer.h.
DataElement* ora::BlobWriterBase::m_dataElement [private] |
Definition at line 33 of file BlobStreamer.h.
MappingElement& ora::BlobWriterBase::m_mapping [private] |
Definition at line 28 of file BlobStreamer.h.
Reflex::Type ora::BlobWriterBase::m_objectType [private] |
Definition at line 27 of file BlobStreamer.h.
Definition at line 35 of file BlobStreamer.h.
Definition at line 34 of file BlobStreamer.h.
ContainerSchema& ora::BlobWriterBase::m_schema [private] |
Definition at line 30 of file BlobStreamer.h.
bool ora::BlobWriterBase::m_useCompression [private] |
Definition at line 37 of file BlobStreamer.h.