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

Adrien G adrien_chem at hotmail.com
Tue Jan 28 03:23:12 EST 2014


Thanks for your answer! Indeed i guess this is a tricky feature to implement ^^ No i didnt want to link two db at once its actually two different projects ;)
Once that said, imagine you have a db with hundred of tables, its insane to code it by hand, for time and human errors reasons ^^ do you have a roadmap for this feature ? Is there any other c++ lib which supports this ?

Thanks and good luck :)

Sent from my Windows Phone
________________________________
From: Boris Kolpackov<mailto:boris at codesynthesis.com>
Sent: ‎28/‎01/‎2014 05:38
To: Adrien G<mailto:adrien_chem at hotmail.com>
Cc: odb-users at codesynthesis.com<mailto:odb-users at codesynthesis.com>
Subject: Re: [odb-users] Generate C++ classes from a DB

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