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.isEnum() ? &
typeid(int) : &m_objectType.typeInfo();
32 std::string columnName = m_mapping.columnNames()[0];
33 m_columnIndex = relationalData.
addData( columnName, *attrType );
34 m_dataElement = &dataElement;
35 m_relationalData = &relationalData;
40 if( ! m_dataElement ){
42 "PrimitiveStreamerBase::bindDataForUpdate");
44 void* dataElementAddress = m_dataElement->address( data );
45 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
46 relDataElement.setValueFromAddress( dataElementAddress );
47 if(!relDataElement.isValidData()){
49 relDataElement.specification().name()+
50 "\" is not valid for RDBMS storage.",
51 "PrimitiveStreamerBase::bindDataForUpdate");
56 if( ! m_dataElement ){
58 "PrimitiveStreamerBase::bindDataForRead");
60 void* dataElementAddress = m_dataElement->address( data );
61 coral::Attribute& relDataElement = m_relationalData->data()[ m_columnIndex ];
62 relDataElement.copyValueToAddress( dataElementAddress );
77 return buildDataElement( dataElement, relationalData );
84 bindDataForUpdate( data );
98 return buildDataElement( dataElement, relationalData );
106 bindDataForUpdate( data );
119 return buildDataElement( dataElement, relationalData );
129 bindDataForRead( data );
138 m_objectType( objectType ),
139 m_mapping( mapping ){
IRelationalUpdater * newUpdater()
PrimitiveUpdater(const edm::TypeWithDict &objectType, MappingElement &mapping)
IRelationalWriter * newWriter()
virtual int addData(const std::string &columnName, const std::type_info &columnType)=0
bool isTypeString(const edm::TypeWithDict &typ)
bool buildDataElement(DataElement &dataElement, IRelationalData &relationalData)
virtual ~PrimitiveWriter()
PrimitiveWriter(const edm::TypeWithDict &objectType, MappingElement &mapping)
void setRecordId(const std::vector< int > &identity)
void write(int oid, const void *data)
Writes a data element.
void read(void *data)
Reads a data element.
virtual ~PrimitiveUpdater()
PrimitiveStreamer(const edm::TypeWithDict &objectType, MappingElement &mapping)
virtual ~PrimitiveStreamerBase()
void update(int oid, const void *data)
Updates a data element.
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
void bindDataForRead(void *data)
void setRecordId(const std::vector< int > &identity)
void bindDataForUpdate(const void *data)
bool build(DataElement &dataElement, IRelationalData &relationalData)
PrimitiveStreamerBase(const edm::TypeWithDict &objectType, MappingElement &mapping)
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
IRelationalReader * newReader()
PrimitiveReader(const edm::TypeWithDict &objectType, MappingElement &mapping)
bool build(DataElement &dataElement, IRelationalData &relationalData, RelationalBuffer &operationBuffer)
virtual ~PrimitiveReader()
void setRecordId(const std::vector< int > &identity)