[odb-users] followup - storing a UUID as binary(16) in mysql

Douglas Tomm dctomm at gmail.com
Tue Jul 31 13:46:48 EDT 2012


i'm writing to follow up on the recent discussion on mapping boost uuids to
binary(16), as i have been working on the same problem.  when i tried
defining my own value traits specialization, as in this post:


i used this command line (with hxx-epilogue):

/opt/odb-2.0.0-i686-linux-gnu/bin/odb -I. -I/usr/local/include --database
mysql --generate-query --hxx-epilogue '#include "uuid_traits.h"' mytest.h

here is the version info for my environment:

- odb 2.0.0
- gcc 4.1.2
- boost 1.46.1
- centos 5 linux

here are some of the error messages.  the errors about specialization after
initialization and previous definitions of the default_value_traits are the
ones i can't seem to fix.  has anyone seen these errors before?

g++ -o mytest-odb.os -c -g -fPIC -DHAVE_CONFIG_H -DDATABASE_MYSQL
-I/usr/local/include mytest-odb.cxx
build/cpp/odb/uuid_traits.h:18: error: specialization of
'odb::mysql::default_value_traits<boost::uuids::uuid, id_blob>' after
build/cpp/odb/uuid_traits.h:18: error: redefinition of 'struct
odb::mysql::default_value_traits<boost::uuids::uuid, id_blob>'
/usr/local/include/odb/mysql/traits.hxx:302: error: previous definition of
'struct odb::mysql::default_value_traits<boost::uuids::uuid, id_blob>'
mytest-odb.cxx: In static member function 'static boost::uuids::uuid
mytest-odb.cxx:50: error: no matching function for call to
id_blob>::set_value(boost::uuids::uuid&, const odb::details::buffer&, const
long unsigned int&, const my_bool&)'
/usr/local/include/odb/mysql/traits.hxx:308: note: candidates are: static
void odb::mysql::default_value_traits<T, <anonymous> >::set_value(T&, const
typename odb::mysql::image_traits<ID>::image_type&, bool) [with T =
boost::uuids::uuid, odb::mysql::database_type_id ID = id_blob]

many thanks,

More information about the odb-users mailing list