summaryrefslogtreecommitdiff
path: root/libpqpp/pq-connection.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 17:23:41 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-10-08 17:23:41 +0100
commitef89db97d3acf1b3573ff6097ff8eb4288c845da (patch)
treee4c5480e122401436716e21ca8eee8610f0d665c /libpqpp/pq-connection.h
parentUse unique_ptr for execution results (diff)
downloadlibdbpp-postgresql-ef89db97d3acf1b3573ff6097ff8eb4288c845da.tar.bz2
libdbpp-postgresql-ef89db97d3acf1b3573ff6097ff8eb4288c845da.tar.xz
libdbpp-postgresql-ef89db97d3acf1b3573ff6097ff8eb4288c845da.zip
Simplify checkResult
Becomes template for however many acceptable status there are and tests as a fold expression.
Diffstat (limited to 'libpqpp/pq-connection.h')
-rw-r--r--libpqpp/pq-connection.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/libpqpp/pq-connection.h b/libpqpp/pq-connection.h
index af013ab..39f7f2a 100644
--- a/libpqpp/pq-connection.h
+++ b/libpqpp/pq-connection.h
@@ -47,13 +47,11 @@ namespace PQ {
void endBulkUpload(const char *) override;
size_t bulkUploadData(const char *, size_t) const override;
- ResultPtr checkResult(PGresult * res, int expected, int alternative = -1) const;
+ template<std::same_as<ExecStatusType>... Expected>
+ ResultPtr checkResult(PGresult * res, Expected... expected) const;
PGconn * conn;
mutable PreparedStatements preparedStatements;
-
- private:
- static bool checkResultInt(PGresult * res, int expected, int alternative);
};
}