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
commit40772ae759fe26acc69bebefa0eda173dbd981e4 (patch)
tree7afa52df382f8e8ee091dbb7acafee175403c9fb /libpqpp/pq-bulkselectcommand.cpp
parentOnly set unlogged for mocked tables on server versions 9.5 and above (diff)
downloadlibdbpp-postgresql-40772ae759fe26acc69bebefa0eda173dbd981e4.tar.bz2
libdbpp-postgresql-40772ae759fe26acc69bebefa0eda173dbd981e4.tar.xz
libdbpp-postgresql-40772ae759fe26acc69bebefa0eda173dbd981e4.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;
}
}