summaryrefslogtreecommitdiff
path: root/libpqpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp')
-rw-r--r--libpqpp/pq-bulkselectcommand.cpp2
-rw-r--r--libpqpp/pq-column.cpp2
-rw-r--r--libpqpp/pq-command.cpp4
-rw-r--r--libpqpp/pq-connection.cpp2
-rw-r--r--libpqpp/pq-cursorselectcommand.cpp8
-rw-r--r--libpqpp/pq-error.cpp3
-rw-r--r--libpqpp/pq-error.h2
-rw-r--r--libpqpp/pq-modifycommand.cpp2
-rw-r--r--libpqpp/pq-prepared.cpp2
-rw-r--r--libpqpp/pq-selectbase.cpp2
-rw-r--r--libpqpp/unittests/testpq.cpp6
11 files changed, 17 insertions, 18 deletions
diff --git a/libpqpp/pq-bulkselectcommand.cpp b/libpqpp/pq-bulkselectcommand.cpp
index 81f3e48..c098aad 100644
--- a/libpqpp/pq-bulkselectcommand.cpp
+++ b/libpqpp/pq-bulkselectcommand.cpp
@@ -34,7 +34,7 @@ PQ::BulkSelectCommand::fetch()
}
else {
PQclear(execRes);
- execRes = NULL;
+ execRes = nullptr;
executed = false;
return false;
}
diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp
index eb5d291..addd002 100644
--- a/libpqpp/pq-column.cpp
+++ b/libpqpp/pq-column.cpp
@@ -1,7 +1,7 @@
#include "pq-column.h"
#include "pq-selectbase.h"
#include "pq-error.h"
-#include <string.h>
+#include <cstring>
#include <boost/date_time/posix_time/posix_time.hpp>
PQ::Column::Column(const SelectBase * s, unsigned int i) :
diff --git a/libpqpp/pq-command.cpp b/libpqpp/pq-command.cpp
index 8857fb5..147d988 100644
--- a/libpqpp/pq-command.cpp
+++ b/libpqpp/pq-command.cpp
@@ -1,7 +1,7 @@
#include "pq-command.h"
#include "pq-connection.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
#include <compileTimeFormatter.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <factory.h>
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp
index 4ebda84..f20dfb5 100644
--- a/libpqpp/pq-connection.cpp
+++ b/libpqpp/pq-connection.cpp
@@ -34,7 +34,7 @@ PQ::Connection::Connection(const std::string & info) :
auto dc = std::unique_ptr<PGconn, decltype(&PQfinish)>(conn, &PQfinish);
throw ConnectionError(dc.get());
}
- PQsetNoticeProcessor(conn, noNoticeProcessor, NULL);
+ PQsetNoticeProcessor(conn, noNoticeProcessor, nullptr);
}
PQ::Connection::~Connection()
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp
index 02c9fce..2873067 100644
--- a/libpqpp/pq-cursorselectcommand.cpp
+++ b/libpqpp/pq-cursorselectcommand.cpp
@@ -42,7 +42,7 @@ PQ::CursorSelectCommand::execute()
s_declare = mkdeclare();
}
c->checkResultFree(
- PQexecParams(c->conn, s_declare.c_str(), values.size(), NULL, &values.front(), &lengths.front(), &formats.front(), binary),
+ PQexecParams(c->conn, s_declare.c_str(), values.size(), nullptr, &values.front(), &lengths.front(), &formats.front(), binary),
PGRES_COMMAND_OK);
fetchTuples();
createColumns(execRes);
@@ -53,7 +53,7 @@ PQ::CursorSelectCommand::execute()
void
PQ::CursorSelectCommand::fetchTuples()
{
- execRes = c->checkResult(PQexecParams(c->conn, s_fetch.c_str(), 0, NULL, NULL, NULL, NULL, binary), PGRES_TUPLES_OK);
+ execRes = c->checkResult(PQexecParams(c->conn, s_fetch.c_str(), 0, nullptr, nullptr, nullptr, nullptr, binary), PGRES_TUPLES_OK);
nTuples = PQntuples(execRes);
tuple = -1;
}
@@ -65,7 +65,7 @@ PQ::CursorSelectCommand::fetch()
if ((tuple >= (nTuples - 1)) && (nTuples == fTuples)) {
// Delete the previous result set
PQclear(execRes);
- execRes = NULL;
+ execRes = nullptr;
fetchTuples();
}
if (tuple++ < (nTuples - 1)) {
@@ -74,7 +74,7 @@ PQ::CursorSelectCommand::fetch()
else {
PQclear(PQexec(c->conn, s_close.c_str()));
PQclear(execRes);
- execRes = NULL;
+ execRes = nullptr;
executed = false;
return false;
}
diff --git a/libpqpp/pq-error.cpp b/libpqpp/pq-error.cpp
index 3a16185..964d66b 100644
--- a/libpqpp/pq-error.cpp
+++ b/libpqpp/pq-error.cpp
@@ -1,5 +1,4 @@
#include "pq-error.h"
-#include <string.h>
PQ::Error::Error(const PGconn * conn) :
msg(PQerrorMessage(conn))
@@ -7,7 +6,7 @@ PQ::Error::Error(const PGconn * conn) :
}
std::string
-PQ::Error::message() const throw()
+PQ::Error::message() const noexcept
{
return msg;
}
diff --git a/libpqpp/pq-error.h b/libpqpp/pq-error.h
index fdc855b..c9693f7 100644
--- a/libpqpp/pq-error.h
+++ b/libpqpp/pq-error.h
@@ -10,7 +10,7 @@ namespace PQ {
public:
Error(const PGconn *);
- std::string message() const throw() override;
+ std::string message() const noexcept override;
private:
std::string msg;
diff --git a/libpqpp/pq-modifycommand.cpp b/libpqpp/pq-modifycommand.cpp
index bb21bc7..797c678 100644
--- a/libpqpp/pq-modifycommand.cpp
+++ b/libpqpp/pq-modifycommand.cpp
@@ -1,6 +1,6 @@
#include "pq-modifycommand.h"
#include "pq-error.h"
-#include <stdlib.h>
+#include <cstdlib>
#include "pq-connection.h"
PQ::ModifyCommand::ModifyCommand(Connection * conn, const std::string & sql, const DB::CommandOptionsCPtr & opts) :
diff --git a/libpqpp/pq-prepared.cpp b/libpqpp/pq-prepared.cpp
index 6c447f8..3162349 100644
--- a/libpqpp/pq-prepared.cpp
+++ b/libpqpp/pq-prepared.cpp
@@ -21,7 +21,7 @@ PQ::PreparedStatement::prepare() const
std::stringstream psql;
prepareSql(psql, sql);
c->checkResultFree(PQprepare(
- c->conn, stmntName.c_str(), psql.str().c_str(), values.size(), NULL), PGRES_COMMAND_OK);
+ c->conn, stmntName.c_str(), psql.str().c_str(), values.size(), nullptr), PGRES_COMMAND_OK);
return (pstmt = c->preparedStatements.insert({hash, stmntName}).first->second.c_str());
}
diff --git a/libpqpp/pq-selectbase.cpp b/libpqpp/pq-selectbase.cpp
index f9a2eb0..0950d37 100644
--- a/libpqpp/pq-selectbase.cpp
+++ b/libpqpp/pq-selectbase.cpp
@@ -8,7 +8,7 @@ PQ::SelectBase::SelectBase(const std::string & sql, const PQ::CommandOptionsCPtr
DB::SelectCommand(sql),
nTuples(0),
tuple(0),
- execRes(NULL),
+ execRes(nullptr),
binary(pqco ? pqco->fetchBinary : false)
{
}
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp
index 0a13c1e..5b584b7 100644
--- a/libpqpp/unittests/testpq.cpp
+++ b/libpqpp/unittests/testpq.cpp
@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE( bindAndSelectOther )
assertColumnValueHelper(*select, 1, 123.45);
assertColumnValueHelper(*select, 2, std::string_view("some text with a ; in it and a ' too"));
assertColumnValueHelper(*select, 3, true);
- assertColumnValueHelper(*select, 4, boost::posix_time::ptime_from_tm({ 3, 6, 23, 27, 3, 115, 0, 0, 0, 0, 0}));
+ assertColumnValueHelper(*select, 4, boost::posix_time::ptime_from_tm({ 3, 6, 23, 27, 3, 115, 0, 0, 0, 0, nullptr}));
assertColumnValueHelper(*select, 5, boost::posix_time::time_duration(38, 13, 12));
rows += 1;
}
@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE( bulkload )
auto count = ro->select("SELECT COUNT(*) FROM bulktest");
// Test empty
ro->beginBulkUpload("bulktest", "");
- ro->endBulkUpload(NULL);
+ ro->endBulkUpload(nullptr);
assertScalarValueHelper(*count, 0);
// Test sample file
ro->beginBulkUpload("bulktest", "");
@@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE( bulkload )
for (std::streamsize r; (r = in.readsome(buf, sizeof(buf))) > 0; ) {
ro->bulkUploadData(buf, r);
}
- ro->endBulkUpload(NULL);
+ ro->endBulkUpload(nullptr);
assertScalarValueHelper(*count, 800);
}