[odb-users] table_name in ODB 2.2.0

Boris Kolpackov boris at codesynthesis.com
Mon May 6 02:47:24 EDT 2013


Hi Reza,

Reza Jahanbakhshi <reza.jahanbakhshi at gmail.com> writes:

> In ODB 2.1.0 I could use object_traits<class>::table_name to find physical
> name of table in database to use in custom queries. But ODB 2.2.0 there is
> no table_name member in object_trait class. What is the preferred method
> to achieve this?

In ODB 2.2.0 we've added multi-database support which required some
changes to the traits structure. The table name is still there, but
it is now in the database-specific object_traits_impl class rather
than common object_traits (it is possible to map the same class to
different tables in different databases).

If you don't use multi-database support, then you can access the
table name like this:

odb::object_traits_impl<my_object, odb::id_common>::table_name

If you do use multi-database support, then you will need to specify
the database, for example:

odb::object_traits_impl<my_object, odb::id_sqlite>::table_name

Boris



More information about the odb-users mailing list