[odb-users] Re: odb-users Digest, Vol 68, Issue 12

علی دانش adanesh at noornet.net
Mon Apr 18 01:35:27 EDT 2016

Hi Boris,

I couldn't find 'table_name' in 'odb::object_traits<MyClass>' class in my project. Also this class doesn't have 'info' member. What's wrong? I'm using odb 2.4.0.
In addition, is there any way to find out the name of the relation table and the name of the fields in that table? For example, in my class I have a member like this:
QList<std::shared_ptr<OTHER_CLASS>> m_otherClassList;
How can I access to the name of them in code?



Date: Fri, 15 Apr 2016 18:59:47 +0200
From: Boris Kolpackov <boris at codesynthesis.com>
Subject: Re: [odb-users] Feature request
To: Marcel Nehring <mne at qosmotec.com>
Cc: "odb-users at codesynthesis.com" <odb-users at codesynthesis.com>
Message-ID: <boris.20160415184937 at codesynthesis.com>
Content-Type: text/plain; charset=us-ascii

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:




More information about the odb-users mailing list