38 # define __attribute__(x) 44 #include <boost/regex.hpp> 46 #include "lsst/pex/exceptions.h" 51 namespace persistence {
56 lsst::daf::base::Citizen(typeid(*this)),
57 _dbType(), _hostname(), _port(), _username(), _password(), _dbName() {
65 lsst::daf::base::Citizen(typeid(*this)) {
68 expression(
"(\\w+)://(\\S+):(\\d+)/(\\S+)");
69 if (boost::regex_match(url, what, expression)) {
78 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
79 "Unparseable connection string passed to DbStorageLocation: " +
93 return _dbType +
"://" + _username +
":" + _password +
"@" +
94 _hostname +
":" + _port +
"/" + _dbName;
102 return _dbType +
"://" + _hostname +
":" + _port +
"/" + _dbName;
Interface for DbAuth class.
virtual std::string const & getDbName(void) const
Accessor for database name.
DbStorageLocation(void)
Default constructor.
virtual std::string const & getHostname(void) const
Accessor for database hostname.
virtual std::string const & getPassword(void) const
Accessor for password.
virtual std::string const & getDbType(void) const
Accessor for database type.
virtual ~DbStorageLocation(void)
Destructor.
virtual std::string const & getUsername(void) const
Accessor for username.
virtual std::string const & getPort(void) const
Accessor for database port number.
virtual std::string toString(void) const
Produce a string (URL) representation of the DbStorageLocation.
static std::string username(std::string const &host, std::string const &port)
Get the username to use to authenticate to a database.
static std::string password(std::string const &host, std::string const &port)
Get the password to use to authenticate to a database.
virtual std::string getConnString(void) const
Produce a CORAL-style connection string representation of the DbStorageLocation.
Interface for DbStorageLocation class.