summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2020-03-28 17:55:41 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2020-03-28 17:55:41 +0000
commit448720848b383639c37f5f0487efdf8c0f0ed433 (patch)
tree28fb708836b0030a7813d35d3213e6153bbb757c
parentFixes for tidy (diff)
downloadlibdbpp-postgresql-1.4.4.tar.bz2
libdbpp-postgresql-1.4.4.tar.xz
libdbpp-postgresql-1.4.4.zip
-rw-r--r--libpqpp/pq-command.h6
-rw-r--r--libpqpp/pq-connection.h13
-rw-r--r--libpqpp/pq-error.h2
-rw-r--r--libpqpp/pq-mock.h10
-rw-r--r--libpqpp/unittests/testpq.cpp8
5 files changed, 23 insertions, 16 deletions
diff --git a/libpqpp/pq-command.h b/libpqpp/pq-command.h
index 4123d4c..101afd8 100644
--- a/libpqpp/pq-command.h
+++ b/libpqpp/pq-command.h
@@ -14,7 +14,7 @@ namespace PQ {
class DLL_PUBLIC CommandOptions : public DB::CommandOptions {
public:
CommandOptions(std::size_t, const DB::CommandOptionsMap &);
- CommandOptions(std::size_t hash,
+ explicit CommandOptions(std::size_t hash,
unsigned int fetchTuples = 35,
bool useCursor = true,
bool fetchBinary = false);
@@ -23,8 +23,8 @@ namespace PQ {
bool useCursor;
bool fetchBinary;
};
- typedef std::shared_ptr<CommandOptions> CommandOptionsPtr;
- typedef std::shared_ptr<const CommandOptions> CommandOptionsCPtr;
+ using CommandOptionsPtr = std::shared_ptr<CommandOptions>;
+ using CommandOptionsCPtr = std::shared_ptr<const CommandOptions>;
class Command : public virtual DB::Command {
public:
diff --git a/libpqpp/pq-connection.h b/libpqpp/pq-connection.h
index 18a0198..833330b 100644
--- a/libpqpp/pq-connection.h
+++ b/libpqpp/pq-connection.h
@@ -5,21 +5,24 @@
#include <set>
#include <libpq-fe.h>
#include <visibility.h>
+#include <c++11Helpers.h>
#include "pq-error.h"
namespace PQ {
class ConnectionError : public virtual Error, public virtual DB::ConnectionError {
public:
- ConnectionError(const PGconn *);
+ explicit ConnectionError(const PGconn *);
};
class DLL_PUBLIC Connection : public DB::Connection {
public:
- typedef std::size_t StatementHash;
- typedef std::map<StatementHash, std::string> PreparedStatements;
+ using StatementHash = std::size_t;
+ using PreparedStatements = std::map<StatementHash, std::string>;
- Connection(const std::string & info);
- ~Connection();
+ explicit Connection(const std::string & info);
+ ~Connection() override;
+
+ SPECIAL_MEMBERS_MOVE_RO(Connection);
void beginTxInt() override;
void commitTxInt() override;
diff --git a/libpqpp/pq-error.h b/libpqpp/pq-error.h
index c9693f7..08d86b9 100644
--- a/libpqpp/pq-error.h
+++ b/libpqpp/pq-error.h
@@ -8,7 +8,7 @@
namespace PQ {
class Error : public AdHoc::Exception<DB::Error> {
public:
- Error(const PGconn *);
+ explicit Error(const PGconn *);
std::string message() const noexcept override;
diff --git a/libpqpp/pq-mock.h b/libpqpp/pq-mock.h
index eccd5ae..4218f43 100644
--- a/libpqpp/pq-mock.h
+++ b/libpqpp/pq-mock.h
@@ -10,16 +10,18 @@ namespace PQ {
class DLL_PUBLIC Mock : public DB::MockServerDatabase {
public:
Mock(const std::string & master, const std::string & name, const std::vector<std::filesystem::path> & ss);
- ~Mock();
+ ~Mock() override;
- DB::ConnectionPtr openConnection() const override;
+ SPECIAL_MEMBERS_MOVE_RO(Mock);
+
+ [[nodiscard]] DB::ConnectionPtr openConnection() const override;
protected:
void CreateNewDatabase() const override;
void DropDatabase() const override;
void SetTablesToUnlogged() const;
- bool hasUnloggedTables() const;
- bool hasCopyToProgram() const;
+ [[nodiscard]] bool hasUnloggedTables() const;
+ [[nodiscard]] bool hasCopyToProgram() const;
const std::filesystem::path tablespacePath;
const int serverVersion;
};
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp
index 67ce07a..660a388 100644
--- a/libpqpp/unittests/testpq.cpp
+++ b/libpqpp/unittests/testpq.cpp
@@ -416,7 +416,7 @@ BOOST_AUTO_TEST_CASE( fetchAsBinary )
sel = ro->select("SELECT NULL, now()", opts);
for (const auto & r : sel->as<std::optional<int64_t>, boost::posix_time::ptime>()) {
BOOST_REQUIRE(!r.value<0>());
- BOOST_REQUIRE_THROW(r.value<1>(), DB::ColumnTypeNotSupported);
+ BOOST_REQUIRE_THROW((void)r.value<1>(), DB::ColumnTypeNotSupported);
}
}
@@ -461,9 +461,11 @@ BOOST_AUTO_TEST_SUITE_END();
BOOST_AUTO_TEST_CASE( connfail )
{
- BOOST_REQUIRE_THROW(DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no"), DB::ConnectionError);
+ BOOST_REQUIRE_THROW(
+ (void)DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no"),
+ DB::ConnectionError);
try {
- DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no");
+ (void)DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no");
}
catch (const DB::ConnectionError & e) {
BOOST_REQUIRE(std::string(e.what()).find("\"no\""));