13 #include "CoralBase/Attribute.h"
14 #include "CoralBase/Blob.h"
19 m_objectType( objectType ),
21 m_schema( contSchema ),
23 m_relationalData( 0 ),
24 m_relationalBuffer( 0 ),
26 m_useCompression(
true ){
39 if( m_columnName.empty() ){
41 "BlobWriterBase::build");
44 m_dataElement = &dataElement;
46 m_relationalData = &relationalData;
47 m_relationalBuffer = &operationBuffer;
48 m_blobWriter = m_schema.blobStreamingService();
51 "BlobWriterBase::::build");
53 if( m_schema.dbSession().schema().mainTable().schemaVersion()==
poolSchemaVersion() ) m_useCompression =
false;
58 if( ! m_dataElement ){
60 "BlobWriterBase::bindData");
62 void* dataElementAddress = m_dataElement->address( data );
63 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnName ];
64 boost::shared_ptr<coral::Blob> blobData = m_blobWriter->write( dataElementAddress, m_objectType, m_useCompression );
65 m_relationalBuffer->storeBlob( blobData );
66 relDataElement.bind<coral::Blob>( *blobData );
81 return buildDataElement( dataElement, relationalData, relationalBuffer );
104 return buildDataElement( dataElement, relationalData, relationalBuffer );
119 m_objectType( objectType ),
121 m_schema( contSchema ),
123 m_relationalData( 0 ),
137 if( m_columnName.empty() ){
139 "BlobReader::build");
142 m_dataElement = &dataElement;
144 m_relationalData = &relationalData;
145 m_blobReader = m_schema.blobStreamingService();
148 "BlobReader::build");
160 if( ! m_dataElement ){
164 void* dataElementAddress = m_dataElement->address( data );
165 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnName ];
166 m_blobReader->read(relDataElement.data<coral::Blob>(), dataElementAddress, m_objectType );
175 m_objectType( objectType ),
176 m_mapping( mapping ),
177 m_schema( contSchema ){
184 return new BlobWriter( m_objectType, m_mapping, m_schema );
188 return new BlobUpdater( m_objectType, m_mapping, m_schema );
192 return new BlobReader( m_objectType, m_mapping, m_schema );
virtual ~BlobWriterBase()
bool buildDataElement(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
BlobStreamer(const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
BlobWriterBase(const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void setRecordId(const std::vector< int > &identity)
void bindData(const void *data)
bool build(DataElement &dataElement, IRelationalData &relationalData)
std::string poolSchemaVersion()
void update(int oid, const void *data)
Updates a data element.
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
const std::vector< std::string > & columnNames() const
IRelationalUpdater * newUpdater()
void read(void *data)
Reads a data element.
void setRecordId(const std::vector< int > &identity)
BlobReader(const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void setRecordId(const std::vector< int > &identity)
IRelationalWriter * newWriter()
IRelationalReader * newReader()
void throwException(const std::string &message, const std::string &methodName)
BlobWriter(const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
virtual void addBlobData(const std::string &columnName)=0
BlobUpdater(const Reflex::Type &objectType, MappingElement &mapping, ContainerSchema &contSchema)
void write(int oid, const void *data)
Writes a data element.