[odb-users] Feature request
Boris Kolpackov
boris at codesynthesis.com
Fri Apr 15 12:59:47 EDT 2016
Hi Marcel,
Marcel Nehring <mne at qosmotec.com> writes:
> I saw that there are already variables defined holding the name of database tables
>
> odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name
>
> Would it be possible to make them accessible to the user of ODB?
You already can as odb::object_traits<MyClass>::table_name (it derives
from *_impl). While it is not documented, you can rely on it, I don't
think we will already call it anything else or remove it.
> A similar problem arises if I need to manually specify to load only a
> specific level of a polymorphic object. Currently I use a query condition on
> the typeid_ member of ODBs query class. But I have to provide the class name
> manually as string, which is error prone and does not include any compile
> time checks. If I could write something like
>
> db.query<MyClass>(odb::query<MyClass>::typeid_ == MyClass);
>
> or similar this would avoid possible runtime errors as well.
Again, I believe you can already access it like this:
odb::object_traits<MyClass>::info.discriminator
Boris
More information about the odb-users
mailing list