summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 14:05:34 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-13 14:05:34 +0100
commitb125cd0df1d6c7a3776b14f3e701402753c79e93 (patch)
tree2b50f8b91883e04f470b9e8605f8771306b8b625 /lib
parentFix binding multiple parameters in DbStmt (diff)
downloadmygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.tar.bz2
mygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.tar.xz
mygrate-b125cd0df1d6c7a3776b14f3e701402753c79e93.zip
Remember PQ connection string
Diffstat (limited to 'lib')
-rw-r--r--lib/output/pq/pqConn.cpp2
-rw-r--r--lib/output/pq/pqConn.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/output/pq/pqConn.cpp b/lib/output/pq/pqConn.cpp
index c1a7362..309b704 100644
--- a/lib/output/pq/pqConn.cpp
+++ b/lib/output/pq/pqConn.cpp
@@ -15,7 +15,7 @@ namespace MyGrate::Output::Pq {
{
}
- PqConn::PqConn(const char * const str) : conn {PQconnectdb(str), PQfinish}
+ PqConn::PqConn(const char * const str) : connstr {str}, conn {PQconnectdb(str), PQfinish}
{
verify<PqErr>(PQstatus(conn.get()) == CONNECTION_OK, "Connection failure", conn.get());
PQsetNoticeProcessor(conn.get(), notice_processor, this);
diff --git a/lib/output/pq/pqConn.h b/lib/output/pq/pqConn.h
index b8609ea..6db9bcf 100644
--- a/lib/output/pq/pqConn.h
+++ b/lib/output/pq/pqConn.h
@@ -32,6 +32,8 @@ namespace MyGrate::Output::Pq {
DbPrepStmtPtr prepare(const char * const, std::size_t nParams) override;
+ const std::string connstr;
+
private:
static void notice_processor(void *, const char *);
virtual void notice_processor(const char *) const;