Boost logo

Boost :

Subject: Re: [boost] Boost.SQL?
From: Maciej Sobczak (prog_at_[hidden])
Date: 2010-09-15 09:43:31


Hi,

On 9/15/2010 1:46 PM, Roland Bock wrote:

> OK, taking the first example from the SOCI project page:

> sql<< "select name, salary from persons where id ="<< id,
> into(name), into(salary);
[...]

> This is nice, but still requires attention where the compiler could
> help, if the table definition was known. Here is what it would look like
> in my version (assuming that I manage the transition to boost proto):
[...]

> Maybe it would make sense to add such a layer as an option to SOCI?

In all example programs SOCI takes the string as the query, but in fact
it can be anything that is "streamable".
This makes it possible to add any imaginable layer that will ultimately
end up as an object that will produce the intended text query when
streamed out.
That is:

sql << HERE-YOUR.SMART%STATIC|QUERY&MAKING*ENGINE,
     into(name), into(salary);

The problem is that there is still no relation between the query
(however it is made) and the bound data. A little bit more work would be
needed to provide this level of integration, but it can be done with
relative ease.

Please read this part of the SOCI documentation to see where such ideas
might fit:

http://soci.sourceforge.net/doc/interfaces.html

I think that the "core" interface is a proper level for this kind of
integration.

Regards,

-- 
Maciej Sobczak * www.msobczak.com * www.inspirel.com

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