summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpqpp/pq-column.cpp10
-rw-r--r--libpqpp/pq-column.h2
-rw-r--r--libpqpp/pq-cursorselectcommand.cpp4
-rw-r--r--libpqpp/pq-cursorselectcommand.h2
-rw-r--r--libpqpp/pq-selectbase.h2
5 files changed, 10 insertions, 10 deletions
diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp
index e743e60..4fac1ac 100644
--- a/libpqpp/pq-column.cpp
+++ b/libpqpp/pq-column.cpp
@@ -5,9 +5,9 @@
#include <boost/date_time/posix_time/posix_time.hpp>
PQ::Column::Column(const SelectBase * s, unsigned int i) :
- DB::Column(PQfname(s->execRes, i), i),
+ DB::Column(PQfname(s->execRes, (int)i), i),
sc(s),
- oid(PQftype(sc->execRes, colNo)),
+ oid(PQftype(sc->execRes, (int)colNo)),
buf(nullptr)
{
}
@@ -22,19 +22,19 @@ PQ::Column::~Column()
bool
PQ::Column::isNull() const
{
- return PQgetisnull(sc->execRes, sc->tuple, colNo);
+ return PQgetisnull(sc->execRes, (int)sc->tuple, (int)colNo);
}
std::size_t
PQ::Column::length() const
{
- return PQgetlength(sc->execRes, sc->tuple, colNo);
+ return PQgetlength(sc->execRes, (int)sc->tuple, (int)colNo);
}
const char *
PQ::Column::value() const
{
- return PQgetvalue(sc->execRes, sc->tuple, colNo);
+ return PQgetvalue(sc->execRes, (int)sc->tuple, (int)colNo);
}
void
diff --git a/libpqpp/pq-column.h b/libpqpp/pq-column.h
index 5c71d86..b0a568d 100644
--- a/libpqpp/pq-column.h
+++ b/libpqpp/pq-column.h
@@ -11,7 +11,7 @@ namespace PQ {
Column(const SelectBase *, unsigned int field);
~Column();
- bool isNull() const override;
+ [[nodiscard]] bool isNull() const override;
void apply(DB::HandleField &) const override;
protected:
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp
index 2873067..820518f 100644
--- a/libpqpp/pq-cursorselectcommand.cpp
+++ b/libpqpp/pq-cursorselectcommand.cpp
@@ -62,13 +62,13 @@ bool
PQ::CursorSelectCommand::fetch()
{
execute();
- if ((tuple >= (nTuples - 1)) && (nTuples == fTuples)) {
+ if ((tuple + 1 >= nTuples) && (nTuples == fTuples)) {
// Delete the previous result set
PQclear(execRes);
execRes = nullptr;
fetchTuples();
}
- if (tuple++ < (nTuples - 1)) {
+ if (++tuple < nTuples) {
return true;
}
else {
diff --git a/libpqpp/pq-cursorselectcommand.h b/libpqpp/pq-cursorselectcommand.h
index 0f59687..f75c36b 100644
--- a/libpqpp/pq-cursorselectcommand.h
+++ b/libpqpp/pq-cursorselectcommand.h
@@ -22,7 +22,7 @@ namespace PQ {
std::string mkdeclare() const;
mutable bool executed;
- int fTuples;
+ unsigned int fTuples;
std::string s_declare;
std::string s_fetch;
std::string s_close;
diff --git a/libpqpp/pq-selectbase.h b/libpqpp/pq-selectbase.h
index 2a01ede..bda6348 100644
--- a/libpqpp/pq-selectbase.h
+++ b/libpqpp/pq-selectbase.h
@@ -15,7 +15,7 @@ namespace PQ {
void createColumns(PGresult *);
- int nTuples, tuple;
+ unsigned int nTuples, tuple;
PGresult * execRes;
bool binary;
};