soci icon indicating copy to clipboard operation
soci copied to clipboard

Portable session constructors [enhancement?]

Open Astrinus opened this issue 7 years ago • 3 comments

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).

Astrinus avatar Jan 09 '18 15:01 Astrinus

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.

vadz avatar Jan 10 '18 11:01 vadz

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...

Astrinus avatar Jan 10 '18 15:01 Astrinus

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

vadz avatar Jan 10 '18 15:01 vadz