Moved some parts to a static lib so both the executable and the tests can link to it.
Written additional tests.
This commit is contained in:
parent
0a809a7288
commit
d0ea9dfa0c
39 changed files with 1767 additions and 493 deletions
|
|
@ -57,7 +57,10 @@ ConnectionConfig::ConnectionConfig()
|
|||
|
||||
void ConnectionConfig::setName(std::string desc)
|
||||
{
|
||||
m_name = std::move(desc);
|
||||
if (m_name != desc) {
|
||||
m_dirty = true;
|
||||
m_name = std::move(desc);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::name() const
|
||||
|
|
@ -67,7 +70,10 @@ const std::string& ConnectionConfig::name() const
|
|||
|
||||
void ConnectionConfig::setHost(std::string host)
|
||||
{
|
||||
m_host = std::move(host);
|
||||
if (m_host != host) {
|
||||
m_dirty = true;
|
||||
m_host = std::move(host);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::host() const
|
||||
|
|
@ -77,7 +83,10 @@ const std::string& ConnectionConfig::host() const
|
|||
|
||||
void ConnectionConfig::setHostAddr(std::string v)
|
||||
{
|
||||
m_hostaddr = std::move(v);
|
||||
if (m_hostaddr != v) {
|
||||
m_dirty = true;
|
||||
m_hostaddr = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::hostAddr() const
|
||||
|
|
@ -87,7 +96,11 @@ const std::string& ConnectionConfig::hostAddr() const
|
|||
|
||||
void ConnectionConfig::setPort(unsigned short port)
|
||||
{
|
||||
m_port = std::to_string(port);
|
||||
auto p = std::to_string(port);
|
||||
if (m_port != p) {
|
||||
m_dirty = true;
|
||||
m_port = p;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short ConnectionConfig::port() const
|
||||
|
|
@ -97,7 +110,11 @@ unsigned short ConnectionConfig::port() const
|
|||
|
||||
void ConnectionConfig::setUser(std::string v)
|
||||
{
|
||||
m_user = std::move(v);
|
||||
if (m_user != v) {
|
||||
m_dirty = true;
|
||||
m_user = std::move(v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::user() const
|
||||
|
|
@ -107,7 +124,10 @@ const std::string& ConnectionConfig::user() const
|
|||
|
||||
void ConnectionConfig::setPassword(std::string v)
|
||||
{
|
||||
m_password = std::move(v);
|
||||
if (m_password != v) {
|
||||
m_dirty = true;
|
||||
m_password = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::password() const
|
||||
|
|
@ -117,7 +137,10 @@ const std::string& ConnectionConfig::password() const
|
|||
|
||||
void ConnectionConfig::setDbname(std::string v)
|
||||
{
|
||||
m_dbname = std::move(v);
|
||||
if (m_dbname != v) {
|
||||
m_dirty = true;
|
||||
m_dbname = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::dbname() const
|
||||
|
|
@ -127,7 +150,11 @@ const std::string& ConnectionConfig::dbname() const
|
|||
|
||||
void ConnectionConfig::setSslMode(SslMode m)
|
||||
{
|
||||
m_sslMode = SslModeToString(m);
|
||||
auto v = SslModeToString(m);
|
||||
if (m_sslMode != v) {
|
||||
m_dirty = true;
|
||||
m_sslMode = v;
|
||||
}
|
||||
}
|
||||
|
||||
SslMode ConnectionConfig::sslMode() const
|
||||
|
|
@ -137,7 +164,10 @@ SslMode ConnectionConfig::sslMode() const
|
|||
|
||||
void ConnectionConfig::setSslCert(std::string v)
|
||||
{
|
||||
m_sslCert = std::move(v);
|
||||
if (m_sslCert != v) {
|
||||
m_dirty = true;
|
||||
m_sslCert = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::sslCert() const
|
||||
|
|
@ -147,7 +177,10 @@ const std::string& ConnectionConfig::sslCert() const
|
|||
|
||||
void ConnectionConfig::setSslKey(std::string v)
|
||||
{
|
||||
m_sslKey = std::move(v);
|
||||
if (m_sslKey != v) {
|
||||
m_dirty = true;
|
||||
m_sslKey = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::sslKey() const
|
||||
|
|
@ -157,7 +190,10 @@ const std::string& ConnectionConfig::sslKey() const
|
|||
|
||||
void ConnectionConfig::setSslRootCert(std::string v)
|
||||
{
|
||||
m_sslRootCert = std::move(v);
|
||||
if (m_sslRootCert != v) {
|
||||
m_dirty = true;
|
||||
m_sslRootCert = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::sslRootCert() const
|
||||
|
|
@ -167,7 +203,10 @@ const std::string& ConnectionConfig::sslRootCert() const
|
|||
|
||||
void ConnectionConfig::setSslCrl(std::string v)
|
||||
{
|
||||
m_sslCrl = std::move(v);
|
||||
if (m_sslCrl != v) {
|
||||
m_dirty = true;
|
||||
m_sslCrl = std::move(v);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& ConnectionConfig::sslCrl() const
|
||||
|
|
@ -210,3 +249,13 @@ bool ConnectionConfig::isSameDatabase(const ConnectionConfig &rhs) const
|
|||
&& m_password == rhs.m_password
|
||||
&& m_dbname == rhs.m_dbname;
|
||||
}
|
||||
|
||||
bool ConnectionConfig::dirty() const
|
||||
{
|
||||
return m_dirty;
|
||||
}
|
||||
|
||||
void ConnectionConfig::clean()
|
||||
{
|
||||
m_dirty = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue