[odb-users] Generate C++ classes from a DB

Boris Kolpackov boris at codesynthesis.com
Mon Jan 27 23:40:47 EST 2014


Hi Adrien,

Adrien G <adrien_chem at hotmail.com> writes:

> Do you have some command examples to generate the C++ model that reflects an
> existing DB? For example I'd like to generate C++ classes (using Qt
> bindings) to match an sqlite and mysql DB.

No, this is not supported, though it is on our TODO list. The problem
with this feature is that it is not exactly clear how to map tables to
classes in many cases. Mapping for things like relationships and
containers are not easy to deduce from the database schema. Also, you
seem to want to go a step further and have generated classes that
simultaneously match two schemas for two different databases. I don't
think we will ever support something like this; it is too AI'ish.

Note also that you can always write the classes by hand and then map
them to your existing schema(s). In your case, while it may seem like
a tedious approach, it is probably the only one that has a chance of
actually working.

Boris



More information about the odb-users mailing list