summaryrefslogtreecommitdiff
path: root/libpqpp/pq-selectbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/pq-selectbase.cpp')
-rw-r--r--libpqpp/pq-selectbase.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/libpqpp/pq-selectbase.cpp b/libpqpp/pq-selectbase.cpp
index 1ede6b8..7dbdb4f 100644
--- a/libpqpp/pq-selectbase.cpp
+++ b/libpqpp/pq-selectbase.cpp
@@ -1,9 +1,28 @@
#include "pq-selectbase.h"
+#include "pq-column.h"
-PQ::SelectBase::SelectBase() :
+PQ::SelectBase::SelectBase(const std::string & sql) :
+ DB::Command(sql),
+ DB::SelectCommand(sql),
nTuples(0),
tuple(0),
execRes(NULL)
{
}
+PQ::SelectBase::~SelectBase()
+{
+ if (execRes) {
+ PQclear(execRes);
+ }
+}
+
+void
+PQ::SelectBase::createColumns(PGresult * execRes)
+{
+ unsigned int nFields = PQnfields(execRes);
+ for (unsigned int f = 0; f < nFields; f += 1) {
+ insertColumn(DB::ColumnPtr(new Column(this, f)));
+ }
+}
+