summaryrefslogtreecommitdiff
path: root/libpqpp/pq-selectbase.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 18:53:22 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 18:53:22 +0100
commit19609c41b15a818df30508576f50fc0eddc11636 (patch)
treeb7b36a9e69689fd2be7c0660728af59eacb02d10 /libpqpp/pq-selectbase.cpp
parentAdd wrappers for PQgetvalue and PQgetlength in column to simplify access (diff)
downloadlibdbpp-postgresql-19609c41b15a818df30508576f50fc0eddc11636.tar.bz2
libdbpp-postgresql-19609c41b15a818df30508576f50fc0eddc11636.tar.xz
libdbpp-postgresql-19609c41b15a818df30508576f50fc0eddc11636.zip
Support fetching data in binary format (no numeric, datetime, interval support yet)
Diffstat (limited to 'libpqpp/pq-selectbase.cpp')
-rw-r--r--libpqpp/pq-selectbase.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libpqpp/pq-selectbase.cpp b/libpqpp/pq-selectbase.cpp
index 7dbdb4f..1024e5a 100644
--- a/libpqpp/pq-selectbase.cpp
+++ b/libpqpp/pq-selectbase.cpp
@@ -1,12 +1,15 @@
#include "pq-selectbase.h"
#include "pq-column.h"
+#include "pq-binarycolumn.h"
+#include "pq-command.h"
-PQ::SelectBase::SelectBase(const std::string & sql) :
+PQ::SelectBase::SelectBase(const std::string & sql, const PQ::CommandOptions * pqco) :
DB::Command(sql),
DB::SelectCommand(sql),
nTuples(0),
tuple(0),
- execRes(NULL)
+ execRes(NULL),
+ binary(pqco ? pqco->fetchBinary : false)
{
}
@@ -22,7 +25,7 @@ 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)));
+ insertColumn(DB::ColumnPtr(binary ? new BinaryColumn(this, f) : new Column(this, f)));
}
}