Subject: Re: [boost] sqlpp11: SQL for C++
From: Roland Bock (rbock_at_[hidden])
Date: 2013-11-10 12:34:34
On 2013-11-10 15:58, niXman wrote:
> Roland Bock 2013-11-10 12:15:
>> No, sqlpp11 itself only depends on a decent C++11 compiler and matching
> I think I can write a code generator using boost.preprocessor. But I
> need the documentation of DDL, of course.
I was talking about SQL's DDL
every vendor seems to be using some additions, so that the task is not
too simple in all generality, I guess...
But using the preprocessor to generate the table types could be a very
nice tool in some cases. For instance if you are using in-memory
databases with Sqlite3. As a trivial byproduct it could also produce
the create table string, so that I would not have to maintain that in
two places. Also for such a purpose, it would make sense to restrict the
DDL to a common subset.
With larger tables, I guess I'd stick with my current approach though:
running a separate code-generator as part of the build process. The main
benefit is that I get clearer error message pointing to C++ code that
exists outside the compiler memory in case the code generator produces
incorrect output or I use the generated code in the wrong way, etc.
Another benefit of using external code generators is string handling. In
our company we use CamelCase for classes, camelCase for members and
underscore separated compounds for SQL names. An external code generator
can easily translate, of course, but the preprocessor is not equipped
for string manipulation, afaik.
But again, I can imagine a nice usage of a prepocessor-based code
generator for in-memory databases with no external representation.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk