summaryrefslogtreecommitdiff
path: root/libpqpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 14:34:16 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 14:40:20 +0100
commiteab3a1beba707e9f531a250a5c74a6ba462aa4fc (patch)
tree0bac5aa1211d282f996d2b9bf3b72d81717df5e9 /libpqpp
parentDon't attempt to close cursors when in failed transaction (it's failed and re... (diff)
downloadlibdbpp-postgresql-eab3a1beba707e9f531a250a5c74a6ba462aa4fc.tar.bz2
libdbpp-postgresql-eab3a1beba707e9f531a250a5c74a6ba462aa4fc.tar.xz
libdbpp-postgresql-eab3a1beba707e9f531a250a5c74a6ba462aa4fc.zip
Rename SelectCommand to CursorSelectCommand
Diffstat (limited to 'libpqpp')
-rw-r--r--libpqpp/pq-column.cpp4
-rw-r--r--libpqpp/pq-column.h6
-rw-r--r--libpqpp/pq-connection.cpp6
-rw-r--r--libpqpp/pq-cursorselectcommand.cpp (renamed from libpqpp/pq-selectcommand.cpp)18
-rw-r--r--libpqpp/pq-cursorselectcommand.h (renamed from libpqpp/pq-selectcommand.h)10
5 files changed, 22 insertions, 22 deletions
diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp
index 6b949d4..31a3d9b 100644
--- a/libpqpp/pq-column.cpp
+++ b/libpqpp/pq-column.cpp
@@ -1,10 +1,10 @@
#include "pq-column.h"
-#include "pq-selectcommand.h"
+#include "pq-cursorselectcommand.h"
#include "pq-error.h"
#include <string.h>
#include <boost/date_time/posix_time/posix_time.hpp>
-PQ::Column::Column(const SelectCommand * s, unsigned int i) :
+PQ::Column::Column(const CursorSelectCommand * s, unsigned int i) :
DB::Column(PQfname(s->execRes, i), i),
sc(s),
oid(PQftype(sc->execRes, colNo))
diff --git a/libpqpp/pq-column.h b/libpqpp/pq-column.h
index a5b33ef..99a37fb 100644
--- a/libpqpp/pq-column.h
+++ b/libpqpp/pq-column.h
@@ -5,16 +5,16 @@
#include <libpq-fe.h>
namespace PQ {
- class SelectCommand;
+ class CursorSelectCommand;
class Column : public DB::Column {
public:
- Column(const SelectCommand *, unsigned int field);
+ Column(const CursorSelectCommand *, unsigned int field);
bool isNull() const override;
void apply(DB::HandleField &) const override;
protected:
- const SelectCommand * sc;
+ const CursorSelectCommand * sc;
const Oid oid;
};
}
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp
index e6340d5..49867a4 100644
--- a/libpqpp/pq-connection.cpp
+++ b/libpqpp/pq-connection.cpp
@@ -1,6 +1,6 @@
#include "pq-connection.h"
#include "pq-error.h"
-#include "pq-selectcommand.h"
+#include "pq-cursorselectcommand.h"
#include "pq-modifycommand.h"
#include <unistd.h>
#include <poll.h>
@@ -97,7 +97,7 @@ PQ::Connection::ping() const
DB::SelectCommand *
PQ::Connection::newSelectCommand(const std::string & sql)
{
- return new SelectCommand(this, sql, pstmntNo++);
+ return new CursorSelectCommand(this, sql, pstmntNo++);
}
DB::ModifyCommand *
@@ -173,7 +173,7 @@ PQ::Connection::bulkUploadData(const char * data, size_t len) const
int64_t
PQ::Connection::insertId()
{
- SelectCommand getId(this, "SELECT lastval()", pstmntNo++);
+ CursorSelectCommand getId(this, "SELECT lastval()", pstmntNo++);
int64_t id = -1;
while (getId.fetch()) {
getId[0] >> id;
diff --git a/libpqpp/pq-selectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp
index b049eea..fe097a5 100644
--- a/libpqpp/pq-selectcommand.cpp
+++ b/libpqpp/pq-cursorselectcommand.cpp
@@ -1,9 +1,9 @@
-#include "pq-selectcommand.h"
+#include "pq-cursorselectcommand.h"
#include "pq-connection.h"
#include "pq-column.h"
#include "pq-error.h"
-PQ::SelectCommand::SelectCommand(Connection * conn, const std::string & sql, unsigned int no) :
+PQ::CursorSelectCommand::CursorSelectCommand(Connection * conn, const std::string & sql, unsigned int no) :
DB::Command(sql),
DB::SelectCommand(sql),
PQ::Command(conn, sql, no),
@@ -19,7 +19,7 @@ PQ::SelectCommand::SelectCommand(Connection * conn, const std::string & sql, uns
{
}
-PQ::SelectCommand::~SelectCommand()
+PQ::CursorSelectCommand::~CursorSelectCommand()
{
if (execRes) {
PQclear(execRes);
@@ -33,7 +33,7 @@ PQ::SelectCommand::~SelectCommand()
}
std::string
-PQ::SelectCommand::mkdeclare() const
+PQ::CursorSelectCommand::mkdeclare() const
{
std::string psql;
psql.reserve(sql.length() + 40);
@@ -45,7 +45,7 @@ PQ::SelectCommand::mkdeclare() const
}
std::string
-PQ::SelectCommand::mkfetch() const
+PQ::CursorSelectCommand::mkfetch() const
{
char buf[BUFSIZ];
snprintf(buf, sizeof(buf), "FETCH %d IN %s", fTuples, stmntName.c_str());
@@ -53,7 +53,7 @@ PQ::SelectCommand::mkfetch() const
}
std::string
-PQ::SelectCommand::mkclose() const
+PQ::CursorSelectCommand::mkclose() const
{
char buf[BUFSIZ];
snprintf(buf, sizeof(buf), "CLOSE %s", stmntName.c_str());
@@ -61,7 +61,7 @@ PQ::SelectCommand::mkclose() const
}
void
-PQ::SelectCommand::execute()
+PQ::CursorSelectCommand::execute()
{
if (!executed) {
if (!c->inTx()) {
@@ -81,7 +81,7 @@ PQ::SelectCommand::execute()
}
void
-PQ::SelectCommand::fetchTuples()
+PQ::CursorSelectCommand::fetchTuples()
{
if (execRes) {
PQclear(execRes);
@@ -93,7 +93,7 @@ PQ::SelectCommand::fetchTuples()
}
bool
-PQ::SelectCommand::fetch()
+PQ::CursorSelectCommand::fetch()
{
execute();
if ((tuple >= (nTuples - 1)) && (nTuples == fTuples)) {
diff --git a/libpqpp/pq-selectcommand.h b/libpqpp/pq-cursorselectcommand.h
index f2e0c74..aafe4e1 100644
--- a/libpqpp/pq-selectcommand.h
+++ b/libpqpp/pq-cursorselectcommand.h
@@ -1,5 +1,5 @@
-#ifndef PQ_SELECTCOMMAND_H
-#define PQ_SELECTCOMMAND_H
+#ifndef PQ_CURSORSELECTCOMMAND_H
+#define PQ_CURSORSELECTCOMMAND_H
#include <selectcommand.h>
#include "pq-command.h"
@@ -9,10 +9,10 @@
namespace PQ {
class Connection;
class Column;
- class SelectCommand : public DB::SelectCommand, public Command {
+ class CursorSelectCommand : public DB::SelectCommand, public Command {
public:
- SelectCommand(Connection *, const std::string & sql, unsigned int no);
- virtual ~SelectCommand();
+ CursorSelectCommand(Connection *, const std::string & sql, unsigned int no);
+ virtual ~CursorSelectCommand();
bool fetch() override;
void execute() override;