diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-22 20:43:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-22 20:43:35 +0200 |
commit | b70088d31a8d3e78409f4247c1f2db9092e828e3 (patch) | |
tree | 94b391194ea0af567fc2a6872ca1a9d9887ee26b /odb/pgsql/result-ptr.hxx | |
parent | 42394a86aafd45d7a03604ce82d9bce471ad121c (diff) |
Get rid of libpq-fe.h inclusion in public headers
The problem with libpq-fe.h is that it is installed in unpredictable
places on different platforms. As a result, a user that uses ODB with
PostgreSQL (and who doesn't really know or care about libpq) is forced
to make sure their application is able to find and include libpq-fe.h
correctly.
Luckily for us, we only use a handful of libpq pointers in public
headers and the workaround is to forward declare them and use that
instead of including libpq-fe.h (which is instead included in source
files).
Diffstat (limited to 'odb/pgsql/result-ptr.hxx')
-rw-r--r-- | odb/pgsql/result-ptr.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/odb/pgsql/result-ptr.hxx b/odb/pgsql/result-ptr.hxx index 4cfe58d..2c5ee89 100644 --- a/odb/pgsql/result-ptr.hxx +++ b/odb/pgsql/result-ptr.hxx @@ -14,6 +14,12 @@ #include <odb/pgsql/details/export.hxx> +// +// Note: do not include this header into public headers (i.e., those +// that may be included, directly or indirectly, by user code) because +// it includes libpq-fe.h +// + namespace odb { namespace pgsql @@ -47,6 +53,14 @@ namespace odb r_ = r; } + PGresult* + release () + { + PGresult* r (r_); + r_ = 0; + return r; + } + private: result_ptr (const result_ptr&); result_ptr& operator= (const result_ptr&); |