
Peter Dimov wrote:
Beman Dawes wrote:
Nicola Musatti wrote:
[...]
In other words, in order to do this:
Session sql(oracle, "some params");
you need to #include "soci.h" (for Session and other independent stuff) and "soci-oracle.h" (so that you see oracle as the name of the singleton factory). As I said I think that even this can and should be done away with. I'm also concerned, although I want to understand more before absolutely saying that the approach should be changed.
I haven't followed the thread in detail, so apologies if this was already covered, but FWIW, when I had to design a db layer, I used
Connection conn = createConnection( "mysql://user:password@host/database" );
The advantage of this approach is that the URL-like thing can come from a configuration file, so you don't need to recompile to change the backend. In a typical scenario, createConnection would need to look for backend_mysql.dll/.so unless the support for the 'mysql' backend has been statically linked.
Peter, Personally, I like it pretty much. It would also make a try to unify connection strings for all backends. I will vote on it when we start deeper analysis of all these great ideas of new features. Cheers -- Mateusz Loskot http://mateusz.loskot.net