
joel skrev:
Jean-Louis Leroy wrote:
2. It looks like the options they are considering for a syntax are mainly inspired by Soci and pqxx. They have this in common : the query is expressed as SQL text (à la Boost.Regex) that is parsed at run time instead of using language constructs (à la Boost.Xpressive) that can be checked at compile time. This is error prone : you can pass illegal SQL ; and the returned values will incur runtime typecasting, which may fail at run time in case of mismatch. Back at Boost'Con 09 I proposed a function based and not text based SQL interface using proto that looked like :
#include <boost/rdb_proto/rdb.hpp>
BOOST_RDB_REGISTER_FIELD(age,int) BOOST_RDB_REGISTER_FIELD(id ,int) BOOST_RDB_REGISTER_NAMED_FIELD(name,std::string,"complete_name")
int main() { connection db("some.db.url","login","passwd");
BOOST_RDB_TABLE((id)(name)(age)) employee("employee",db); BOOST_RDB_RESULT_SET((age)(name)) rows;
rows = select(age,name).from(employee) .where( age > 45 && name ~= "Dil%" );
// Some random access if( !r.empty() ) cout << r[0][name] << " is " << r[0][age] << " years old." << endl; }
I have the whole ppt of my proposal somewhere if soemone's interested. I have alas not much free time for this but I had some prototype code laying somewhere
Consider me interested. I was considering something along those lines when I made a quick'n'dirty wrapper for SQLite, but in the end both 'Quick' and 'Dirty' won over 'good design'. I'd be interested to see your work here.. /Brian