diff options
author | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-01-03 15:03:05 +0000 |
---|---|---|
committer | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-01-03 15:16:54 +0000 |
commit | bac96d1b62dde949412a998cb0c3231ad179d870 (patch) | |
tree | ea7a72996c508d2c62104fe3ce523453b8f57d6b /libpqpp/pq-cursorselectcommand.cpp | |
parent | Only set unlogged for mocked tables on server versions 9.5 and above (diff) | |
download | libdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.tar.bz2 libdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.tar.xz libdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.zip |
Refactor to remove some duplication
Diffstat (limited to 'libpqpp/pq-cursorselectcommand.cpp')
-rw-r--r-- | libpqpp/pq-cursorselectcommand.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp index 29e29f5..fbc14eb 100644 --- a/libpqpp/pq-cursorselectcommand.cpp +++ b/libpqpp/pq-cursorselectcommand.cpp @@ -1,12 +1,11 @@ #include "pq-cursorselectcommand.h" #include "pq-connection.h" -#include "pq-column.h" #include "pq-error.h" #include <compileTimeFormatter.h> PQ::CursorSelectCommand::CursorSelectCommand(Connection * conn, const std::string & sql, unsigned int no) : DB::Command(sql), - DB::SelectCommand(sql), + PQ::SelectBase(sql), PQ::Command(conn, sql, no), executed(false), txOpened(false), @@ -19,9 +18,6 @@ PQ::CursorSelectCommand::CursorSelectCommand(Connection * conn, const std::strin PQ::CursorSelectCommand::~CursorSelectCommand() { - if (execRes) { - PQclear(execRes); - } if (executed && PQtransactionStatus(c->conn) != PQTRANS_INERROR) { c->checkResultFree((PQexec(c->conn, s_close.c_str())), PGRES_COMMAND_OK); } @@ -65,10 +61,7 @@ PQ::CursorSelectCommand::execute() PQexecParams(c->conn, s_declare.c_str(), values.size(), NULL, &values.front(), &lengths.front(), NULL, 0), PGRES_COMMAND_OK); fetchTuples(); - unsigned int nFields = PQnfields(execRes); - for (unsigned int f = 0; f < nFields; f += 1) { - insertColumn(DB::ColumnPtr(new Column(this, f))); - } + createColumns(execRes); executed = true; } } |