From 40772ae759fe26acc69bebefa0eda173dbd981e4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 3 Jan 2017 15:03:05 +0000 Subject: Refactor to remove some duplication --- libpqpp/pq-bulkselectcommand.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'libpqpp/pq-bulkselectcommand.cpp') 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; } } -- cgit v1.2.3