On 2014-02-05 22:07, Johan BaltiƩ wrote:
On Wed, Feb 5, 2014 at 9:57 PM, Roland Bock
wrote: Maybe if SOCI creates it's own expression grammar for SQL queries it would be a faster and more practical solution, since SOCI has been around for quite some time and has solved several issues along the way. And the expression tree for SQL queries is the fastest part of such a library. The eye candy and sugar should be easy to convert to string and use the SOCI engine for it.
Sqlpp11 will still need to reimplement what SOCI has done several years ago. No. It will not. sqlpp11 will not touch databases, but only glue code... I would add that SOCI would still have to handle raw string for SQL, because there are things that are specific to one database and cannot even be expressed in another DBMS. And we often need them. It's bad to say to someone "you have to stuck to the lowest common denominator" if he only uses one DBMS.
So, you would have two different syntax for the same library... quite strange. Better to split it in 2 differents lib parts like this I think. Not sure if I fully understand your meaning, but here are some additional comments:
Lowest common denominator: sqlpp11 builds an expression tree. Whoever interprets the expression tree can decide how to interpret it and what to accept. So for instance, sqlpp11 supports outer join (of course), sqlite3 does not. If you give an expression containing an outer join to the sqlite3 connector, a static assert will inform you that this won't work. In a multi-database connector, you might need to replace the static assert by a runtime exception. Specific features: There are quite a few ways to extend sqlpp11. You could add new value types, or new functions. For example, last November, Dominique Devienne was asking about array binding for high performance inserts into an Oracle database. As written in the post that started this thread, that feature is not part of sqlpp11. But I am convinced that it would be easy to add a different kind of parameter struct to add the feature. I don't know if SOCI supports it though, so maybe you would have to use a different connector. Can you give me a few examples of the specific things you have in mind? I probably won't add them to sqlpp11 directly, but I would like to provide the means to add them without pain. Cheers, Roland