summaryrefslogtreecommitdiff
path: root/libpqpp/pq-column.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 18:48:07 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-06-05 18:48:07 +0100
commit55e4104bb02ff89aa6d613896bbab88c6a4fe418 (patch)
tree3e5ce42134f65326d8b0277f1b1a7c087ad952fc /libpqpp/pq-column.h
parentAdd support for bytea / blob type data (diff)
downloadlibdbpp-postgresql-55e4104bb02ff89aa6d613896bbab88c6a4fe418.tar.bz2
libdbpp-postgresql-55e4104bb02ff89aa6d613896bbab88c6a4fe418.tar.xz
libdbpp-postgresql-55e4104bb02ff89aa6d613896bbab88c6a4fe418.zip
Add wrappers for PQgetvalue and PQgetlength in column to simplify access
Diffstat (limited to 'libpqpp/pq-column.h')
-rw-r--r--libpqpp/pq-column.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpqpp/pq-column.h b/libpqpp/pq-column.h
index 08e66a6..f6050ea 100644
--- a/libpqpp/pq-column.h
+++ b/libpqpp/pq-column.h
@@ -15,6 +15,13 @@ namespace PQ {
void apply(DB::HandleField &) const override;
protected:
+ template<typename T>
+ inline T valueAs() const { return *(T*)(value()); }
+ template<typename T>
+ inline T * valueAsPtr() const { return (T*)(value()); }
+ const char * value() const;
+ int length() const;
+
const SelectBase * sc;
const Oid oid;
// Buffer for PQunescapeBytea