On 2013-11-10 00:12, Mateusz Loskot wrote:
On 9 November 2013 22:58, Roland Bock
wrote: On 2013-11-09 23:03, Michael Marcin wrote:
On 11/9/2013 4:03 PM, Roland Bock wrote:
Please let me know your questions/thoughts/suggestions/rants. Contributions welcome, of course :-)
Could you compare your library with SOCI?
I consider SOCI to be a string and position based approach, meaning that you (as a library user) have to use strings to construct your queries and positions to extract results. Yes, that's correct.
In fact, SQL commands play an important role as part of DBMS access abstraction. SQL is a part of SOCI interface, by design.
sqlpp11 takes care of this responsibility for you and gives you rows with appropriately named and typed member variables. It is much harder to use those the wrong way without the compiler yelling at you.
sqlpp11 assumes that you know your tables at compile time. Thus you can declare types representing tables and columns with appropriate names and types. You can then construct SQL queries and analyze the results with the full armory of syntax and type checking that C++ and template meta programming have to offer. Thank you for this clarification.
I think sqlpp11 is an extremely interesting exercise. :-)
I have been considering to add non-string layer to SOCI directly based One option would be to write a sqlpp11 connector library for SOCI, similar to the existing ones for using MySQL/MariaDb and Sqlite3.
on your idea, soon after I saw it some time ago in your initial experiments.
Best regards, You're referring to the discussion in 2010? http://comments.gmane.org/gmane.comp.lib.boost.devel/208623
Cool, I wasn't aware of the impact :-) sqlpp11 is much more mature, than what I had back then. Among other things * auto allows for a much leaner perceived API * table definitions are also much simpler. I am still using a code generator for those (DDL->C++, which I'll add to the repository soon), but the types are quite comprehensible even for a casual user, I guess * compile times are better * sqlpp11 "understands" sub-selects, which were a nightmare in all my previous attempts. Sub-selects can be used very naturally now, i.e. as selected values, as input for functions like exists(), as operands in where-conditions and as pseudo-tables in from(). The documentation on that is still pretty thin, I guess, but there are usage hints here and there: https://github.com/rbock/sqlpp11/wiki/Select#sub-select https://github.com/rbock/sqlpp11/wiki/Select#aliased-sub-select * you can add columns to your select at runtime now, if required * I would not call the library code simple, but it is certainly much easier to understand and to extend than any of the earlier versions Cheers, Roland