Boost logo

Boost :

Subject: [boost] Relational database library (was: [GSOC] Are we going to participate?)
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-02-14 10:46:25


On 14 February 2013 09:40, Roland Bock <rbock_at_[hidden]> wrote:
> On 2013-02-14 06:04, Michael Marcin wrote:
>> - relational database library (what ever happened with boost and soci?)
> FYI:
> I am currently working on a C++11 SQL library. Once you declare your
> table structures in C++, it will allow you to express queries very close
> to SQL: For example:
>
> TabSample t;
> auto results = sql::select(sql::distinct, t.b, t.c)
> .from(t)
> .where(t.a > 7 and t.b != "cheesecake")
> .order_by(t.c).run(db);
>
> for (auto row: results)
> {
> int a = row.a;
> std::string c = row.c;
> }
>
> The library will take care of escaping (to prevent code injection), the
> compiler will enforce type safety (e.g. disallow comparison of integral
> and string values). There will also be a lot of sanity checks at compile
> time, for instance you cannot call .from() twice. It will even be able
> to tell you, if you are referencing tables, which are missing in
> .from(), etc.
>
> No more string concatenation and hoping to get the syntax right. The
> compiler will tell you, if you do it wrong.
> No more indexed access to string results. Result rows will allow you to
> access individual columns by name (and they will have a decent type).
> [...]

Roland,

It all sounds exciting.
I remember the discussion long time ago we had, with similar ideas
brainstormed [1], where you also asked this question, later discussed
with Maciej:

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

FYI, in SOCI, we're planning [2] to move SOCI towards C++11
It likely may happen during SOCI 4.0.0 release.
So, I'd be interested in taking another look at this and having such
layer adopted in SOCI too.

Where I could learn about your solution more?

[1] http://lists.boost.org/Archives/boost/2010/09/170983.php
[2] https://github.com/SOCI/soci/wiki/Roadmap

Best regards,

--
Mateusz Loskot, http://mateusz.loskot.net

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