summaryrefslogtreecommitdiff
path: root/lib/output/pq/pqConn.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:54:28 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-12 20:54:28 +0100
commitafd243cc87827c94f0cea73748ffc5c1fdf1880a (patch)
treead3f9c39902a78026b24d9a32e8baf6ff2858281 /lib/output/pq/pqConn.h
parentCreate a basic MySQL testing database class (diff)
downloadmygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.tar.bz2
mygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.tar.xz
mygrate-afd243cc87827c94f0cea73748ffc5c1fdf1880a.zip
Avoid direct use of runtime_error in PostgreSQL stuff
Adds proper exception which extends it and gets the PostgreSQL error message.
Diffstat (limited to 'lib/output/pq/pqConn.h')
-rw-r--r--lib/output/pq/pqConn.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/output/pq/pqConn.h b/lib/output/pq/pqConn.h
index 5c9effb..b8609ea 100644
--- a/lib/output/pq/pqConn.h
+++ b/lib/output/pq/pqConn.h
@@ -14,6 +14,12 @@ namespace MyGrate {
class DbValue;
}
namespace MyGrate::Output::Pq {
+ class PqErr : public std::runtime_error {
+ public:
+ PqErr(const std::string & when, PGconn *);
+ PqErr(const std::string & when, PGresult *);
+ };
+
class PqConn : public DbConn {
public:
static constexpr auto paramMode {ParamMode::DollarNum};