[odb-users] boost::variant<...> or boost::any for sqlite
Boris Kolpackov
boris at codesynthesis.com
Tue Aug 11 11:44:51 EDT 2015
MM <finjulhich at gmail.com> writes:
> I see this old thread:
> http://www.codesynthesis.com/pipermail/odb-users/2012-April/000494.html
>
> Are any of the types mappables now as of odb 2.4.0?
Here is what's possible as of 2.4.0:
1. If you are mapping to a database that has a variant/any type, then
you can use ODB support for extended database type mapping[1] to add
such a mapping. The mssql/custom test in the odb-tests package shows
how to do this for SQL Server.
[1] http://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/
2. Alternatively, you can map a specific variant instance (i.e., with
the specific set of possible types) using virtual data members (and
a composite value to hold nullable alternatives) as outlined in the
above post. Even better, for 2.5.0 you will be able to do this for
the type and not data member(s), in case you have multiple data
members that use the same type.
Boris
More information about the odb-users
mailing list