summaryrefslogtreecommitdiff
path: root/libpqpp/pq-helpers.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 16:58:13 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 16:58:13 +0100
commit78d8eeadcf6642eb52b3b178d6da620b0bb34289 (patch)
tree4777a94e6438b79e146754c58ad81a7b6d2a4118 /libpqpp/pq-helpers.h
parentFix virtual/override attribute use (diff)
downloadlibdbpp-postgresql-78d8eeadcf6642eb52b3b178d6da620b0bb34289.tar.bz2
libdbpp-postgresql-78d8eeadcf6642eb52b3b178d6da620b0bb34289.tar.xz
libdbpp-postgresql-78d8eeadcf6642eb52b3b178d6da620b0bb34289.zip
Use unique_ptr for execution results
Diffstat (limited to 'libpqpp/pq-helpers.h')
-rw-r--r--libpqpp/pq-helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpqpp/pq-helpers.h b/libpqpp/pq-helpers.h
index 76e5057..7861d57 100644
--- a/libpqpp/pq-helpers.h
+++ b/libpqpp/pq-helpers.h
@@ -1,6 +1,9 @@
#ifndef PQ_HELPERS_H
#define PQ_HELPERS_H
+#include "libpq-fe.h"
+#include <memory>
+
namespace PQ {
template<auto func> struct pq_deleter {
void
@@ -9,6 +12,8 @@ namespace PQ {
func(p);
}
};
+
+ using ResultPtr = std::unique_ptr<PGresult, pq_deleter<PQclear>>;
}
#endif