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

Alexey Afanasyev aphongka at gmail.com
Wed Feb 9 06:58:32 EST 2011


Hello,

There was the following discussion in the [Questions and future
direction of ODB] thread:

> > >  4. Can't the ODB code generator insert the "friend class odb::access;"
> > >  in entities that it finds so that the user does not have to do that?
> > >  Same with the #include<odb/core.hxx>
> >
> > While the friend declaration can be annoying, I don't think it is a
> > good idea for ODB to modify hand-written C++ headers. Plus, there is
> > no guarantee that the header won't be compiled by the native C++
> > compiler before ODB had a chance to change it.
> >
> >
> If you already generate code, what harm is there in making it a little
> easier to use by making it harder to forget "boilerplate" code.

I might be wrong but I guess this was about the topic.

There is one possible scenario implied by ODB - starting development
with C++ entities. One should create C++ classes (header files) first
and then generate SQL sentences to create an appropriate DB structure.

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?

Thanks,
Alexey



More information about the odb-users mailing list