diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-04 19:48:20 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-04 19:48:20 +0100 |
commit | 3526af7ec50e46aaa73d038566f42554f70f27b0 (patch) | |
tree | 2591708ced4743213f77c9aa4ee8933dc0d1b333 /libpqpp/pq-cursorselectcommand.cpp | |
parent | Pedantic only with gcc (diff) | |
download | libdbpp-postgresql-3526af7ec50e46aaa73d038566f42554f70f27b0.tar.bz2 libdbpp-postgresql-3526af7ec50e46aaa73d038566f42554f70f27b0.tar.xz libdbpp-postgresql-3526af7ec50e46aaa73d038566f42554f70f27b0.zip |
Fix a lot of clang-tidy warningsHEADlibdbpp-postgresql-1.4.10main
Diffstat (limited to 'libpqpp/pq-cursorselectcommand.cpp')
-rw-r--r-- | libpqpp/pq-cursorselectcommand.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp index bfb69d4..cd20cf8 100644 --- a/libpqpp/pq-cursorselectcommand.cpp +++ b/libpqpp/pq-cursorselectcommand.cpp @@ -15,16 +15,16 @@ AdHocFormatter(PQCursorSelectClose, "CLOSE %?"); PQ::CursorSelectCommand::CursorSelectCommand(Connection * conn, const std::string & sql, const PQ::CommandOptionsCPtr & pqco, const DB::CommandOptionsCPtr & opts) : - DB::Command(sql), - PQ::SelectBase(sql, pqco), PQ::Command(conn, sql, opts), executed(false), fTuples(pqco ? pqco->fetchTuples : 35), - s_fetch(PQCursorSelectFetch::get(fTuples, stmntName)), s_close(PQCursorSelectClose::get(stmntName)) + DB::Command(sql), PQ::SelectBase(sql, pqco), PQ::Command(conn, sql, opts), executed(false), + fTuples(pqco ? pqco->fetchTuples : DEFAULT_FETCH_TUPLES), sFetch(PQCursorSelectFetch::get(fTuples, stmntName)), + sClose(PQCursorSelectClose::get(stmntName)) { } PQ::CursorSelectCommand::~CursorSelectCommand() { if (executed && PQtransactionStatus(c->conn) != PQTRANS_INERROR) { - c->checkResult(PQexec(c->conn, s_close.c_str()), PGRES_COMMAND_OK); + c->checkResult(PQexec(c->conn, sClose.c_str()), PGRES_COMMAND_OK); } } @@ -41,10 +41,10 @@ void PQ::CursorSelectCommand::execute() { if (!executed) { - if (s_declare.empty()) { - s_declare = mkdeclare(); + if (sDeclare.empty()) { + sDeclare = mkdeclare(); } - c->checkResult(PQexecParams(c->conn, s_declare.c_str(), static_cast<int>(values.size()), nullptr, values.data(), + c->checkResult(PQexecParams(c->conn, sDeclare.c_str(), static_cast<int>(values.size()), nullptr, values.data(), lengths.data(), formats.data(), binary), PGRES_COMMAND_OK); fetchTuples(); @@ -57,7 +57,7 @@ void PQ::CursorSelectCommand::fetchTuples() { execRes = c->checkResult( - PQexecParams(c->conn, s_fetch.c_str(), 0, nullptr, nullptr, nullptr, nullptr, binary), PGRES_TUPLES_OK); + PQexecParams(c->conn, sFetch.c_str(), 0, nullptr, nullptr, nullptr, nullptr, binary), PGRES_TUPLES_OK); nTuples = static_cast<decltype(nTuples)>(PQntuples(execRes.get())); tuple = static_cast<decltype(tuple)>(-1); } @@ -74,10 +74,8 @@ PQ::CursorSelectCommand::fetch() if (++tuple < nTuples) { return true; } - else { - PQclear(PQexec(c->conn, s_close.c_str())); - execRes.reset(); - executed = false; - return false; - } + PQclear(PQexec(c->conn, sClose.c_str())); + execRes.reset(); + executed = false; + return false; } |