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

Johannes Lochmann johannes.lochmann at gmail.com
Tue Jan 28 04:27:12 EST 2014


If it is only for plain data structs vor classes this could be achieved
quite easily with a scripting language of your choice and a bit of SQL, i
guess...
Am 28.01.2014 09:24 schrieb "Adrien G" <adrien_chem at hotmail.com>:

> 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