[odb-users] collection mapping error

c.sell at byterefinery.de c.sell at byterefinery.de
Tue Mar 7 08:26:04 EST 2017


Hi Boris,

> Right, since std::vector<> has no notion of a NULL value.

It is your choice to represent an empty vector<char> by an empty byte  
sequence. It was my choice to represent an empty image by a NULL  
value. This is only dealing with how they are stored, the collection  
that holds them still sees the empty value

> None of this is correct/makes sense. But I hope the above explanations
> will help (if not, please read the manual; we both could have saved a
> lot of time if you did so from the beginning).

Sorry, but I dont see how reading the manual would have helped. I was  
faced with an error message stating "object already persistent", when  
in fact it was a constraint violation caused by a non-obvious (and  
undocumented) interdependence between the default data model (NOT NULL  
constraints on collection value columns) and the traits implementation  
(which should not set the NULL marker if used with the default data  
model).

I suggest an amendment to the documentation that points to the fact  
that the default data model for collections imposes NOT NULL  
constraints (I may have overread that). And maybe even some hint on  
how to deal with is_null in traits implementations (I dont think I  
overread that, I searched thoroughly for docs and only found a  
reference to sample code).

Anyway, not an issue, this is a free lunch. I just don't want to "not  
make sense".

May I still take you up on your offer regarding the pre-release build  
for windows?

regards,
Christian



More information about the odb-users mailing list