Boost logo

Boost :

Subject: Re: [boost] SQL client library ?
From: Jean-Louis Leroy (jl_at_[hidden])
Date: 2009-09-11 14:28:06

Tomas :
> I like this example. It seems to be more realistic then the previous.
> The column definition should be indeed local in table definition. Also
> random-access to result set is rarely required, this solution with
> cursors will map much better to underlying sql machinery. If I want to
> fetch records in certain index range I use LIMIT/OFFSET SQL commands.
Unfortunately this :

    cout << cursor[] << endl;

...cannot be made to work purely at compile-time. Consider

    cout << cursor[] << cursor[] << endl;

Both ids have the same type. Some run-time discrimination would be
needed (probably a lookup in a map keyed by the address of the table
objects). It is type-safe however. I have ideas for purely compile-time
alternatives but the syntax is heavier.

OTOH positional access can be purely compile-time, but the syntax would
not use brackets, rather tuple-style accessors :

    cout << cursor.get<0> << endl; // positional :

Incidentally - my real interest is object-relational mapping, but before
working on that I'd need a boost sql library. Hence my initial post...


Boost list run by bdawes at, gregod at, cpdaniel at, john at