From: Maciej Sobczak (prog_at_[hidden])
Date: 2007-03-15 12:35:54
Jeff Garland wrote:
>> Query<string,int> insert_thing(db, "insert into things(name,qty) values ($1,$2)");
>> SingletonQuery<int, string> count_things(db, "select sum(qty) from
>> things where name=$1");
>> int n_pens = count_things("pen");
> Very interesting...
> Also, it might be interesting to
> try and port your interface to the SOCI core...I see no reason why your
> interface wouldn't be a possible alternative or addition to the existing SOCI
Actually, SOCI already has the necessary framework for this.
We have a Rowset<> class and we plan to add support for tuple as its
template parameter (we haven't thought about multiple parameters there).
For the moment it looks like this:
And even without the Rowset, creating such functors that will internally
sql << "insert ...", use(x), use(y), use(z);
sql << "select ...", into(x), into(y), into(z):
or any such combination (while preserving the type safety) doesn't seem
to be much of a problem. It doesn't seem to be much necessary neither -
unless we state clearly that our objective is to support absolutely
every syntax sugar that any individual cares to invent. ;-)
-- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk