summaryrefslogtreecommitdiff
path: root/libpqpp/pq-bulkselectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-03 15:03:05 +0000
committerDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-03 15:16:54 +0000
commitbac96d1b62dde949412a998cb0c3231ad179d870 (patch)
treeea7a72996c508d2c62104fe3ce523453b8f57d6b /libpqpp/pq-bulkselectcommand.cpp
parentOnly set unlogged for mocked tables on server versions 9.5 and above (diff)
downloadlibdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.tar.bz2
libdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.tar.xz
libdbpp-postgresql-bac96d1b62dde949412a998cb0c3231ad179d870.zip
Refactor to remove some duplication
Diffstat (limited to 'libpqpp/pq-bulkselectcommand.cpp')
-rw-r--r--libpqpp/pq-bulkselectcommand.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/libpqpp/pq-bulkselectcommand.cpp b/libpqpp/pq-bulkselectcommand.cpp
index 466eaaf..d745e64 100644
--- a/libpqpp/pq-bulkselectcommand.cpp
+++ b/libpqpp/pq-bulkselectcommand.cpp
@@ -5,19 +5,12 @@
PQ::BulkSelectCommand::BulkSelectCommand(Connection * conn, const std::string & sql, unsigned int no, const DB::CommandOptions * opts) :
DB::Command(sql),
- DB::SelectCommand(sql),
+ PQ::SelectBase(sql),
PQ::PreparedStatement(conn, sql, no, opts),
executed(false)
{
}
-PQ::BulkSelectCommand::~BulkSelectCommand()
-{
- if (execRes) {
- PQclear(execRes);
- }
-}
-
void
PQ::BulkSelectCommand::execute()
{
@@ -27,10 +20,7 @@ PQ::BulkSelectCommand::execute()
PGRES_TUPLES_OK);
nTuples = PQntuples(execRes);
tuple = -1;
- 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;
}
}