Boost logo

Boost :

Subject: Re: [boost] sqlpp11: SQL for C++
From: Christof Donat (cd_at_[hidden])
Date: 2013-11-11 15:59:22


Hi,

> On 2013-11-11 21:14, Larry Evans wrote:
> > On 11/11/13 13:35, Abel Sinkovics wrote:
> >> There is a library (Metaparse) which supports creating a string-based
> >> interface for libraries which is processed at compile-time. It could be
> >> used to provide a string-based interface. For example instead of this:
> >>
> >> auto result = db.run(select(persons.name,
> >> persons.salary).from(persons).where(persons.id == 17));
> >>
> >> Your library could have the following interface:
> >>
> >> auto result = db.run(QUERY("select name,salary from persons where
> >> id=17"));
>
> Metaparse requires const char[N] arguments, right?

No. It uses the preprocessor to generate something like

metaparse::string<'s','e','l','e','c','t',' ','n',',...>

The downside is, that metaparse has a configurable maximum string length and
increasing it also increases compile times. I am not sure, weather it would be
possible to have reasonable compile times with SQL strings as they exist in
real world applications.

Christof

-- 
okunah gmbh i.L.                             Software nach Maß
Zugspitzstr. 211                                 www.okunah.de
86165 Augsburg                                    cd_at_[hidden]
                                      Registergericht Augsburg
Geschäftsführer                             Augsburg HRB 21896
Christof Donat                           UStID: DE 248 815 055

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk