8 #include "CoralBase/Attribute.h"
13 m_objectType( objectType ),
17 m_relationalData( 0 ){
25 if( m_mapping.columnNames().size()==0 ){
27 "PrimitiveStreamerBase::buildDataElement");
30 const std::type_info* attrType = &m_objectType.TypeInfo();
31 if(m_objectType.IsEnum()) attrType = &
typeid(
int);
33 std::string columnName = m_mapping.columnNames()[0];
34 m_columnIndex = relationalData.
addData( columnName, *attrType );
35 m_dataElement = &dataElement;
36 m_relationalData = &relationalData;
41 if( ! m_dataElement ){
43 "PrimitiveStreamerBase::bindDataForUpdate");
45 void* dataElementAddress = m_dataElement->address( data );
46 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
47 relDataElement.setValueFromAddress( dataElementAddress );
48 if(!relDataElement.isValidData()){
50 relDataElement.specification().name()+
51 "\" is not valid for RDBMS storage.",
52 "PrimitiveStreamerBase::bindDataForUpdate");
57 if( ! m_dataElement ){
59 "PrimitiveStreamerBase::bindDataForRead");
61 void* dataElementAddress = m_dataElement->address( data );
62 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
63 relDataElement.copyValueToAddress( dataElementAddress );
78 return buildDataElement( dataElement, relationalData );
85 bindDataForUpdate( data );
99 return buildDataElement( dataElement, relationalData );
107 bindDataForUpdate( data );
120 return buildDataElement( dataElement, relationalData );
130 bindDataForRead( data );
139 m_objectType( objectType ),
140 m_mapping( mapping ){
IRelationalUpdater * newUpdater()
bool isTypeString(const Reflex::Type &typ)
IRelationalWriter * newWriter()
virtual int addData(const std::string &columnName, const std::type_info &columnType)=0
bool buildDataElement(DataElement &dataElement, IRelationalData &relationalData)
virtual ~PrimitiveWriter()
PrimitiveUpdater(const Reflex::Type &objectType, MappingElement &mapping)
void setRecordId(const std::vector< int > &identity)
void write(int oid, const void *data)
Writes a data element.
PrimitiveStreamerBase(const Reflex::Type &objectType, MappingElement &mapping)
PrimitiveWriter(const Reflex::Type &objectType, MappingElement &mapping)
void read(void *data)
Reads a data element.
virtual ~PrimitiveUpdater()
virtual ~PrimitiveStreamerBase()
void update(int oid, const void *data)
Updates a data element.
PrimitiveStreamer(const Reflex::Type &objectType, MappingElement &mapping)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
void bindDataForRead(void *data)
PrimitiveReader(const Reflex::Type &objectType, MappingElement &mapping)
char data[epos_bytes_allocation]
void setRecordId(const std::vector< int > &identity)
void bindDataForUpdate(const void *data)
bool build(DataElement &dataElement, IRelationalData &relationalData)
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
IRelationalReader * newReader()
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
virtual ~PrimitiveReader()
void setRecordId(const std::vector< int > &identity)