[odb-users] Support for std::vector<unsigned char> and arrays

Boris Kolpackov boris at codesynthesis.com
Thu Nov 3 09:18:09 EDT 2011

Hi Chris,

Chris Richards <chris.richards at yellowfeather.co.uk> writes:

> Although ODB supports mapping the std::vector<char> type to the MySQL  
> BLOB and BINARY types it doesn't seem to support std::vector<unsigned  
> char>, standard arrays or boost arrays. See the class declaration below:
> [...]
> Is it possible to work around, or add support, for these data types?

Yes, in ODB you can map pretty much any C++ type to any database type
by providing the odb::value_traits class template specialization. The
'mapping' example in the odb-examples package shows how to do this.

Also, for the upcoming 1.7.0 release I have added built-in support
for mapping char[N], unsigned char[N], and vector<unsigned char> to
BLOB types (and added boost::array<char> to the TODO list). This
support is also included in the just released 1.7.0.a1, if you
would like to give it a try:



More information about the odb-users mailing list