[Qt-interest] [ANN] ODB C++ ORM adds support for Qt
Boris Kolpackov
boris at codesynthesis.com
Thu Apr 28 17:00:17 CEST 2011
Hi Jason,
Jason H <scorp1us at yahoo.com> writes:
> One topic not covered (missing?) is multiple arbitrary table joins for
> queries. I do a ton of these a day. Is that something that is not there
> yet?
You can do it indirectly, via object relationships. For example:
class Employer
{
...
QString name_;
};
class Employee
{
...
QString name_;
QLazySharedPointer<Employer> employer_;
};
Then you can do:
result r = db->query<Employee> (Query::name == "John Doe" &&
Query::employer::name == "Example, Inc");
In this query the Employer and Employee tables will be joined using
object ids in the ON condition.
It that something that would work for you?
> Also, it would be really cool (but not even NHibernate does this yet,
> IIRC) if these arbitrary queries could return a QObject derived class
> (creating the type at run-time via QMetaObject or minimally a QVariantMap.)
Well, that doesn't fall into the object-relational mapping per se. It
is just a convenient way to handle SQL result sets. While you can use
ODB like this (e.g., define plain struct's that just hold the data),
I am not sure about trying to actively support two very different
approaches to working with a database in the same tool.
Boris
More information about the Qt-interest-old
mailing list