
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");
insert_thing("table",1); insert_thing("chair",4); int n_pens = count_things("pen");
Very interesting...
Indeed.
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 setup.
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: http://soci.sourceforge.net/doc/statements.html#rowset And even without the Rowset, creating such functors that will internally translate to: sql << "insert ...", use(x), use(y), use(z); or: 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/