Need a central piece to manage the catalogue data per database to prevent loading this multiple times. MasterController is now also used to enable reopening the connection manager from a query window after the connection manager has been closed.
83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
#ifndef CONNECTION_H
|
|
#define CONNECTION_H
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
enum class SslMode {
|
|
disable=0,
|
|
allow=1,
|
|
prefer=2,
|
|
require=3,
|
|
verify_ca=4,
|
|
verify_full=5
|
|
};
|
|
|
|
class ConnectionConfig {
|
|
public:
|
|
ConnectionConfig();
|
|
|
|
void setName(std::string desc);
|
|
const std::string& name() const;
|
|
|
|
void setHost(std::string host);
|
|
const std::string& host() const;
|
|
|
|
void setHostAddr(std::string v);
|
|
const std::string& hostAddr() const;
|
|
|
|
void setPort(unsigned short port);
|
|
unsigned short port() const;
|
|
|
|
void setUser(std::string v);
|
|
const std::string& user() const;
|
|
|
|
void setPassword(std::string v);
|
|
const std::string& password() const;
|
|
|
|
void setDbname(std::string v);
|
|
const std::string& dbname() const;
|
|
|
|
void setSslMode(SslMode m);
|
|
SslMode sslMode() const;
|
|
|
|
void setSslCert(std::string v);
|
|
const std::string& sslCert() const;
|
|
|
|
void setSslKey(std::string v);
|
|
const std::string& sslKey() const;
|
|
|
|
void setSslRootCert(std::string v);
|
|
const std::string& sslRootCert() const;
|
|
|
|
void setSslCrl(std::string v);
|
|
const std::string& sslCrl() const;
|
|
|
|
const char * const * getKeywords() const;
|
|
const char * const * getValues() const;
|
|
|
|
bool isSameDatabase(const ConnectionConfig &rhs) const;
|
|
private:
|
|
std::string m_name;
|
|
std::string m_host;
|
|
std::string m_hostaddr;
|
|
std::string m_port = "5432";
|
|
|
|
std::string m_user;
|
|
std::string m_password;
|
|
std::string m_dbname;
|
|
|
|
std::string m_sslMode;
|
|
std::string m_sslCert;
|
|
std::string m_sslKey;
|
|
std::string m_sslRootCert;
|
|
std::string m_sslCrl;
|
|
|
|
std::string m_applicationName;
|
|
|
|
static std::vector<const char*> s_keywords;
|
|
mutable std::vector<const char*> m_values;
|
|
};
|
|
|
|
|
|
#endif // CONNECTION_H
|