SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Portable session constructors [enhancement?] #619

Open Astrinus opened 6 years ago

Astrinus commented 6 years ago

Could session constructors of the form session({std::string, backend_factory} backend, std::string user, std::string password, std::string host = "127.0.0.1", uint16_t port = <default_db_port>) make sense, in order to switch DBMS even more portably?

I am willing to implement them if you are ok with this, at least for MySQL, PostgreSQL and Oracle (and SQLite3 in which all except DB are ignored).

vadz commented 6 years ago

I think it would be better to extend connection_parameters by adding set_{user,password,host,...}() methods to it rather than having a ctor taking that many parameters.

Astrinus commented 6 years ago

User and password should go hand in hand. What's the meaning of setting a password but not a user? I actually thought about extending connection_parameters, but it does not feel quite right in my head...

vadz commented 6 years ago

Yes, sure let it be set_credentials(user, pass), why not.