[odb-users] [Question] Reverse code generation (.h from .sql)

Alexey Afanasyev aphongka at gmail.com
Fri Feb 11 10:56:09 EST 2011


Hi Boris,

On Wed, Feb 9, 2011 at 5:43 PM, Boris Kolpackov <boris at codesynthesis.com> wrote:
>
> Alexey Afanasyev <aphongka at gmail.com> writes:
>
>> But there is another scenario. There might be an existing DB structure
>> first and one might want to use ODB against it. So, the question is if
>> there is automation of the process of generating C++ entities (header
>> files) by existing DB structure. And if not, are there any plans to
>> make it?
>
> Yes, we are thinking about adding this support. The tricky part is to
> decide whether it should be a once-off or repetitive process. If you
> want to keep re-generating C++ classes from the database schema, then
> you cannot customize the generated code (e.g., add functions, etc.)
> since your changes will be over-written the next time you change the
> schema. On the other hand, by themselves the generated classes will
> be just data holders, so this is also somewhat limiting. Which scenario
> did you have in mind?

I use a third party database in my application so I am mapping its
schema to the c++ entities.
The mapping process consumes considerable time, so auto-generation would help.

I need also to be able to quickly react in case the database provider
changes the schema.
I might also switch to different database of different provider, so
auto-generation would help in this case as well.

Well, I plan to add some custom stuff to the entities' definitions
(sources for odb compiler), so I would expect regeneration process
would not remove my custom stuff.

> Boris
>

Alexey



More information about the odb-users mailing list